fog 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/Rakefile +90 -1
- data/bin/fog +5 -1
- data/changelog.txt +156 -0
- data/docs/_layouts/default.html +1 -0
- data/docs/about/press.markdown +4 -0
- data/docs/compute/index.markdown +4 -0
- data/docs/storage/index.markdown +4 -0
- data/fog.gemspec +3 -3
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/iam.rb +7 -6
- data/lib/fog/aws/models/rds/server.rb +27 -23
- data/lib/fog/aws/parsers/iam/get_group.rb +2 -2
- data/lib/fog/aws/requests/iam/update_server_certificate.rb +37 -0
- data/lib/fog/bin.rb +2 -1
- data/lib/fog/bin/dynect.rb +30 -0
- data/lib/fog/bin/rackspace.rb +4 -0
- data/lib/fog/cdn.rb +4 -0
- data/lib/fog/cdn/aws.rb +6 -0
- data/lib/fog/cdn/parsers/aws/get_invalidation_list.rb +43 -0
- data/lib/fog/cdn/parsers/aws/get_streaming_distribution_list.rb +59 -0
- data/lib/fog/cdn/parsers/aws/streaming_distribution.rb +59 -0
- data/lib/fog/cdn/requests/aws/delete_streaming_distribution.rb +28 -0
- data/lib/fog/cdn/requests/aws/get_invalidation_list.rb +42 -0
- data/lib/fog/cdn/requests/aws/get_streaming_distribution.rb +50 -0
- data/lib/fog/cdn/requests/aws/get_streaming_distribution_list.rb +59 -0
- data/lib/fog/cdn/requests/aws/post_streaming_distribution.rb +78 -0
- data/lib/fog/cdn/requests/aws/put_streaming_distribution_config.rb +83 -0
- data/lib/fog/compute.rb +6 -2
- data/lib/fog/compute/aws.rb +12 -1
- data/lib/fog/compute/brightbox.rb +22 -12
- data/lib/fog/compute/models/aws/image.rb +5 -0
- data/lib/fog/compute/models/aws/server.rb +19 -22
- data/lib/fog/compute/models/aws/tag.rb +1 -1
- data/lib/fog/compute/models/bluebox/server.rb +2 -18
- data/lib/fog/compute/models/brightbox/account.rb +1 -1
- data/lib/fog/compute/models/brightbox/server.rb +2 -2
- data/lib/fog/compute/models/go_grid/server.rb +2 -18
- data/lib/fog/compute/models/linode/server.rb +5 -5
- data/lib/fog/compute/models/ninefold/server.rb +2 -2
- data/lib/fog/compute/models/rackspace/server.rb +2 -18
- data/lib/fog/compute/models/server.rb +27 -0
- data/lib/fog/compute/models/slicehost/server.rb +2 -18
- data/lib/fog/compute/models/storm_on_demand/server.rb +3 -3
- data/lib/fog/compute/models/voxel/server.rb +2 -2
- data/lib/fog/compute/parsers/aws/describe_images.rb +15 -3
- data/lib/fog/compute/parsers/aws/describe_instances.rb +1 -1
- data/lib/fog/compute/parsers/aws/describe_security_groups.rb +31 -7
- data/lib/fog/compute/requests/aws/describe_images.rb +33 -14
- data/lib/fog/compute/requests/aws/describe_volumes.rb +1 -0
- data/lib/fog/compute/requests/aws/modify_image_attribute.rb +39 -0
- data/lib/fog/compute/requests/aws/modify_instance_attribute.rb +37 -0
- data/lib/fog/compute/requests/aws/modify_snapshot_attribute.rb +10 -10
- data/lib/fog/compute/requests/aws/register_image.rb +54 -13
- data/lib/fog/compute/requests/aws/run_instances.rb +5 -0
- data/lib/fog/compute/requests/aws/stop_instances.rb +2 -1
- data/lib/fog/compute/requests/brightbox/activate_console_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/add_listeners_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/add_nodes_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/create_api_client.rb +2 -8
- data/lib/fog/compute/requests/brightbox/create_cloud_ip.rb +2 -8
- data/lib/fog/compute/requests/brightbox/create_image.rb +2 -8
- data/lib/fog/compute/requests/brightbox/create_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/create_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/destroy_api_client.rb +2 -8
- data/lib/fog/compute/requests/brightbox/destroy_cloud_ip.rb +2 -8
- data/lib/fog/compute/requests/brightbox/destroy_image.rb +2 -8
- data/lib/fog/compute/requests/brightbox/destroy_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/destroy_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_account.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_api_client.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_cloud_ip.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_image.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_interface.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_server_type.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_user.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_zone.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_api_clients.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_cloud_ips.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_images.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_load_balancers.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_server_types.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_servers.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_users.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_zones.rb +2 -8
- data/lib/fog/compute/requests/brightbox/map_cloud_ip.rb +2 -8
- data/lib/fog/compute/requests/brightbox/remove_listeners_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/remove_nodes_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/reset_ftp_password_account.rb +2 -8
- data/lib/fog/compute/requests/brightbox/shutdown_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/snapshot_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/start_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/stop_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/unmap_cloud_ip.rb +2 -8
- data/lib/fog/compute/requests/brightbox/update_account.rb +2 -8
- data/lib/fog/compute/requests/brightbox/update_api_client.rb +2 -8
- data/lib/fog/compute/requests/brightbox/update_image.rb +2 -8
- data/lib/fog/compute/requests/brightbox/update_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/update_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/update_user.rb +2 -8
- data/lib/fog/core.rb +1 -0
- data/lib/fog/core/credentials.rb +1 -1
- data/lib/fog/core/errors.rb +3 -1
- data/lib/fog/core/json.rb +20 -0
- data/lib/fog/core/provider.rb +3 -1
- data/lib/fog/core/service.rb +5 -0
- data/lib/fog/dns.rb +8 -1
- data/lib/fog/dns/dynect.rb +80 -0
- data/lib/fog/dns/models/dynect/record.rb +67 -0
- data/lib/fog/dns/models/dynect/records.rb +53 -0
- data/lib/fog/dns/models/dynect/zone.rb +60 -0
- data/lib/fog/dns/models/dynect/zones.rb +29 -0
- data/lib/fog/dns/requests/dynect/delete_record.rb +24 -0
- data/lib/fog/dns/requests/dynect/delete_zone.rb +21 -0
- data/lib/fog/dns/requests/dynect/get_node_list.rb +23 -0
- data/lib/fog/dns/requests/dynect/get_record.rb +25 -0
- data/lib/fog/dns/requests/dynect/get_zone.rb +22 -0
- data/lib/fog/dns/requests/dynect/post_record.rb +27 -0
- data/lib/fog/dns/requests/dynect/post_session.rb +36 -0
- data/lib/fog/dns/requests/dynect/post_zone.rb +32 -0
- data/lib/fog/dns/requests/dynect/put_zone.rb +26 -0
- data/lib/fog/dns/zerigo.rb +1 -1
- data/lib/fog/providers.rb +1 -0
- data/lib/fog/providers/dynect.rb +14 -0
- data/lib/fog/providers/rackspace.rb +1 -0
- data/lib/fog/rackspace/load_balancers.rb +179 -0
- data/lib/fog/rackspace/models/load_balancers/access_rule.rb +39 -0
- data/lib/fog/rackspace/models/load_balancers/access_rules.rb +29 -0
- data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +216 -0
- data/lib/fog/rackspace/models/load_balancers/load_balancers.rb +27 -0
- data/lib/fog/rackspace/models/load_balancers/node.rb +58 -0
- data/lib/fog/rackspace/models/load_balancers/nodes.rb +29 -0
- data/lib/fog/rackspace/models/load_balancers/virtual_ip.rb +35 -0
- data/lib/fog/rackspace/models/load_balancers/virtual_ips.rb +32 -0
- data/lib/fog/rackspace/requests/load_balancers/create_access_rule.rb +24 -0
- data/lib/fog/rackspace/requests/load_balancers/create_load_balancer.rb +26 -0
- data/lib/fog/rackspace/requests/load_balancers/create_node.rb +27 -0
- data/lib/fog/rackspace/requests/load_balancers/create_virtual_ip.rb +20 -0
- data/lib/fog/rackspace/requests/load_balancers/delete_access_rule.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/delete_all_access_rules.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/delete_load_balancer.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/delete_node.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/delete_nodes.rb +17 -0
- data/lib/fog/rackspace/requests/load_balancers/delete_virtual_ip.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_connection_logging.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_connection_throttling.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_load_balancer.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_load_balancer_usage.rb +21 -0
- data/lib/fog/rackspace/requests/load_balancers/get_monitor.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_node.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_session_persistence.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_usage.rb +20 -0
- data/lib/fog/rackspace/requests/load_balancers/list_access_rules.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_algorithms.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_nodes.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_protocols.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_virtual_ips.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/remove_connection_throttling.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/remove_monitor.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/remove_session_persistence.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/set_connection_logging.rb +21 -0
- data/lib/fog/rackspace/requests/load_balancers/set_connection_throttling.rb +22 -0
- data/lib/fog/rackspace/requests/load_balancers/set_monitor.rb +31 -0
- data/lib/fog/rackspace/requests/load_balancers/set_session_persistence.rb +21 -0
- data/lib/fog/rackspace/requests/load_balancers/update_load_balancer.rb +24 -0
- data/lib/fog/rackspace/requests/load_balancers/update_node.rb +26 -0
- data/lib/fog/storage.rb +5 -1
- data/lib/fog/storage/aws.rb +3 -0
- data/lib/fog/storage/models/aws/directory.rb +1 -3
- data/lib/fog/storage/models/aws/file.rb +1 -1
- data/lib/fog/storage/models/google/file.rb +1 -1
- data/lib/fog/storage/models/local/file.rb +8 -6
- data/lib/fog/storage/models/ninefold/file.rb +0 -1
- data/lib/fog/storage/requests/aws/copy_object.rb +1 -1
- data/lib/fog/storage/requests/aws/get_bucket.rb +14 -11
- data/lib/fog/storage/requests/aws/post_object_hidden_fields.rb +2 -4
- data/tests/aws/models/rds/server_tests.rb +4 -4
- data/tests/compute/models/aws/server_tests.rb +15 -1
- data/tests/compute/requests/aws/helper.rb +0 -4
- data/tests/compute/requests/aws/image_tests.rb +40 -9
- data/tests/compute/requests/brightbox/account_tests.rb +1 -1
- data/tests/compute/requests/brightbox/helper.rb +3 -0
- data/tests/compute/requests/brightbox/load_balancer_tests.rb +1 -1
- data/tests/compute/requests/voxel/server_tests.rb +2 -2
- data/tests/dns/helper.rb +18 -0
- data/tests/dns/models/record_tests.rb +3 -2
- data/tests/dns/models/records_tests.rb +2 -2
- data/tests/dns/models/zone_tests.rb +2 -2
- data/tests/dns/models/zones_tests.rb +1 -1
- data/tests/dns/requests/bluebox/dns_tests.rb +0 -12
- data/tests/dns/requests/dnsimple/dns_tests.rb +0 -12
- data/tests/dns/requests/dnsmadeeasy/dns_tests.rb +0 -12
- data/tests/dns/requests/dynect/dns_tests.rb +132 -0
- data/tests/dns/requests/linode/dns_tests.rb +1 -13
- data/tests/dns/requests/slicehost/dns_tests.rb +1 -13
- data/tests/helper.rb +1 -1
- data/tests/helpers/collection_helper.rb +2 -2
- data/tests/helpers/formats_helper.rb +2 -0
- data/tests/helpers/mock_helper.rb +4 -1
- data/tests/rackspace/helper.rb +24 -0
- data/tests/rackspace/load_balancer_tests.rb +21 -0
- data/tests/rackspace/models/access_list_tests.rb +12 -0
- data/tests/rackspace/models/access_lists_tests.rb +12 -0
- data/tests/rackspace/models/load_balancer_tests.rb +116 -0
- data/tests/rackspace/models/load_balancers_tests.rb +19 -0
- data/tests/rackspace/models/node_tests.rb +19 -0
- data/tests/rackspace/models/nodes_tests.rb +12 -0
- data/tests/rackspace/models/virtual_ip_tests.rb +16 -0
- data/tests/rackspace/models/virtual_ips_tests.rb +12 -0
- data/tests/rackspace/requests/access_list_tests.rb +56 -0
- data/tests/rackspace/requests/algorithm_tests.rb +19 -0
- data/tests/rackspace/requests/connection_logging_tests.rb +25 -0
- data/tests/rackspace/requests/connection_throttling_tests.rb +37 -0
- data/tests/rackspace/requests/helper.rb +112 -0
- data/tests/rackspace/requests/load_balancer_tests.rb +63 -0
- data/tests/rackspace/requests/load_balancer_usage_tests.rb +19 -0
- data/tests/rackspace/requests/monitor_tests.rb +46 -0
- data/tests/rackspace/requests/node_tests.rb +87 -0
- data/tests/rackspace/requests/protocol_tests.rb +21 -0
- data/tests/rackspace/requests/session_persistence_tests.rb +33 -0
- data/tests/rackspace/requests/usage_tests.rb +17 -0
- data/tests/rackspace/requests/virtual_ip_tests.rb +40 -0
- data/tests/storage/requests/aws/bucket_tests.rb +53 -0
- metadata +127 -8
- data/lib/fog/compute/requests/aws/modify_image_attributes.rb +0 -37
@@ -0,0 +1,15 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
class LoadBalancers
|
4
|
+
class Real
|
5
|
+
def remove_connection_throttling(load_balancer_id)
|
6
|
+
request(
|
7
|
+
:expects => [200, 202],
|
8
|
+
:path => "loadbalancers/#{load_balancer_id}/connectionthrottle",
|
9
|
+
:method => 'DELETE'
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
class LoadBalancers
|
4
|
+
class Real
|
5
|
+
def remove_monitor(load_balancer_id)
|
6
|
+
request(
|
7
|
+
:expects => [200, 202],
|
8
|
+
:path => "loadbalancers/#{load_balancer_id}/healthmonitor",
|
9
|
+
:method => 'DELETE'
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
class LoadBalancers
|
4
|
+
class Real
|
5
|
+
def remove_session_persistence(load_balancer_id)
|
6
|
+
request(
|
7
|
+
:expects => [200, 202],
|
8
|
+
:path => "loadbalancers/#{load_balancer_id}/sessionpersistence",
|
9
|
+
:method => 'DELETE'
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
class LoadBalancers
|
4
|
+
class Real
|
5
|
+
def set_connection_logging(load_balancer_id, value)
|
6
|
+
data = {
|
7
|
+
'connectionLogging' => {
|
8
|
+
'enabled' => value.to_s
|
9
|
+
}
|
10
|
+
}
|
11
|
+
request(
|
12
|
+
:body => MultiJson.encode(data),
|
13
|
+
:expects => [200, 202],
|
14
|
+
:path => "loadbalancers/#{load_balancer_id}/connectionlogging",
|
15
|
+
:method => 'PUT'
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
class LoadBalancers
|
4
|
+
class Real
|
5
|
+
def set_connection_throttling(load_balancer_id, max_connections, min_connections, max_connection_rate, rate_interval)
|
6
|
+
data = {
|
7
|
+
'maxConnections' => max_connections,
|
8
|
+
'minConnections' => min_connections,
|
9
|
+
'maxConnectionRate' => max_connection_rate,
|
10
|
+
'rateInterval' => rate_interval
|
11
|
+
}
|
12
|
+
request(
|
13
|
+
:body => MultiJson.encode(data),
|
14
|
+
:expects => [200, 202],
|
15
|
+
:path => "loadbalancers/#{load_balancer_id}/connectionthrottle",
|
16
|
+
:method => 'PUT'
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
class LoadBalancers
|
4
|
+
class Real
|
5
|
+
def set_monitor(load_balancer_id, type, delay, timeout, attempsBeforeDeactivation, options = {})
|
6
|
+
data = {
|
7
|
+
'type' => type,
|
8
|
+
'delay' => delay,
|
9
|
+
'timeout' => timeout,
|
10
|
+
'attemptsBeforeDeactivation' => attempsBeforeDeactivation
|
11
|
+
}
|
12
|
+
if options.has_key? :path
|
13
|
+
data['path'] = options[:path]
|
14
|
+
end
|
15
|
+
if options.has_key? :body_regex
|
16
|
+
data['bodyRegex'] = options[:body_regex]
|
17
|
+
end
|
18
|
+
if options.has_key? :status_regex
|
19
|
+
data['statusRegex'] = options[:status_regex]
|
20
|
+
end
|
21
|
+
request(
|
22
|
+
:body => MultiJson.encode(data),
|
23
|
+
:expects => [200, 202],
|
24
|
+
:path => "loadbalancers/#{load_balancer_id}/healthmonitor",
|
25
|
+
:method => 'PUT'
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
class LoadBalancers
|
4
|
+
class Real
|
5
|
+
def set_session_persistence(load_balancer_id, persistence_type)
|
6
|
+
data = {
|
7
|
+
'sessionPersistence' => {
|
8
|
+
'persistenceType' => persistence_type
|
9
|
+
}
|
10
|
+
}
|
11
|
+
request(
|
12
|
+
:body => MultiJson.encode(data),
|
13
|
+
:expects => [200, 202],
|
14
|
+
:path => "loadbalancers/#{load_balancer_id}/sessionpersistence",
|
15
|
+
:method => 'PUT'
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
class LoadBalancers
|
4
|
+
class Real
|
5
|
+
def update_load_balancer(load_balancer_id, options = {})
|
6
|
+
data = {
|
7
|
+
'loadBalancer' => {
|
8
|
+
'name' => options[:name],
|
9
|
+
'port' => options[:port],
|
10
|
+
'protocol' => options[:protocol],
|
11
|
+
'algorithm' => options[:algorithm]
|
12
|
+
}
|
13
|
+
}
|
14
|
+
request(
|
15
|
+
:body => MultiJson.encode(data),
|
16
|
+
:expects => 202,
|
17
|
+
:method => 'PUT',
|
18
|
+
:path => "loadbalancers/#{load_balancer_id}.json"
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
class LoadBalancers
|
4
|
+
class Real
|
5
|
+
def update_node(load_balancer_id, node_id, options = {})
|
6
|
+
data = {
|
7
|
+
'node' => {}
|
8
|
+
}
|
9
|
+
if options.has_key? :weight
|
10
|
+
data['node']['weight'] = options[:weight]
|
11
|
+
end
|
12
|
+
if options.has_key? :condition
|
13
|
+
data['node']['condition'] = options[:condition]
|
14
|
+
end
|
15
|
+
#TODO - Do anything if no valid options are passed in?
|
16
|
+
request(
|
17
|
+
:body => MultiJson.encode(data),
|
18
|
+
:expects => [200, 202],
|
19
|
+
:method => 'PUT',
|
20
|
+
:path => "loadbalancers/#{load_balancer_id}/nodes/#{node_id}.json"
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/fog/storage.rb
CHANGED
@@ -30,7 +30,7 @@ module Fog
|
|
30
30
|
|
31
31
|
def self.directories
|
32
32
|
directories = []
|
33
|
-
for provider in
|
33
|
+
for provider in self.providers
|
34
34
|
begin
|
35
35
|
directories.concat(self[provider].directories)
|
36
36
|
rescue # ignore any missing credentials/etc
|
@@ -73,5 +73,9 @@ module Fog
|
|
73
73
|
metadata
|
74
74
|
end
|
75
75
|
|
76
|
+
def self.providers
|
77
|
+
Fog.services[:storage]
|
78
|
+
end
|
79
|
+
|
76
80
|
end
|
77
81
|
end
|
data/lib/fog/storage/aws.rb
CHANGED
@@ -55,6 +55,8 @@ module Fog
|
|
55
55
|
|
56
56
|
module Utils
|
57
57
|
|
58
|
+
attr_accessor :region
|
59
|
+
|
58
60
|
def cdn
|
59
61
|
@cdn ||= Fog::AWS::CDN.new(
|
60
62
|
:aws_access_key_id => @aws_access_key_id,
|
@@ -179,6 +181,7 @@ module Fog
|
|
179
181
|
|
180
182
|
def initialize(options={})
|
181
183
|
require 'mime/types'
|
184
|
+
require 'multi_json'
|
182
185
|
@aws_access_key_id = options[:aws_access_key_id]
|
183
186
|
@aws_secret_access_key = options[:aws_secret_access_key]
|
184
187
|
options[:region] ||= 'us-east-1'
|
@@ -38,7 +38,7 @@ module Fog
|
|
38
38
|
|
39
39
|
def destroy
|
40
40
|
requires :directory, :key
|
41
|
-
::File.delete(path)
|
41
|
+
::File.delete(path) if ::File.exists?(path)
|
42
42
|
dirs = path.split(::File::SEPARATOR)[0...-1]
|
43
43
|
dirs.length.times do |index|
|
44
44
|
dir_path = dirs[0..-index].join(::File::SEPARATOR)
|
@@ -50,11 +50,13 @@ module Fog
|
|
50
50
|
break
|
51
51
|
end
|
52
52
|
pwd = Dir.pwd
|
53
|
-
Dir.
|
54
|
-
|
55
|
-
Dir.
|
53
|
+
if ::Dir.exists?(dir_path)
|
54
|
+
Dir.chdir(dir_path)
|
55
|
+
if Dir.glob('*').empty?
|
56
|
+
Dir.rmdir(dir_path)
|
57
|
+
end
|
58
|
+
Dir.chdir(pwd)
|
56
59
|
end
|
57
|
-
Dir.chdir(pwd)
|
58
60
|
end
|
59
61
|
true
|
60
62
|
end
|
@@ -80,7 +82,7 @@ module Fog
|
|
80
82
|
Dir.mkdir(dir_path)
|
81
83
|
end
|
82
84
|
end
|
83
|
-
file = ::File.new(path, '
|
85
|
+
file = ::File.new(path, 'wb')
|
84
86
|
if body.is_a?(String)
|
85
87
|
file.write(body)
|
86
88
|
else
|
@@ -30,7 +30,7 @@ module Fog
|
|
30
30
|
# http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectCOPY.html
|
31
31
|
|
32
32
|
def copy_object(source_bucket_name, source_object_name, target_bucket_name, target_object_name, options = {})
|
33
|
-
headers = { 'x-amz-copy-source' => "/#{source_bucket_name}/#{source_object_name}" }.merge!(options)
|
33
|
+
headers = { 'x-amz-copy-source' => "/#{source_bucket_name}/#{CGI.escape(source_object_name)}" }.merge!(options)
|
34
34
|
request({
|
35
35
|
:expects => 200,
|
36
36
|
:headers => headers,
|
@@ -60,17 +60,20 @@ module Fog
|
|
60
60
|
class Mock # :nodoc:all
|
61
61
|
|
62
62
|
def get_bucket(bucket_name, options = {})
|
63
|
+
prefix, marker, delimiter, max_keys = \
|
64
|
+
options['prefix'], options['marker'], options['delimiter'], options['max-keys']
|
65
|
+
common_prefixes = []
|
66
|
+
|
63
67
|
unless bucket_name
|
64
68
|
raise ArgumentError.new('bucket_name is required')
|
65
69
|
end
|
66
|
-
if options['delimiter']
|
67
|
-
Fog::Mock.not_implemented
|
68
|
-
end
|
69
70
|
response = Excon::Response.new
|
70
71
|
if bucket = self.data[:buckets][bucket_name]
|
71
72
|
contents = bucket[:objects].values.sort {|x,y| x['Key'] <=> y['Key']}.reject do |object|
|
72
|
-
(
|
73
|
-
(
|
73
|
+
(prefix && object['Key'][0...prefix.length] != prefix) ||
|
74
|
+
(marker && object['Key'] <= marker) ||
|
75
|
+
(delimiter && object['Key'][(prefix ? prefix.length : 0)..-1].include?(delimiter) \
|
76
|
+
&& common_prefixes << object['Key'].sub(/^(#{prefix}[^#{delimiter}]+.).*/, '\1'))
|
74
77
|
end.map do |object|
|
75
78
|
data = object.reject {|key, value| !['ETag', 'Key', 'StorageClass'].include?(key)}
|
76
79
|
data.merge!({
|
@@ -80,23 +83,23 @@ module Fog
|
|
80
83
|
})
|
81
84
|
data
|
82
85
|
end
|
83
|
-
max_keys =
|
86
|
+
max_keys = max_keys || 1000
|
84
87
|
size = [max_keys, 1000].min
|
85
88
|
truncated_contents = contents[0...size]
|
86
89
|
|
87
90
|
response.status = 200
|
88
91
|
response.body = {
|
89
|
-
'CommonPrefixes' =>
|
92
|
+
'CommonPrefixes' => common_prefixes.uniq,
|
90
93
|
'Contents' => truncated_contents,
|
91
94
|
'IsTruncated' => truncated_contents.size != contents.size,
|
92
|
-
'Marker' =>
|
95
|
+
'Marker' => marker,
|
93
96
|
'MaxKeys' => max_keys,
|
94
97
|
'Name' => bucket['Name'],
|
95
|
-
'Prefix' =>
|
98
|
+
'Prefix' => prefix
|
96
99
|
}
|
97
|
-
if
|
100
|
+
if max_keys && max_keys < response.body['Contents'].length
|
98
101
|
response.body['IsTruncated'] = true
|
99
|
-
response.body['Contents'] = response.body['Contents'][0...
|
102
|
+
response.body['Contents'] = response.body['Contents'][0...max_keys]
|
100
103
|
end
|
101
104
|
else
|
102
105
|
response.status = 404
|
@@ -27,11 +27,9 @@ module Fog
|
|
27
27
|
|
28
28
|
def post_object_hidden_fields(options = {})
|
29
29
|
if options['policy']
|
30
|
-
options['policy'] = MultiJson.encode(options['policy'])
|
30
|
+
options['policy'] = Base64.encode64(MultiJson.encode(options['policy'])).gsub("\n", "")
|
31
31
|
options['AWSAccessKeyId'] = @aws_access_key_id
|
32
|
-
|
33
|
-
signed_string = @hmac.sign(string_to_sign)
|
34
|
-
options['Signature'] = Base64.encode64(signed_string).chomp!
|
32
|
+
options['Signature'] = Base64.encode64(@hmac.sign(options['policy'])).gsub("\n", "")
|
35
33
|
end
|
36
34
|
options
|
37
35
|
end
|
@@ -6,7 +6,7 @@ Shindo.tests("AWS::RDS | server", ['aws', 'rds']) do
|
|
6
6
|
# We'll need this later; create it early to avoid waiting
|
7
7
|
@instance_with_final_snapshot = AWS[:rds].servers.create(rds_default_server_params.merge(:id => uniq_id("fog-snapshot-test"), :backup_retention_period => 1))
|
8
8
|
|
9
|
-
@instance.wait_for { ready? }
|
9
|
+
@instance.wait_for(20*60) { ready? }
|
10
10
|
|
11
11
|
tests('#snapshots') do
|
12
12
|
snapshot = nil
|
@@ -51,10 +51,10 @@ Shindo.tests("AWS::RDS | server", ['aws', 'rds']) do
|
|
51
51
|
@instance.reload.wait_for { state == 'rebooting' }
|
52
52
|
@instance.reload.wait_for { ready? }
|
53
53
|
|
54
|
-
# Restore back to original state
|
54
|
+
# Restore back to original state using symbols
|
55
55
|
restore_options = {
|
56
|
-
|
57
|
-
|
56
|
+
:parameter_group_name => orig_parameter_group,
|
57
|
+
:security_group_names => orig_security_groups
|
58
58
|
}
|
59
59
|
@instance.modify(true, restore_options)
|
60
60
|
|
@@ -6,7 +6,6 @@ Shindo.tests("Fog::Compute[:aws] | monitor", ['aws']) do
|
|
6
6
|
responds_to(association)
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
9
|
tests('new instance') do
|
11
10
|
|
12
11
|
test('#monitor = true') do
|
@@ -44,4 +43,19 @@ Shindo.tests("Fog::Compute[:aws] | monitor", ['aws']) do
|
|
44
43
|
end
|
45
44
|
|
46
45
|
@instance.destroy
|
46
|
+
|
47
|
+
tests('tags') do
|
48
|
+
@instance = Fog::Compute[:aws].servers.create(:tags => {'key' => 'value'})
|
49
|
+
|
50
|
+
tests('@instance.reload.tags').returns({'key' => 'value'}) do
|
51
|
+
@instance.reload.tags
|
52
|
+
end
|
53
|
+
|
54
|
+
unless Fog.mocking?
|
55
|
+
Fog::Compute[:aws].tags.all('resource-id' => @instance.identity).each {|tag| tag.destroy}
|
56
|
+
end
|
57
|
+
|
58
|
+
@instance.destroy
|
59
|
+
end
|
60
|
+
|
47
61
|
end
|