fog 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +1 -0
- data/Rakefile +2 -1
- data/changelog.txt +184 -0
- data/docs/cdn/index.markdown +69 -3
- data/fog.gemspec +2 -2
- data/lib/fog.rb +2 -1
- data/lib/fog/atmos/models/storage/file.rb +16 -14
- data/lib/fog/aws/auto_scaling.rb +55 -13
- data/lib/fog/aws/cdn.rb +69 -9
- data/lib/fog/aws/cloud_watch.rb +15 -1
- data/lib/fog/aws/compute.rb +2 -0
- data/lib/fog/aws/models/auto_scaling/group.rb +10 -4
- data/lib/fog/aws/models/cdn/distribution.rb +93 -0
- data/lib/fog/aws/models/cdn/distribution_helper.rb +64 -0
- data/lib/fog/aws/models/cdn/distributions.rb +32 -0
- data/lib/fog/aws/models/cdn/distributions_helper.rb +47 -0
- data/lib/fog/aws/models/cdn/invalidation.rb +64 -0
- data/lib/fog/aws/models/cdn/invalidations.rb +54 -0
- data/lib/fog/aws/models/cdn/streaming_distribution.rb +77 -0
- data/lib/fog/aws/models/cdn/streaming_distributions.rb +32 -0
- data/lib/fog/aws/models/compute/server.rb +0 -23
- data/lib/fog/aws/models/compute/spot_request.rb +2 -24
- data/lib/fog/aws/models/rds/server.rb +18 -0
- data/lib/fog/aws/models/rds/subnet_group.rb +20 -0
- data/lib/fog/aws/models/rds/subnet_groups.rb +27 -0
- data/lib/fog/aws/models/storage/file.rb +1 -1
- data/lib/fog/aws/parsers/auto_scaling/describe_adjustment_types.rb +15 -2
- data/lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb +39 -13
- data/lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_notification_types.rb +43 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_metric_collection_types.rb +3 -3
- data/lib/fog/aws/parsers/auto_scaling/describe_notification_configurations.rb +42 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_scaling_process_types.rb +15 -2
- data/lib/fog/aws/parsers/auto_scaling/describe_tags.rb +46 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_termination_policy_types.rb +44 -0
- data/lib/fog/aws/parsers/cdn/get_invalidation.rb +32 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb +1 -1
- data/lib/fog/aws/parsers/cloud_watch/list_metrics.rb +1 -1
- data/lib/fog/aws/parsers/compute/describe_availability_zones.rb +13 -2
- data/lib/fog/aws/parsers/compute/describe_reserved_instances.rb +1 -1
- data/lib/fog/aws/parsers/elasticache/base.rb +0 -2
- data/lib/fog/aws/parsers/elasticache/engine_defaults_parser.rb +1 -1
- data/lib/fog/aws/parsers/elasticache/event_list.rb +2 -0
- data/lib/fog/aws/parsers/rds/base.rb +32 -0
- data/lib/fog/aws/parsers/rds/create_db_subnet_group.rb +38 -0
- data/lib/fog/aws/parsers/rds/describe_db_subnet_groups.rb +38 -0
- data/lib/fog/aws/parsers/rds/event_list.rb +40 -0
- data/lib/fog/aws/parsers/rds/subnet_group_parser.rb +38 -0
- data/lib/fog/aws/parsers/rds/tag_list_parser.rb +35 -0
- data/lib/fog/aws/rds.rb +24 -7
- data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +36 -16
- data/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +19 -12
- data/lib/fog/aws/requests/auto_scaling/create_or_update_tags.rb +63 -0
- data/lib/fog/aws/requests/auto_scaling/delete_auto_scaling_group.rb +10 -3
- data/lib/fog/aws/requests/auto_scaling/delete_notification_configuration.rb +21 -5
- data/lib/fog/aws/requests/auto_scaling/delete_policy.rb +2 -2
- data/lib/fog/aws/requests/auto_scaling/delete_tags.rb +63 -0
- data/lib/fog/aws/requests/auto_scaling/describe_adjustment_types.rb +4 -3
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_groups.rb +17 -13
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_instances.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_notification_types.rb +55 -0
- data/lib/fog/aws/requests/auto_scaling/describe_metric_collection_types.rb +6 -5
- data/lib/fog/aws/requests/auto_scaling/describe_notification_configurations.rb +79 -0
- data/lib/fog/aws/requests/auto_scaling/describe_policies.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/describe_scaling_process_types.rb +4 -3
- data/lib/fog/aws/requests/auto_scaling/describe_tags.rb +74 -0
- data/lib/fog/aws/requests/auto_scaling/describe_termination_policy_types.rb +53 -0
- data/lib/fog/aws/requests/auto_scaling/disable_metrics_collection.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/enable_metrics_collection.rb +2 -2
- data/lib/fog/aws/requests/auto_scaling/put_notification_configuration.rb +30 -11
- data/lib/fog/aws/requests/auto_scaling/put_scaling_policy.rb +4 -4
- data/lib/fog/aws/requests/auto_scaling/put_scheduled_update_group_action.rb +8 -5
- data/lib/fog/aws/requests/auto_scaling/set_desired_capacity.rb +2 -2
- data/lib/fog/aws/requests/auto_scaling/set_instance_health.rb +2 -2
- data/lib/fog/aws/requests/auto_scaling/suspend_processes.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb +30 -18
- data/lib/fog/aws/requests/cdn/delete_distribution.rb +31 -0
- data/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb +30 -0
- data/lib/fog/aws/requests/cdn/get_distribution.rb +28 -0
- data/lib/fog/aws/requests/cdn/get_distribution_list.rb +29 -0
- data/lib/fog/aws/requests/cdn/get_invalidation.rb +60 -0
- data/lib/fog/aws/requests/cdn/get_invalidation_list.rb +41 -0
- data/lib/fog/aws/requests/cdn/get_streaming_distribution.rb +26 -0
- data/lib/fog/aws/requests/cdn/get_streaming_distribution_list.rb +30 -0
- data/lib/fog/aws/requests/cdn/post_distribution.rb +44 -0
- data/lib/fog/aws/requests/cdn/post_invalidation.rb +33 -0
- data/lib/fog/aws/requests/cdn/post_streaming_distribution.rb +44 -0
- data/lib/fog/aws/requests/cdn/put_distribution_config.rb +28 -0
- data/lib/fog/aws/requests/cdn/put_streaming_distribution_config.rb +28 -0
- data/lib/fog/aws/requests/compute/create_image.rb +32 -5
- data/lib/fog/aws/requests/compute/create_subnet.rb +3 -3
- data/lib/fog/aws/requests/compute/create_volume.rb +2 -2
- data/lib/fog/aws/requests/compute/register_image.rb +1 -1
- data/lib/fog/aws/requests/elasticache/describe_events.rb +7 -4
- data/lib/fog/aws/requests/glacier/create_archive.rb +1 -1
- data/lib/fog/aws/requests/glacier/initiate_multipart_upload.rb +1 -1
- data/lib/fog/aws/requests/rds/add_tags_to_resource.rb +46 -0
- data/lib/fog/aws/requests/rds/create_db_instance.rb +2 -0
- data/lib/fog/aws/requests/rds/create_db_subnet_group.rb +58 -0
- data/lib/fog/aws/requests/rds/describe_db_subnet_groups.rb +63 -0
- data/lib/fog/aws/requests/rds/describe_events.rb +52 -0
- data/lib/fog/aws/requests/rds/list_tags_for_resource.rb +44 -0
- data/lib/fog/aws/requests/rds/remove_tags_from_resource.rb +44 -0
- data/lib/fog/aws/sqs.rb +1 -1
- data/lib/fog/aws/storage.rb +1 -1
- data/lib/fog/bin/openstack.rb +5 -0
- data/lib/fog/bluebox/models/compute/server.rb +0 -19
- data/lib/fog/bluebox/requests/compute/create_block.rb +8 -8
- data/lib/fog/brightbox/compute.rb +56 -7
- data/lib/fog/brightbox/models/compute/accounts.rb +29 -0
- data/lib/fog/brightbox/models/compute/api_client.rb +37 -0
- data/lib/fog/brightbox/models/compute/api_clients.rb +24 -0
- data/lib/fog/brightbox/models/compute/application.rb +27 -0
- data/lib/fog/brightbox/models/compute/applications.rb +28 -0
- data/lib/fog/brightbox/models/compute/server.rb +3 -1
- data/lib/fog/brightbox/models/compute/users.rb +1 -3
- data/lib/fog/brightbox/requests/compute/create_application.rb +13 -0
- data/lib/fog/brightbox/requests/compute/create_cloud_ip.rb +2 -2
- data/lib/fog/brightbox/requests/compute/destroy_application.rb +14 -0
- data/lib/fog/brightbox/requests/compute/get_account.rb +28 -4
- data/lib/fog/brightbox/requests/compute/get_application.rb +14 -0
- data/lib/fog/brightbox/requests/compute/get_authenticated_user.rb +19 -0
- data/lib/fog/brightbox/requests/compute/get_scoped_account.rb +19 -0
- data/lib/fog/brightbox/requests/compute/get_user.rb +28 -5
- data/lib/fog/brightbox/requests/compute/list_accounts.rb +13 -0
- data/lib/fog/brightbox/requests/compute/list_applications.rb +13 -0
- data/lib/fog/brightbox/requests/compute/reset_secret_application.rb +14 -0
- data/lib/fog/brightbox/requests/compute/update_account.rb +51 -3
- data/lib/fog/brightbox/requests/compute/update_application.rb +15 -0
- data/lib/fog/brightbox/requests/compute/update_firewall_rule.rb +4 -2
- data/lib/fog/brightbox/requests/compute/update_scoped_account.rb +37 -0
- data/lib/fog/clodo/models/compute/server.rb +7 -44
- data/lib/fog/compute/models/server.rb +23 -2
- data/lib/fog/core/time.rb +2 -0
- data/lib/fog/core/wait_for.rb +0 -2
- data/lib/fog/ecloud/models/compute/servers.rb +3 -1
- data/lib/fog/ecloud/requests/compute/get_servers.rb +1 -1
- data/lib/fog/ecloud/requests/compute/get_tasks.rb +1 -1
- data/lib/fog/go_grid/models/compute/server.rb +0 -4
- data/lib/fog/google/storage.rb +1 -1
- data/lib/fog/hp/models/compute/server.rb +1 -23
- data/lib/fog/hp/storage.rb +0 -1
- data/lib/fog/joyent/models/compute/server.rb +4 -0
- data/lib/fog/joyent/models/compute/servers.rb +4 -3
- data/lib/fog/libvirt/models/compute/server.rb +1 -27
- data/lib/fog/linode/models/compute/server.rb +0 -1
- data/lib/fog/local/models/storage/directory.rb +1 -1
- data/lib/fog/network.rb +26 -0
- data/lib/fog/ninefold/compute.rb +8 -0
- data/lib/fog/ninefold/requests/compute/assign_to_load_balancer_rule.rb +13 -0
- data/lib/fog/ninefold/requests/compute/create_load_balancer_rule.rb +11 -0
- data/lib/fog/ninefold/requests/compute/delete_load_balancer_rule.rb +11 -0
- data/lib/fog/ninefold/requests/compute/list_load_balancer_rule_instances.rb +15 -0
- data/lib/fog/ninefold/requests/compute/list_load_balancer_rules.rb +14 -0
- data/lib/fog/ninefold/requests/compute/remove_from_load_balancer_rule.rb +12 -0
- data/lib/fog/ninefold/requests/compute/update_load_balancer_rule.rb +15 -0
- data/lib/fog/ninefold/storage.rb +14 -112
- data/lib/fog/openstack.rb +4 -1
- data/lib/fog/openstack/compute.rb +20 -1
- data/lib/fog/openstack/identity.rb +67 -18
- data/lib/fog/openstack/image.rb +12 -4
- data/lib/fog/openstack/models/compute/security_group.rb +1 -1
- data/lib/fog/openstack/models/compute/server.rb +5 -23
- data/lib/fog/openstack/models/identity/tenants.rb +5 -3
- data/lib/fog/openstack/models/identity/users.rb +4 -1
- data/lib/fog/openstack/models/image/image.rb +6 -1
- data/lib/fog/openstack/models/network/network.rb +46 -0
- data/lib/fog/openstack/models/network/networks.rb +34 -0
- data/lib/fog/openstack/models/network/port.rb +52 -0
- data/lib/fog/openstack/models/network/ports.rb +34 -0
- data/lib/fog/openstack/models/network/subnet.rb +55 -0
- data/lib/fog/openstack/models/network/subnets.rb +34 -0
- data/lib/fog/openstack/network.rb +234 -0
- data/lib/fog/openstack/requests/compute/attach_volume.rb +10 -0
- data/lib/fog/openstack/requests/compute/create_security_group.rb +15 -11
- data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +17 -15
- data/lib/fog/openstack/requests/compute/create_server.rb +7 -1
- data/lib/fog/openstack/requests/compute/create_volume.rb +10 -10
- data/lib/fog/openstack/requests/compute/create_volume_snapshot.rb +16 -1
- data/lib/fog/openstack/requests/compute/detach_volume.rb +5 -0
- data/lib/fog/openstack/requests/compute/get_snapshot_details.rb +4 -4
- data/lib/fog/openstack/requests/compute/get_volume_details.rb +9 -9
- data/lib/fog/openstack/requests/compute/list_security_groups.rb +3 -3
- data/lib/fog/openstack/requests/compute/list_volumes.rb +14 -14
- data/lib/fog/openstack/requests/identity/create_tenant.rb +3 -3
- data/lib/fog/openstack/requests/identity/create_user.rb +1 -1
- data/lib/fog/openstack/requests/identity/delete_role.rb +1 -1
- data/lib/fog/openstack/requests/identity/get_tenant.rb +1 -1
- data/lib/fog/openstack/requests/identity/list_roles.rb +7 -0
- data/lib/fog/openstack/requests/image/create_image.rb +36 -38
- data/lib/fog/openstack/requests/image/delete_image.rb +0 -2
- data/lib/fog/openstack/requests/image/list_public_images.rb +7 -25
- data/lib/fog/openstack/requests/image/list_public_images_detailed.rb +2 -41
- data/lib/fog/openstack/requests/image/update_image.rb +26 -21
- data/lib/fog/openstack/requests/image/update_image_members.rb +37 -0
- data/lib/fog/openstack/requests/network/create_network.rb +44 -0
- data/lib/fog/openstack/requests/network/create_port.rb +52 -0
- data/lib/fog/openstack/requests/network/create_subnet.rb +56 -0
- data/lib/fog/openstack/requests/network/delete_network.rb +30 -0
- data/lib/fog/openstack/requests/network/delete_port.rb +30 -0
- data/lib/fog/openstack/requests/network/delete_subnet.rb +30 -0
- data/lib/fog/openstack/requests/network/get_network.rb +42 -0
- data/lib/fog/openstack/requests/network/get_port.rb +48 -0
- data/lib/fog/openstack/requests/network/get_subnet.rb +49 -0
- data/lib/fog/openstack/requests/network/list_networks.rb +27 -0
- data/lib/fog/openstack/requests/network/list_ports.rb +27 -0
- data/lib/fog/openstack/requests/network/list_subnets.rb +27 -0
- data/lib/fog/openstack/requests/network/set_tenant.rb +21 -0
- data/lib/fog/openstack/requests/network/update_network.rb +41 -0
- data/lib/fog/openstack/requests/network/update_port.rb +44 -0
- data/lib/fog/openstack/requests/network/update_subnet.rb +44 -0
- data/lib/fog/openstack/requests/volume/create_volume.rb +10 -10
- data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +16 -1
- data/lib/fog/openstack/requests/volume/get_snapshot_details.rb +6 -6
- data/lib/fog/openstack/requests/volume/get_volume_details.rb +10 -10
- data/lib/fog/openstack/requests/volume/list_volumes.rb +14 -14
- data/lib/fog/openstack/volume.rb +10 -0
- data/lib/fog/rackspace/models/compute/server.rb +1 -24
- data/lib/fog/rackspace/models/compute_v2/server.rb +4 -2
- data/lib/fog/rackspace/requests/compute_v2/create_server.rb +1 -1
- data/lib/fog/rackspace/requests/compute_v2/list_servers.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/server.rb +1 -5
- data/lib/fog/virtual_box/models/compute/server.rb +2 -44
- data/lib/fog/vmfusion/models/compute/server.rb +3 -36
- data/lib/fog/vsphere/models/compute/server.rb +1 -1
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +2 -31
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +35 -7
- data/tests/aws/models/cdn/distribution_tests.rb +15 -0
- data/tests/aws/models/cdn/distributions_tests.rb +15 -0
- data/tests/aws/models/cdn/invalidation_tests.rb +32 -0
- data/tests/aws/models/cdn/invalidations_tests.rb +15 -0
- data/tests/aws/models/cdn/streaming_distribution_tests.rb +15 -0
- data/tests/aws/models/cdn/streaming_distributions_tests.rb +15 -0
- data/tests/aws/models/rds/tagging_tests.rb +20 -0
- data/tests/aws/requests/auto_scaling/auto_scaling_tests.rb +1 -11
- data/tests/aws/requests/auto_scaling/describe_types_tests.rb +102 -0
- data/tests/aws/requests/auto_scaling/helper.rb +47 -3
- data/tests/aws/requests/auto_scaling/notification_configuration_tests.rb +123 -0
- data/tests/aws/requests/auto_scaling/tag_tests.rb +62 -0
- data/tests/aws/requests/cdn/cdn_tests.rb +252 -0
- data/tests/aws/requests/compute/image_tests.rb +32 -1
- data/tests/aws/requests/compute/volume_tests.rb +3 -3
- data/tests/aws/requests/rds/describe_events.rb +16 -0
- data/tests/aws/requests/rds/helper.rb +26 -0
- data/tests/aws/requests/rds/subnet_groups_test.rb +48 -0
- data/tests/aws/requests/rds/tagging_tests.rb +78 -0
- data/tests/brightbox/requests/compute/account_tests.rb +24 -4
- data/tests/brightbox/requests/compute/application_test.rb +63 -0
- data/tests/brightbox/requests/compute/helper.rb +49 -1
- data/tests/helper.rb +4 -1
- data/tests/local/models/directory_tests.rb +16 -0
- data/tests/ninefold/requests/compute/helper.rb +53 -0
- data/tests/ninefold/requests/compute/load_balancer_tests.rb +66 -0
- data/tests/openstack/models/image/image_tests.rb +1 -0
- data/tests/openstack/models/network/network_tests.rb +24 -0
- data/tests/openstack/models/network/networks_tests.rb +21 -0
- data/tests/openstack/models/network/port_tests.rb +28 -0
- data/tests/openstack/models/network/ports_tests.rb +25 -0
- data/tests/openstack/models/network/subnet_tests.rb +30 -0
- data/tests/openstack/models/network/subnets_tests.rb +27 -0
- data/tests/openstack/requests/compute/image_tests.rb +3 -4
- data/tests/openstack/requests/compute/quota_tests.rb +2 -0
- data/tests/openstack/requests/compute/security_group_tests.rb +10 -10
- data/tests/openstack/requests/compute/server_tests.rb +3 -1
- data/tests/openstack/requests/compute/volume_tests.rb +11 -12
- data/tests/openstack/requests/identity/tenant_tests.rb +2 -1
- data/tests/openstack/requests/image/image_tests.rb +66 -45
- data/tests/openstack/requests/network/network_tests.rb +56 -0
- data/tests/openstack/requests/network/port_tests.rb +63 -0
- data/tests/openstack/requests/network/subnet_tests.rb +66 -0
- data/tests/rackspace/models/identity/user_tests.rb +1 -1
- data/tests/rackspace/models/identity/users_tests.rb +1 -1
- metadata +137 -13
- data/lib/fog/ninefold/models/storage/directories.rb +0 -48
- data/lib/fog/ninefold/models/storage/directory.rb +0 -53
- data/lib/fog/ninefold/models/storage/file.rb +0 -108
- data/lib/fog/ninefold/models/storage/files.rb +0 -73
- data/lib/fog/ninefold/requests/storage/delete_namespace.rb +0 -19
- data/lib/fog/ninefold/requests/storage/get_namespace.rb +0 -20
- data/lib/fog/ninefold/requests/storage/head_namespace.rb +0 -20
- data/lib/fog/ninefold/requests/storage/post_namespace.rb +0 -20
- data/lib/fog/ninefold/requests/storage/put_namespace.rb +0 -20
data/lib/fog/google/storage.rb
CHANGED
@@ -243,7 +243,7 @@ DATA
|
|
243
243
|
canonical_resource << "#{params[:path]}"
|
244
244
|
canonical_resource << '?'
|
245
245
|
for key in (params[:query] || {}).keys
|
246
|
-
if ['acl', 'location', 'logging', 'requestPayment', 'torrent', 'versions', 'versioning'].include?(key)
|
246
|
+
if ['acl', 'cors', 'location', 'logging', 'requestPayment', 'torrent', 'versions', 'versioning'].include?(key)
|
247
247
|
canonical_resource << "#{key}&"
|
248
248
|
end
|
249
249
|
end
|
@@ -31,7 +31,7 @@ module Fog
|
|
31
31
|
attribute :public_ip_address
|
32
32
|
|
33
33
|
attr_reader :password
|
34
|
-
attr_writer :
|
34
|
+
attr_writer :image_id, :flavor_id
|
35
35
|
|
36
36
|
def initialize(attributes = {})
|
37
37
|
# assign these attributes first to prevent race condition with new_record?
|
@@ -67,15 +67,6 @@ module Fog
|
|
67
67
|
addr["addr"] if addr
|
68
68
|
end
|
69
69
|
|
70
|
-
def private_key_path
|
71
|
-
@private_key_path ||= Fog.credentials[:private_key_path]
|
72
|
-
@private_key_path &&= File.expand_path(@private_key_path)
|
73
|
-
end
|
74
|
-
|
75
|
-
def private_key
|
76
|
-
@private_key ||= private_key_path && File.read(private_key_path)
|
77
|
-
end
|
78
|
-
|
79
70
|
def public_ip_address
|
80
71
|
# FIX: Both the private and public ips are bundled under "private" network name
|
81
72
|
# So hack to get to the public ip address
|
@@ -92,15 +83,6 @@ module Fog
|
|
92
83
|
end
|
93
84
|
end
|
94
85
|
|
95
|
-
def public_key_path
|
96
|
-
@public_key_path ||= Fog.credentials[:public_key_path]
|
97
|
-
@public_key_path &&= File.expand_path(@public_key_path)
|
98
|
-
end
|
99
|
-
|
100
|
-
def public_key
|
101
|
-
@public_key ||= public_key_path && File.read(public_key_path)
|
102
|
-
end
|
103
|
-
|
104
86
|
def image_id
|
105
87
|
@image_id ||= (image.nil? ? nil : image["id"])
|
106
88
|
end
|
@@ -211,10 +193,6 @@ module Fog
|
|
211
193
|
retry
|
212
194
|
end
|
213
195
|
|
214
|
-
def username
|
215
|
-
@username ||= 'root'
|
216
|
-
end
|
217
|
-
|
218
196
|
private
|
219
197
|
|
220
198
|
def adminPass=(new_admin_pass)
|
data/lib/fog/hp/storage.rb
CHANGED
@@ -15,12 +15,13 @@ module Fog
|
|
15
15
|
def create(params = {})
|
16
16
|
data = self.connection.create_machine(params).body
|
17
17
|
server = new(data)
|
18
|
-
server.wait_for { ready? }
|
19
18
|
server
|
20
19
|
end
|
21
20
|
|
22
|
-
def bootstrap
|
23
|
-
|
21
|
+
def bootstrap(new_attributes = {})
|
22
|
+
server = create(new_attributes)
|
23
|
+
server.wait_for { ready? }
|
24
|
+
server
|
24
25
|
end
|
25
26
|
|
26
27
|
def get(machine_id)
|
@@ -38,7 +38,6 @@ module Fog
|
|
38
38
|
attr_accessor :network_interface_type ,:network_nat_network, :network_bridge_name
|
39
39
|
attr_accessor :volume_format_type, :volume_allocation,:volume_capacity, :volume_name, :volume_pool_name, :volume_template_name, :volume_path
|
40
40
|
attr_accessor :password
|
41
|
-
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
|
42
41
|
|
43
42
|
# Can be created by passing in :xml => "<xml to create domain/server>"
|
44
43
|
# or by providing :template_options => {
|
@@ -67,10 +66,6 @@ module Fog
|
|
67
66
|
raise Fog::Errors::Error.new("Error saving the server: #{e}")
|
68
67
|
end
|
69
68
|
|
70
|
-
def username
|
71
|
-
@username ||= 'root'
|
72
|
-
end
|
73
|
-
|
74
69
|
def start
|
75
70
|
return true if active?
|
76
71
|
connection.vm_action(uuid, :create)
|
@@ -139,35 +134,14 @@ module Fog
|
|
139
134
|
ip_address(:public)
|
140
135
|
end
|
141
136
|
|
142
|
-
def private_key_path
|
143
|
-
@private_key_path ||= Fog.credentials[:private_key_path]
|
144
|
-
@private_key_path &&= File.expand_path(@private_key_path)
|
145
|
-
end
|
146
|
-
|
147
|
-
def private_key
|
148
|
-
@private_key ||= private_key_path && File.read(private_key_path)
|
149
|
-
end
|
150
|
-
|
151
|
-
def public_key_path
|
152
|
-
@public_key_path ||= Fog.credentials[:public_key_path]
|
153
|
-
@public_key_path &&= File.expand_path(@public_key_path)
|
154
|
-
end
|
155
|
-
|
156
|
-
def public_key
|
157
|
-
@public_key ||= public_key_path && File.read(public_key_path)
|
158
|
-
end
|
159
|
-
|
160
137
|
def ssh(commands)
|
161
138
|
requires :public_ip_address, :username
|
162
139
|
|
163
|
-
#requires :password, :private_key
|
164
140
|
ssh_options={}
|
165
141
|
ssh_options[:password] = password unless password.nil?
|
166
|
-
ssh_options[:key_data] = [private_key] if private_key
|
167
142
|
ssh_options[:proxy]= ssh_proxy unless ssh_proxy.nil?
|
168
143
|
|
169
|
-
|
170
|
-
|
144
|
+
super(commands, ssh_options)
|
171
145
|
end
|
172
146
|
|
173
147
|
def ssh_proxy
|
data/lib/fog/network.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
|
4
|
+
def self.[](provider)
|
5
|
+
self.new(:provider => provider)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.new(attributes)
|
9
|
+
attributes = attributes.dup # Prevent delete from having side effects
|
10
|
+
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
11
|
+
|
12
|
+
case provider
|
13
|
+
when :openstack
|
14
|
+
require 'fog/openstack/network'
|
15
|
+
Fog::Network::OpenStack.new(attributes)
|
16
|
+
else
|
17
|
+
raise ArgumentError.new("#{provider} has no network service")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.providers
|
22
|
+
Fog.services[:network]
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
data/lib/fog/ninefold/compute.rb
CHANGED
@@ -60,6 +60,14 @@ module Fog
|
|
60
60
|
request :create_ip_forwarding_rule
|
61
61
|
request :delete_ip_forwarding_rule
|
62
62
|
request :list_ip_forwarding_rules
|
63
|
+
# Load Balancers
|
64
|
+
request :create_load_balancer_rule
|
65
|
+
request :delete_load_balancer_rule
|
66
|
+
request :remove_from_load_balancer_rule
|
67
|
+
request :assign_to_load_balancer_rule
|
68
|
+
request :list_load_balancer_rules
|
69
|
+
request :list_load_balancer_rule_instances
|
70
|
+
request :update_load_balancer_rule
|
63
71
|
|
64
72
|
class Mock
|
65
73
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ninefold
|
4
|
+
class Real
|
5
|
+
def assign_to_load_balancer_rule(options={})
|
6
|
+
request 'assignToLoadBalancerRule', options, :expects => [200], :response_prefix => 'assigntoloadbalancerruleresponse', :response_type => Hash
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ninefold
|
4
|
+
class Real
|
5
|
+
def create_load_balancer_rule(options={})
|
6
|
+
request 'createLoadBalancerRule', options, :expects => [200], :response_prefix => 'createloadbalancerruleresponse', :response_type => Hash
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ninefold
|
4
|
+
class Real
|
5
|
+
def delete_load_balancer_rule(options={})
|
6
|
+
request 'deleteLoadBalancerRule', options, :expects => [200], :response_prefix => 'deleteloadbalancerruleresponse', :response_type => Hash
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ninefold
|
4
|
+
class Real
|
5
|
+
def list_load_balancer_rule_instances(options={})
|
6
|
+
request 'listLoadBalancerRuleInstances', options, :expects => [200], :response_prefix => 'listloadbalancerruleinstancesresponse', :response_type => Hash
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ninefold
|
4
|
+
class Real
|
5
|
+
def list_load_balancer_rules(options={})
|
6
|
+
request 'listLoadBalancerRules', options, :expects => [200], :response_prefix => 'listloadbalancerrulesresponse', :response_type => Hash
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ninefold
|
4
|
+
class Real
|
5
|
+
def remove_from_load_balancer_rule(options={})
|
6
|
+
request 'removeFromLoadBalancerRule', options, :expects => [200], :response_prefix => 'removefromloadbalancerruleresponse', :response_type => Hash
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ninefold
|
4
|
+
class Real
|
5
|
+
def update_load_balancer_rule(options={})
|
6
|
+
request 'updateLoadBalancerRule', options, :expects => [200], :response_prefix => 'updateloadbalancerruleresponse', :response_type => Hash
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
data/lib/fog/ninefold/storage.rb
CHANGED
@@ -1,34 +1,28 @@
|
|
1
1
|
require 'fog/ninefold'
|
2
2
|
require 'fog/storage'
|
3
|
+
require 'fog/atmos'
|
3
4
|
|
4
5
|
module Fog
|
5
6
|
module Storage
|
6
|
-
class Ninefold < Fog::
|
7
|
+
class Ninefold < Fog::Storage::Atmos
|
7
8
|
STORAGE_HOST = "onlinestorage.ninefold.com" #"api.ninefold.com"
|
8
9
|
STORAGE_PATH = "" #"/storage/v1.0"
|
9
10
|
STORAGE_PORT = "80" # "443"
|
10
11
|
STORAGE_SCHEME = "http" # "https"
|
11
12
|
|
12
13
|
requires :ninefold_storage_token, :ninefold_storage_secret
|
14
|
+
recognizes :persistent
|
13
15
|
|
14
|
-
model_path 'fog/
|
16
|
+
model_path 'fog/atmos/models/storage'
|
15
17
|
model :directory
|
16
18
|
collection :directories
|
17
19
|
model :file
|
18
20
|
collection :files
|
19
21
|
|
20
|
-
request_path 'fog/ninefold/requests/storage'
|
21
|
-
# request :delete_container
|
22
|
-
request :get_namespace
|
23
|
-
request :head_namespace
|
24
|
-
request :post_namespace
|
25
|
-
request :put_namespace
|
26
|
-
request :delete_namespace
|
27
|
-
|
28
22
|
module Utils
|
29
23
|
end
|
30
24
|
|
31
|
-
class Mock
|
25
|
+
class Mock < Fog::Storage::Atmos::Mock
|
32
26
|
include Utils
|
33
27
|
|
34
28
|
def initialize(options={})
|
@@ -43,111 +37,19 @@ module Fog
|
|
43
37
|
|
44
38
|
end
|
45
39
|
|
46
|
-
class Real
|
40
|
+
class Real < Fog::Storage::Atmos::Real
|
47
41
|
include Utils
|
48
42
|
|
49
43
|
def initialize(options={})
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
@connection = Fog::Connection.new("#{Fog::Storage::Ninefold::STORAGE_SCHEME}://#{Fog::Storage::Ninefold::STORAGE_HOST}:#{Fog::Storage::Ninefold::STORAGE_PORT}", @persistent, @connection_options)
|
60
|
-
end
|
61
|
-
|
62
|
-
def uid
|
63
|
-
@ninefold_storage_token#.split('/')[-1]
|
64
|
-
end
|
65
|
-
|
66
|
-
def sign(string)
|
67
|
-
value = @hmac.sign(string)
|
68
|
-
Base64.encode64( value ).chomp()
|
69
|
-
end
|
70
|
-
|
71
|
-
def reload
|
72
|
-
@connection.reset
|
44
|
+
endpoint = "#{STORAGE_SCHEME}://"\
|
45
|
+
"#{STORAGE_HOST}:"\
|
46
|
+
"#{STORAGE_PORT}"\
|
47
|
+
"#{STORAGE_PATH}"
|
48
|
+
options[:atmos_storage_endpoint] = endpoint
|
49
|
+
options[:atmos_storage_token] = options[:ninefold_storage_token]
|
50
|
+
options[:atmos_storage_secret] = options[:ninefold_storage_secret]
|
51
|
+
super(options)
|
73
52
|
end
|
74
|
-
|
75
|
-
def request(params, &block)
|
76
|
-
req_path = params[:path]
|
77
|
-
# Force set host and port
|
78
|
-
params.merge!({
|
79
|
-
:host => Fog::Storage::Ninefold::STORAGE_HOST,
|
80
|
-
:path => "#{Fog::Storage::Ninefold::STORAGE_PATH}/rest/#{params[:path]}",
|
81
|
-
})
|
82
|
-
# Set default method and headers
|
83
|
-
params = {:method => 'GET', :headers => {}}.merge params
|
84
|
-
|
85
|
-
params[:headers]["Content-Type"] ||= "application/octet-stream"
|
86
|
-
|
87
|
-
# Add request date
|
88
|
-
params[:headers]["date"] = Time.now().httpdate()
|
89
|
-
params[:headers]["x-emc-uid"] = @ninefold_storage_token
|
90
|
-
|
91
|
-
# Build signature string
|
92
|
-
signstring = ""
|
93
|
-
signstring += params[:method]
|
94
|
-
signstring += "\n"
|
95
|
-
signstring += params[:headers]["Content-Type"]
|
96
|
-
signstring += "\n"
|
97
|
-
if( params[:headers]["range"] )
|
98
|
-
signstring += params[:headers]["range"]
|
99
|
-
end
|
100
|
-
signstring += "\n"
|
101
|
-
signstring += params[:headers]["date"]
|
102
|
-
signstring += "\n"
|
103
|
-
|
104
|
-
signstring += "/rest/" + URI.unescape( req_path ).downcase
|
105
|
-
query_str = params[:query].map{|k,v| "#{k}=#{v}"}.join('&')
|
106
|
-
signstring += '?' + query_str unless query_str.empty?
|
107
|
-
signstring += "\n"
|
108
|
-
|
109
|
-
customheaders = {}
|
110
|
-
params[:headers].each { |key,value|
|
111
|
-
case key
|
112
|
-
when 'x-emc-date', 'x-emc-signature'
|
113
|
-
#skip
|
114
|
-
when /^x-emc-/
|
115
|
-
customheaders[ key.downcase ] = value
|
116
|
-
end
|
117
|
-
}
|
118
|
-
header_arr = customheaders.sort()
|
119
|
-
|
120
|
-
header_arr.each { |key,value|
|
121
|
-
# Values are lowercase and whitespace-normalized
|
122
|
-
signstring += key + ":" + value.strip.chomp.squeeze( " " ) + "\n"
|
123
|
-
}
|
124
|
-
|
125
|
-
digest = @hmac.sign(signstring.chomp())
|
126
|
-
signature = Base64.encode64( digest ).chomp()
|
127
|
-
params[:headers]["x-emc-signature"] = signature
|
128
|
-
|
129
|
-
begin
|
130
|
-
response = @connection.request(params, &block)
|
131
|
-
rescue Excon::Errors::HTTPStatusError => error
|
132
|
-
raise case error
|
133
|
-
when Excon::Errors::NotFound
|
134
|
-
Fog::Storage::Ninefold::NotFound.slurp(error)
|
135
|
-
else
|
136
|
-
error
|
137
|
-
end
|
138
|
-
end
|
139
|
-
unless response.body.empty?
|
140
|
-
if params[:parse]
|
141
|
-
document = Fog::ToHashDocument.new
|
142
|
-
parser = Nokogiri::XML::SAX::PushParser.new(document)
|
143
|
-
parser << response.body
|
144
|
-
parser.finish
|
145
|
-
response.body = document.body
|
146
|
-
end
|
147
|
-
end
|
148
|
-
response
|
149
|
-
end
|
150
|
-
|
151
53
|
end
|
152
54
|
end
|
153
55
|
end
|