fog 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +3 -3
- data/changelog.txt +213 -0
- data/docs/compute/index.markdown +15 -1
- data/fog.gemspec +3 -3
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +9 -0
- data/lib/fog/aws/auto_scaling.rb +3 -1
- data/lib/fog/aws/cloud_formation.rb +2 -0
- data/lib/fog/aws/cloud_watch.rb +2 -0
- data/lib/fog/aws/compute.rb +9 -3
- data/lib/fog/aws/elasticache.rb +8 -1
- data/lib/fog/aws/elb.rb +2 -0
- data/lib/fog/aws/models/cloud_watch/metric_statistic.rb +1 -2
- data/lib/fog/aws/models/compute/security_group.rb +1 -1
- data/lib/fog/aws/models/compute/server.rb +3 -1
- data/lib/fog/aws/models/dns/records.rb +3 -3
- data/lib/fog/aws/models/elb/load_balancer.rb +6 -0
- data/lib/fog/aws/models/storage/file.rb +2 -2
- data/lib/fog/aws/models/storage/files.rb +4 -4
- data/lib/fog/aws/parsers/compute/describe_instance_status.rb +64 -0
- data/lib/fog/aws/parsers/compute/describe_security_groups.rb +1 -1
- data/lib/fog/aws/parsers/sqs/receive_message.rb +1 -1
- data/lib/fog/aws/parsers/sts/get_session_token.rb +31 -0
- data/lib/fog/aws/rds.rb +36 -1
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +3 -0
- data/lib/fog/aws/requests/compute/describe_instance_status.rb +36 -0
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -0
- data/lib/fog/aws/requests/elb/set_load_balancer_listener_ssl_certificate.rb +27 -0
- data/lib/fog/aws/requests/rds/create_db_instance.rb +64 -1
- data/lib/fog/aws/requests/rds/delete_db_instance.rb +19 -3
- data/lib/fog/aws/requests/rds/describe_db_instances.rb +40 -1
- data/lib/fog/aws/requests/rds/describe_db_reserved_instances.rb +1 -1
- data/lib/fog/aws/requests/rds/modify_db_instance.rb +24 -1
- data/lib/fog/aws/requests/rds/reboot_db_instance.rb +17 -1
- data/lib/fog/aws/requests/storage/{hash_to_acl.rb → acl_utils.rb} +8 -0
- data/lib/fog/aws/requests/storage/copy_object.rb +8 -0
- data/lib/fog/aws/requests/storage/get_bucket_acl.rb +7 -1
- data/lib/fog/aws/requests/storage/get_object_acl.rb +7 -1
- data/lib/fog/aws/requests/storage/get_object_http_url.rb +4 -3
- data/lib/fog/aws/requests/storage/get_object_https_url.rb +4 -3
- data/lib/fog/aws/requests/storage/put_bucket_acl.rb +2 -2
- data/lib/fog/aws/requests/storage/put_object_acl.rb +1 -1
- data/lib/fog/aws/requests/sts/get_federation_token.rb +20 -0
- data/lib/fog/aws/requests/sts/get_session_token.rb +18 -0
- data/lib/fog/aws/simpledb.rb +5 -1
- data/lib/fog/aws/sns.rb +2 -0
- data/lib/fog/aws/sqs.rb +5 -1
- data/lib/fog/aws/storage.rb +6 -0
- data/lib/fog/aws/sts.rb +137 -0
- data/lib/fog/bin.rb +1 -0
- data/lib/fog/bin/aws.rb +2 -0
- data/lib/fog/bin/clodo.rb +31 -0
- data/lib/fog/brightbox/compute.rb +7 -0
- data/lib/fog/brightbox/models/compute/cloud_ip.rb +10 -2
- data/lib/fog/brightbox/models/compute/firewall_policies.rb +29 -0
- data/lib/fog/brightbox/models/compute/firewall_policy.rb +65 -0
- data/lib/fog/brightbox/models/compute/firewall_rule.rb +54 -0
- data/lib/fog/brightbox/models/compute/firewall_rules.rb +24 -0
- data/lib/fog/brightbox/models/compute/image.rb +2 -0
- data/lib/fog/brightbox/models/compute/server.rb +41 -6
- data/lib/fog/brightbox/models/compute/server_group.rb +56 -17
- data/lib/fog/brightbox/requests/compute/remove_firewall_policy.rb +14 -0
- data/lib/fog/clodo.rb +34 -0
- data/lib/fog/clodo/compute.rb +152 -0
- data/lib/fog/clodo/models/compute/image.rb +31 -0
- data/lib/fog/clodo/models/compute/images.rb +28 -0
- data/lib/fog/clodo/models/compute/server.rb +163 -0
- data/lib/fog/clodo/models/compute/servers.rb +36 -0
- data/lib/fog/clodo/requests/compute/add_ip_address.rb +49 -0
- data/lib/fog/clodo/requests/compute/create_server.rb +112 -0
- data/lib/fog/clodo/requests/compute/delete_ip_address.rb +47 -0
- data/lib/fog/clodo/requests/compute/delete_server.rb +44 -0
- data/lib/fog/clodo/requests/compute/get_image_details.rb +20 -0
- data/lib/fog/clodo/requests/compute/get_server_details.rb +49 -0
- data/lib/fog/clodo/requests/compute/list_images.rb +48 -0
- data/lib/fog/clodo/requests/compute/list_images_detail.rb +61 -0
- data/lib/fog/clodo/requests/compute/list_servers.rb +50 -0
- data/lib/fog/clodo/requests/compute/list_servers_detail.rb +51 -0
- data/lib/fog/clodo/requests/compute/move_ip_address.rb +34 -0
- data/lib/fog/clodo/requests/compute/reboot_server.rb +19 -0
- data/lib/fog/clodo/requests/compute/rebuild_server.rb +21 -0
- data/lib/fog/clodo/requests/compute/server_action.rb +25 -0
- data/lib/fog/clodo/requests/compute/start_server.rb +19 -0
- data/lib/fog/clodo/requests/compute/stop_server.rb +19 -0
- data/lib/fog/compute.rb +3 -0
- data/lib/fog/core/credentials.rb +3 -3
- data/lib/fog/core/errors.rb +2 -0
- data/lib/fog/core/wait_for.rb +1 -1
- data/lib/fog/dnsmadeeasy/dns.rb +1 -1
- data/lib/fog/libvirt/compute.rb +2 -0
- data/lib/fog/libvirt/models/compute/nodes.rb +1 -3
- data/lib/fog/libvirt/models/compute/server.rb +8 -1
- data/lib/fog/providers.rb +1 -0
- data/lib/fog/rackspace/dns.rb +10 -2
- data/lib/fog/rackspace/load_balancers.rb +3 -0
- data/lib/fog/rackspace/models/compute/server.rb +2 -2
- data/lib/fog/rackspace/models/dns/callback.rb +3 -1
- data/lib/fog/rackspace/models/dns/record.rb +4 -0
- data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +18 -8
- data/lib/fog/rackspace/requests/load_balancers/delete_nodes.rb +1 -2
- data/lib/fog/rackspace/requests/load_balancers/get_error_page.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb +8 -2
- data/lib/fog/rackspace/requests/load_balancers/remove_error_page.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/set_error_page.rb +21 -0
- data/lib/fog/vcloud/compute.rb +7 -1
- data/lib/fog/vcloud/models/compute/catalogs.rb +4 -5
- data/lib/fog/vcloud/models/compute/helpers/status.rb +37 -0
- data/lib/fog/vcloud/models/compute/network.rb +13 -49
- data/lib/fog/vcloud/models/compute/networks.rb +12 -3
- data/lib/fog/vcloud/models/compute/organization.rb +44 -0
- data/lib/fog/vcloud/models/compute/organizations.rb +29 -0
- data/lib/fog/vcloud/models/compute/server.rb +35 -56
- data/lib/fog/vcloud/models/compute/servers.rb +11 -13
- data/lib/fog/vcloud/models/compute/vapp.rb +41 -0
- data/lib/fog/vcloud/models/compute/vapps.rb +32 -0
- data/lib/fog/vcloud/models/compute/vdc.rb +11 -26
- data/lib/fog/vcloud/models/compute/vdcs.rb +6 -8
- data/lib/fog/vcloud/requests/compute/get_server.rb +10 -0
- data/lib/fog/vsphere/compute.rb +1 -0
- data/lib/fog/vsphere/models/compute/server.rb +18 -0
- data/lib/fog/vsphere/models/compute/servers.rb +8 -2
- data/lib/fog/vsphere/requests/compute/datacenters.rb +34 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +132 -91
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +76 -37
- data/spec/lib/fog/aws/parsers/sqs/receive_message_spec.rb +58 -0
- data/tests/aws/models/elb/model_tests.rb +5 -0
- data/tests/aws/requests/compute/instance_tests.rb +23 -0
- data/tests/aws/requests/compute/security_group_tests.rb +1 -0
- data/tests/aws/requests/elb/listener_tests.rb +4 -0
- data/tests/aws/requests/storage/{hash_to_acl_tests.rb → acl_utils_tests.rb} +38 -2
- data/tests/aws/requests/storage/bucket_tests.rb +0 -3
- data/tests/aws/requests/storage/object_tests.rb +2 -4
- data/tests/aws/requests/sts/get_federation_token_tests.rb +21 -0
- data/tests/aws/requests/sts/session_token_tests.rb +16 -0
- data/tests/brightbox/requests/compute/account_tests.rb +11 -6
- data/tests/brightbox/requests/compute/api_client_tests.rb +23 -12
- data/tests/brightbox/requests/compute/cloud_ip_tests.rb +32 -17
- data/tests/brightbox/requests/compute/helper.rb +29 -3
- data/tests/brightbox/requests/compute/image_tests.rb +17 -14
- data/tests/brightbox/requests/compute/interface_tests.rb +3 -2
- data/tests/brightbox/requests/compute/load_balancer_tests.rb +57 -11
- data/tests/brightbox/requests/compute/server_group_tests.rb +29 -22
- data/tests/brightbox/requests/compute/server_tests.rb +41 -22
- data/tests/brightbox/requests/compute/server_type_tests.rb +7 -6
- data/tests/brightbox/requests/compute/user_tests.rb +11 -16
- data/tests/brightbox/requests/compute/zone_tests.rb +7 -6
- data/tests/clodo/requests/compute/image_tests.rb +36 -0
- data/tests/clodo/requests/compute/server_tests.rb +152 -0
- data/tests/compute/helper.rb +1 -1
- data/tests/core/credential_tests.rb +2 -2
- data/tests/glesys/requests/compute/helper.rb +91 -66
- data/tests/glesys/requests/compute/ip_tests.rb +1 -1
- data/tests/glesys/requests/compute/server_tests.rb +5 -5
- data/tests/helpers/mock_helper.rb +2 -0
- data/tests/rackspace/models/dns/zone_tests.rb +14 -0
- data/tests/rackspace/models/{access_list_tests.rb → load_balancers/access_list_tests.rb} +0 -0
- data/tests/rackspace/models/{access_lists_tests.rb → load_balancers/access_lists_tests.rb} +0 -0
- data/tests/rackspace/models/{load_balancer_tests.rb → load_balancers/load_balancer_tests.rb} +25 -0
- data/tests/rackspace/models/{load_balancers_tests.rb → load_balancers/load_balancers_tests.rb} +0 -0
- data/tests/rackspace/models/{node_tests.rb → load_balancers/node_tests.rb} +0 -0
- data/tests/rackspace/models/{nodes_tests.rb → load_balancers/nodes_tests.rb} +0 -0
- data/tests/rackspace/models/{virtual_ip_tests.rb → load_balancers/virtual_ip_tests.rb} +0 -0
- data/tests/rackspace/models/{virtual_ips_tests.rb → load_balancers/virtual_ips_tests.rb} +0 -0
- data/tests/rackspace/requests/dns/dns_tests.rb +4 -2
- data/tests/rackspace/requests/load_balancers/error_page_tests.rb +31 -0
- data/tests/rackspace/requests/load_balancers/helper.rb +27 -11
- data/tests/rackspace/requests/load_balancers/load_balancer_tests.rb +4 -1
- data/tests/rackspace/requests/load_balancers/node_tests.rb +24 -25
- data/tests/slicehost/requests/compute/slice_tests.rb +2 -2
- data/tests/storm_on_demand/requests/compute/server_tests.rb +3 -3
- data/tests/vcloud/data/api_+_v1.0_+_admin_+_network_+_2 +110 -0
- data/tests/vcloud/data/api_+_v1.0_+_login +5 -0
- data/tests/vcloud/data/api_+_v1.0_+_network_+_1 +44 -0
- data/tests/vcloud/data/api_+_v1.0_+_network_+_2 +31 -0
- data/tests/vcloud/data/api_+_v1.0_+_org_+_1 +17 -0
- data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vapp-1 +369 -0
- data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-1 +139 -0
- data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-2 +155 -0
- data/tests/vcloud/data/api_+_v1.0_+_vdc_+_1 +61 -0
- data/tests/vcloud/models/compute/conn_helper.rb +20 -0
- data/tests/vcloud/models/compute/network_tests.rb +65 -0
- data/tests/vcloud/models/compute/networks_tests.rb +42 -0
- data/tests/vcloud/models/compute/organization_tests.rb +13 -0
- data/tests/vcloud/models/compute/organizations_tests.rb +14 -0
- data/tests/vcloud/models/compute/server_tests.rb +136 -0
- data/tests/vcloud/models/compute/servers_tests.rb +10 -89
- data/tests/vcloud/models/compute/vapp_tests.rb +27 -0
- data/tests/vcloud/models/compute/vapps_tests.rb +17 -0
- data/tests/vcloud/models/compute/vdc_tests.rb +42 -0
- data/tests/vcloud/models/compute/vdcs_tests.rb +17 -0
- data/tests/vsphere/requests/compute/vm_clone_tests.rb +2 -6
- 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
|
34
|
-
|
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
|
-
|
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
|
@@ -45,7 +45,30 @@ module Fog
|
|
45
45
|
class Mock
|
46
46
|
|
47
47
|
def modify_db_instance(db_name, apply_immediately, options={})
|
48
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
@@ -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
|
data/lib/fog/aws/simpledb.rb
CHANGED
@@ -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
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,
|
data/lib/fog/aws/storage.rb
CHANGED
@@ -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'
|