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,39 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class AWS
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/compute/parsers/aws/basic'
|
7
|
+
|
8
|
+
# Modify image attributes
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * image_id<~String> - Id of machine image to modify
|
12
|
+
# * attributes<~Hash>:
|
13
|
+
# * 'Add.Group'<~Array> - One or more groups to grant launch permission to
|
14
|
+
# * 'Add.UserId'<~Array> - One or more account ids to grant launch permission to
|
15
|
+
# * 'Description.Value'<String> - New description for image
|
16
|
+
# * 'ProductCode'<~Array> - One or more product codes to add to image (these can not be removed)
|
17
|
+
# * 'Remove.Group'<~Array> - One or more groups to revoke launch permission from
|
18
|
+
# * 'Remove.UserId'<~Array> - One or more account ids to revoke launch permission from
|
19
|
+
#
|
20
|
+
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html]
|
21
|
+
#
|
22
|
+
def modify_image_attribute(image_id, attributes)
|
23
|
+
params = {}
|
24
|
+
params.merge!(Fog::AWS.indexed_param('LaunchPermission.Add.%d.Group', attributes['Add.Group'] || []))
|
25
|
+
params.merge!(Fog::AWS.indexed_param('LaunchPermission.Add.%d.UserId', attributes['Add.UserId'] || []))
|
26
|
+
params.merge!(Fog::AWS.indexed_param('LaunchPermission.Remove.%d.Group', attributes['Remove.Group'] || []))
|
27
|
+
params.merge!(Fog::AWS.indexed_param('LaunchPermission.Remove.%d.UserId', attributes['Remove.UserId'] || []))
|
28
|
+
params.merge!(Fog::AWS.indexed_param('ProductCode', attributes['ProductCode'] || []))
|
29
|
+
request({
|
30
|
+
'Action' => 'ModifyImageAttribute',
|
31
|
+
:idempotent => true,
|
32
|
+
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
33
|
+
}.merge!(params))
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class AWS
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/compute/parsers/aws/basic'
|
7
|
+
|
8
|
+
# Modify instance attributes
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * image_id<~String> - Id of machine image to modify
|
12
|
+
# * attributes<~Hash>:
|
13
|
+
# 'InstanceType.Value'<~String> - New instance type
|
14
|
+
# 'Kernel.Value'<~String> - New kernel value
|
15
|
+
# 'Ramdisk.Value'<~String> - New ramdisk value
|
16
|
+
# 'UserData.Value'<~String> - New userdata value
|
17
|
+
# 'DisableApiTermination.Value'<~Boolean> - Change api termination value
|
18
|
+
# 'InstanceInitiatedShutdownBehavior.Value'<~String> - New instance initiated shutdown behaviour, in ['stop', 'terminate']
|
19
|
+
# 'SourceDestCheck.Value'<~Boolean> - New sourcedestcheck value
|
20
|
+
# 'GroupId'<~Array> - One or more groups to add instance to (VPC only)
|
21
|
+
#
|
22
|
+
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html]
|
23
|
+
#
|
24
|
+
def modify_instance_attributes(image_id, attributes)
|
25
|
+
params = {}
|
26
|
+
params.merge!(Fog::AWS.indexed_param('GroupId', attributes['GroupId'] || []))
|
27
|
+
request({
|
28
|
+
'Action' => 'ModifyInstanceAttribute',
|
29
|
+
:idempotent => true,
|
30
|
+
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
31
|
+
}.merge!(params))
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -9,22 +9,22 @@ module Fog
|
|
9
9
|
#
|
10
10
|
# ==== Parameters
|
11
11
|
# * snapshot_id<~String> - Id of snapshot to modify
|
12
|
-
# *
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
12
|
+
# * attributes<~Hash>:
|
13
|
+
# * 'Add.Group'<~Array> - One or more groups to grant volume create permission to
|
14
|
+
# * 'Add.UserId'<~Array> - One or more account ids to grant volume create permission to
|
15
|
+
# * 'Remove.Group'<~Array> - One or more groups to revoke volume create permission from
|
16
|
+
# * 'Remove.UserId'<~Array> - One or more account ids to revoke volume create permission from
|
16
17
|
#
|
17
18
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifySnapshotAttribute.html]
|
18
19
|
#
|
19
|
-
def modify_snapshot_attribute(snapshot_id,
|
20
|
+
def modify_snapshot_attribute(snapshot_id, attributes)
|
20
21
|
params = {}
|
21
|
-
params.merge!(Fog::AWS.indexed_param('
|
22
|
-
params.merge!(Fog::AWS.indexed_param('
|
22
|
+
params.merge!(Fog::AWS.indexed_param('CreateVolumePermission.Add.%d.Group', attributes['Add.Group'] || []))
|
23
|
+
params.merge!(Fog::AWS.indexed_param('CreateVolumePermission.Add.%d.UserId', attributes['Add.UserId'] || []))
|
24
|
+
params.merge!(Fog::AWS.indexed_param('CreateVolumePermission.Remove.%d.Group', attributes['Remove.Group'] || []))
|
25
|
+
params.merge!(Fog::AWS.indexed_param('CreateVolumePermission.Remove.%d.UserId', attributes['Remove.UserId'] || []))
|
23
26
|
request({
|
24
27
|
'Action' => 'ModifySnapshotAttribute',
|
25
|
-
'Attribute' => attribute,
|
26
|
-
'SnapshotId' => snapshot_id,
|
27
|
-
'OperationType' => operation_type,
|
28
28
|
:idempotent => true,
|
29
29
|
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
30
30
|
}.merge!(params))
|
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class AWS
|
4
4
|
class Real
|
5
|
-
|
6
5
|
require 'fog/compute/parsers/aws/register_image'
|
7
6
|
|
8
7
|
# register an image
|
@@ -50,32 +49,75 @@ module Fog
|
|
50
49
|
common_options['ImageLocation'] = location
|
51
50
|
end
|
52
51
|
|
53
|
-
|
54
|
-
|
55
|
-
bdi += 1
|
52
|
+
block_devices.each_with_index do |bd, index|
|
53
|
+
index += 1
|
56
54
|
["DeviceName","VirtualName"].each do |n|
|
57
|
-
common_options["BlockDeviceMapping.#{
|
55
|
+
common_options["BlockDeviceMapping.#{index}.#{n}"] = bd[n] if bd[n]
|
58
56
|
end
|
59
57
|
["SnapshotId","VolumeSize","NoDevice","DeleteOnTermination"].each do |n|
|
60
|
-
common_options["BlockDeviceMapping.#{
|
58
|
+
common_options["BlockDeviceMapping.#{index}.Ebs.#{n}"] = bd[n] if bd[n]
|
61
59
|
end
|
62
|
-
|
63
60
|
end
|
64
61
|
|
65
62
|
request(common_options.merge!(options))
|
66
63
|
end
|
67
|
-
|
68
64
|
end
|
69
65
|
|
70
66
|
class Mock
|
71
|
-
|
72
67
|
def register_image(name, description, location, block_devices=[], options={})
|
73
|
-
|
74
|
-
|
68
|
+
unless name.empty?
|
69
|
+
image = {
|
70
|
+
'imageId' => Fog::AWS::Mock.image_id,
|
71
|
+
'imageLocation' => '',
|
72
|
+
'imageState' => 'pending',
|
73
|
+
'imageOwnerId' => self.data[:owner_id],
|
74
|
+
'isPublic' => false,
|
75
|
+
'productCodes' => [],
|
76
|
+
'architecture' => 'i386',
|
77
|
+
'imageType' => 'machine',
|
78
|
+
'kernelId' => Fog::AWS::Mock.kernel_id,
|
79
|
+
'ramdiskId' => Fog::AWS::Mock.ramdisk_id,
|
80
|
+
'platform' => 'Linux',
|
81
|
+
'stateReason' => {},
|
82
|
+
'imageOwnerAlias' => self.data[:owner_id],
|
83
|
+
'name' => name,
|
84
|
+
'description' => description,
|
85
|
+
'rootDeviceType' => '',
|
86
|
+
'rootDeviceName' => '',
|
87
|
+
'blockDeviceMapping' => [],
|
88
|
+
'virtualizationType' => 'paravirtual',
|
89
|
+
'tagSet' => {},
|
90
|
+
'hypervisor' => 'xen',
|
91
|
+
'registered' => Time.now
|
92
|
+
}
|
93
|
+
|
94
|
+
if location[/^\/dev\/sd[a-p]\d{0,2}$/]
|
95
|
+
image['rootDeviceName'] = location
|
96
|
+
image['rootDeviceType'] = 'ebs'
|
97
|
+
else
|
98
|
+
image['imageLocation'] = location
|
99
|
+
end
|
100
|
+
|
101
|
+
block_devices.each do |bd|
|
102
|
+
block_device_mapping = {
|
103
|
+
'ebs' => {}
|
104
|
+
}
|
105
|
+
["DeviceName","VirtualName"].each do |n|
|
106
|
+
block_device_mapping = bd[n] if bd[n]
|
107
|
+
end
|
108
|
+
["SnapshotId","VolumeSize","NoDevice","DeleteOnTermination"].each do |n|
|
109
|
+
block_device_mapping['ebs'][n] = bd[n] if bd[n]
|
110
|
+
end
|
111
|
+
image['blockDeviceMapping'] << block_device_mapping
|
112
|
+
end
|
113
|
+
|
114
|
+
self.data[:images][image['imageId']] = image
|
115
|
+
|
116
|
+
response = Excon::Response.new
|
75
117
|
response.status = 200
|
76
118
|
response.body = {
|
77
119
|
'requestId' => Fog::AWS::Mock.request_id,
|
78
|
-
'imageId' =>
|
120
|
+
'imageId' => image['imageId']
|
79
121
|
}
|
80
122
|
response
|
81
123
|
else
|
@@ -86,7 +128,6 @@ module Fog
|
|
86
128
|
raise Fog::Compute::AWS::Error.new(message)
|
87
129
|
end
|
88
130
|
end
|
89
|
-
|
90
131
|
end
|
91
132
|
end
|
92
133
|
end
|
@@ -20,6 +20,8 @@ module Fog
|
|
20
20
|
# (by default the maximum for an account is 20)
|
21
21
|
# * options<~Hash>:
|
22
22
|
# * 'Placement.AvailabilityZone'<~String> - Placement constraint for instances
|
23
|
+
# * 'Placement.GroupName'<~String> - Name of existing placement group to launch instance into
|
24
|
+
# * 'Placement.Tenancy'<~String> - Tenancy option in ['dedicated', 'default'], defaults to 'default'
|
23
25
|
# * 'BlockDeviceMapping'<~Array>: array of hashes
|
24
26
|
# * 'DeviceName'<~String> - where the volume will be exposed to instance
|
25
27
|
# * 'VirtualName'<~String> - volume virtual device name
|
@@ -27,6 +29,7 @@ module Fog
|
|
27
29
|
# * 'Ebs.VolumeSize'<~String> - size of volume in GiBs required unless snapshot is specified
|
28
30
|
# * 'Ebs.DeleteOnTermination'<~String> - specifies whether or not to delete the volume on instance termination
|
29
31
|
# * 'ClientToken'<~String> - unique case-sensitive token for ensuring idempotency
|
32
|
+
# * 'DisableApiTermination'<~Boolean> - specifies whether or not to allow termination of the instance from the api
|
30
33
|
# * 'SecurityGroup'<~Array> or <~String> - Name of security group(s) for instances (you must omit this parameter if using Virtual Private Clouds)
|
31
34
|
# * 'InstanceInitiatedShutdownBehaviour'<~String> - specifies whether volumes are stopped or terminated when instance is shutdown, in [stop, terminate]
|
32
35
|
# * 'InstanceType'<~String> - Type of instance to boot. Valid options
|
@@ -36,7 +39,9 @@ module Fog
|
|
36
39
|
# * 'KeyName'<~String> - Name of a keypair to add to booting instances
|
37
40
|
# * 'Monitoring.Enabled'<~Boolean> - Enables monitoring, defaults to
|
38
41
|
# disabled
|
42
|
+
# * 'PrivateIpAddress<~String> - VPC option to specify ip address within subnet
|
39
43
|
# * 'RamdiskId'<~String> - Id of ramdisk with which to launch
|
44
|
+
# * 'SubnetId'<~String> - VPC option to specify subnet to launch instance into
|
40
45
|
# * 'UserData'<~String> - Additional data to provide to booting instances
|
41
46
|
#
|
42
47
|
# ==== Returns
|
@@ -17,8 +17,9 @@ module Fog
|
|
17
17
|
# * TODO: fill in the blanks
|
18
18
|
#
|
19
19
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html]
|
20
|
-
def stop_instances(instance_id)
|
20
|
+
def stop_instances(instance_id, force = false)
|
21
21
|
params = Fog::AWS.indexed_param('InstanceId', instance_id)
|
22
|
+
params.merge!('Force' => 'true') if force
|
22
23
|
request({
|
23
24
|
'Action' => 'StopInstances',
|
24
25
|
:idempotent => true,
|
@@ -3,15 +3,9 @@ module Fog
|
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
5
|
|
6
|
-
def activate_console_server(identifier
|
6
|
+
def activate_console_server(identifier)
|
7
7
|
return nil if identifier.nil? || identifier == ""
|
8
|
-
request(
|
9
|
-
:expects => [202],
|
10
|
-
:method => 'POST',
|
11
|
-
:path => "/1.0/servers/#{identifier}/activate_console",
|
12
|
-
:headers => {"Content-Type" => "application/json"},
|
13
|
-
:body => MultiJson.encode(options)
|
14
|
-
)
|
8
|
+
request("post", "/1.0/servers/#{identifier}/activate_console", [202])
|
15
9
|
end
|
16
10
|
|
17
11
|
end
|
@@ -3,15 +3,9 @@ module Fog
|
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
5
|
|
6
|
-
def add_listeners_load_balancer(identifier, options
|
6
|
+
def add_listeners_load_balancer(identifier, options)
|
7
7
|
return nil if identifier.nil? || identifier == ""
|
8
|
-
request(
|
9
|
-
:expects => [202],
|
10
|
-
:method => 'POST',
|
11
|
-
:path => "/1.0/load_balancers/#{identifier}/add_listeners",
|
12
|
-
:headers => {"Content-Type" => "application/json"},
|
13
|
-
:body => MultiJson.encode(options)
|
14
|
-
)
|
8
|
+
request("post", "/1.0/load_balancers/#{identifier}/add_listeners", [202], options)
|
15
9
|
end
|
16
10
|
|
17
11
|
end
|
@@ -3,15 +3,9 @@ module Fog
|
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
5
|
|
6
|
-
def add_nodes_load_balancer(identifier, options
|
6
|
+
def add_nodes_load_balancer(identifier, options)
|
7
7
|
return nil if identifier.nil? || identifier == ""
|
8
|
-
request(
|
9
|
-
:expects => [202],
|
10
|
-
:method => 'POST',
|
11
|
-
:path => "/1.0/load_balancers/#{identifier}/add_nodes",
|
12
|
-
:headers => {"Content-Type" => "application/json"},
|
13
|
-
:body => MultiJson.encode(options)
|
14
|
-
)
|
8
|
+
request("post", "/1.0/load_balancers/#{identifier}/add_nodes", [202], options)
|
15
9
|
end
|
16
10
|
|
17
11
|
end
|
@@ -3,14 +3,8 @@ module Fog
|
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
5
|
|
6
|
-
def create_api_client(options
|
7
|
-
request(
|
8
|
-
:expects => [201],
|
9
|
-
:method => 'POST',
|
10
|
-
:path => "/1.0/api_clients",
|
11
|
-
:headers => {"Content-Type" => "application/json"},
|
12
|
-
:body => MultiJson.encode(options)
|
13
|
-
)
|
6
|
+
def create_api_client(options)
|
7
|
+
request("post", "/1.0/api_clients", [201], options)
|
14
8
|
end
|
15
9
|
|
16
10
|
end
|
@@ -3,14 +3,8 @@ module Fog
|
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
5
|
|
6
|
-
def create_cloud_ip
|
7
|
-
request(
|
8
|
-
:expects => [201],
|
9
|
-
:method => 'POST',
|
10
|
-
:path => "/1.0/cloud_ips",
|
11
|
-
:headers => {"Content-Type" => "application/json"},
|
12
|
-
:body => MultiJson.encode(options)
|
13
|
-
)
|
6
|
+
def create_cloud_ip
|
7
|
+
request("post", "/1.0/cloud_ips", [201])
|
14
8
|
end
|
15
9
|
|
16
10
|
end
|
@@ -3,14 +3,8 @@ module Fog
|
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
5
|
|
6
|
-
def create_image(options
|
7
|
-
request(
|
8
|
-
:expects => [201],
|
9
|
-
:method => 'POST',
|
10
|
-
:path => "/1.0/images",
|
11
|
-
:headers => {"Content-Type" => "application/json"},
|
12
|
-
:body => MultiJson.encode(options)
|
13
|
-
)
|
6
|
+
def create_image(options)
|
7
|
+
request("post", "/1.0/images", [201], options)
|
14
8
|
end
|
15
9
|
|
16
10
|
end
|
@@ -3,14 +3,8 @@ module Fog
|
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
5
|
|
6
|
-
def create_load_balancer(options
|
7
|
-
request(
|
8
|
-
:expects => [202],
|
9
|
-
:method => 'POST',
|
10
|
-
:path => "/1.0/load_balancers",
|
11
|
-
:headers => {"Content-Type" => "application/json"},
|
12
|
-
:body => MultiJson.encode(options)
|
13
|
-
)
|
6
|
+
def create_load_balancer(options)
|
7
|
+
request("post", "/1.0/load_balancers", [202], options)
|
14
8
|
end
|
15
9
|
|
16
10
|
end
|
@@ -3,14 +3,8 @@ module Fog
|
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
5
|
|
6
|
-
def create_server(options
|
7
|
-
request(
|
8
|
-
:expects => [202],
|
9
|
-
:method => 'POST',
|
10
|
-
:path => "/1.0/servers",
|
11
|
-
:headers => {"Content-Type" => "application/json"},
|
12
|
-
:body => MultiJson.encode(options)
|
13
|
-
)
|
6
|
+
def create_server(options)
|
7
|
+
request("post", "/1.0/servers", [202], options)
|
14
8
|
end
|
15
9
|
|
16
10
|
end
|
@@ -3,15 +3,9 @@ module Fog
|
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
5
|
|
6
|
-
def destroy_api_client(identifier
|
6
|
+
def destroy_api_client(identifier)
|
7
7
|
return nil if identifier.nil? || identifier == ""
|
8
|
-
request(
|
9
|
-
:expects => [200],
|
10
|
-
:method => 'DELETE',
|
11
|
-
:path => "/1.0/api_clients/#{identifier}",
|
12
|
-
:headers => {"Content-Type" => "application/json"},
|
13
|
-
:body => MultiJson.encode(options)
|
14
|
-
)
|
8
|
+
request("delete", "/1.0/api_clients/#{identifier}", [200])
|
15
9
|
end
|
16
10
|
|
17
11
|
end
|
@@ -3,15 +3,9 @@ module Fog
|
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
5
|
|
6
|
-
def destroy_cloud_ip(identifier
|
6
|
+
def destroy_cloud_ip(identifier)
|
7
7
|
return nil if identifier.nil? || identifier == ""
|
8
|
-
request(
|
9
|
-
:expects => [200],
|
10
|
-
:method => 'DELETE',
|
11
|
-
:path => "/1.0/cloud_ips/#{identifier}",
|
12
|
-
:headers => {"Content-Type" => "application/json"},
|
13
|
-
:body => MultiJson.encode(options)
|
14
|
-
)
|
8
|
+
request("delete", "/1.0/cloud_ips/#{identifier}", [200])
|
15
9
|
end
|
16
10
|
|
17
11
|
end
|