fog 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -4
- data/bin/fog +4 -1
- data/changelog.txt +464 -0
- data/docs/index.markdown +2 -2
- data/fog.gemspec +11 -11
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/auto_scaling.rb +221 -0
- data/lib/fog/aws/cloud_formation.rb +1 -1
- data/lib/fog/aws/cloud_watch.rb +110 -0
- data/lib/fog/aws/elb.rb +58 -26
- data/lib/fog/aws/iam.rb +65 -13
- data/lib/fog/aws/models/auto_scaling/activities.rb +30 -0
- data/lib/fog/aws/models/auto_scaling/activity.rb +29 -0
- data/lib/fog/aws/models/auto_scaling/configuration.rb +63 -0
- data/lib/fog/aws/models/auto_scaling/configurations.rb +35 -0
- data/lib/fog/aws/models/auto_scaling/group.rb +140 -0
- data/lib/fog/aws/models/auto_scaling/groups.rb +35 -0
- data/lib/fog/aws/models/auto_scaling/instance.rb +60 -0
- data/lib/fog/aws/models/auto_scaling/instances.rb +30 -0
- data/lib/fog/aws/models/cloud_watch/metric.rb +14 -0
- data/lib/fog/aws/models/cloud_watch/metric_statistic.rb +46 -0
- data/lib/fog/aws/models/cloud_watch/metric_statistics.rb +23 -0
- data/lib/fog/aws/models/cloud_watch/metrics.rb +32 -0
- data/lib/fog/aws/models/elb/listener.rb +6 -0
- data/lib/fog/aws/models/elb/listeners.rb +2 -2
- data/lib/fog/aws/models/elb/load_balancer.rb +8 -5
- data/lib/fog/aws/models/rds/server.rb +3 -1
- data/lib/fog/aws/parsers/auto_scaling/basic.rb +28 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_adjustment_types.rb +39 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb +126 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_instances.rb +43 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_launch_configurations.rb +94 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_metric_collection_types.rb +66 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_policies.rb +66 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_scaling_activities.rb +47 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_scaling_process_types.rb +39 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_scheduled_actions.rb +46 -0
- data/lib/fog/aws/parsers/auto_scaling/put_scaling_policy.rb +30 -0
- data/lib/fog/aws/parsers/auto_scaling/terminate_instance_in_auto_scaling_group.rb +35 -0
- data/lib/fog/aws/parsers/cloud_watch/get_metric_statistics.rb +42 -0
- data/lib/fog/aws/parsers/cloud_watch/list_metrics.rb +58 -0
- data/lib/fog/aws/parsers/cloud_watch/put_metric_data.rb +26 -0
- data/lib/fog/aws/parsers/elb/describe_load_balancers.rb +1 -1
- data/lib/fog/aws/parsers/iam/get_group_policy.rb +27 -0
- data/lib/fog/aws/parsers/iam/list_account_aliases.rb +28 -0
- data/lib/fog/aws/parsers/rds/db_engine_version_parser.rb +35 -0
- data/lib/fog/aws/parsers/rds/db_parser.rb +1 -1
- data/lib/fog/aws/parsers/rds/describe_db_engine_versions.rb +39 -0
- data/lib/fog/aws/parsers/rds/describe_db_reserved_instances.rb +43 -0
- data/lib/fog/aws/parsers/sns/add_permission.rb +24 -0
- data/lib/fog/aws/parsers/sns/confirm_subscription.rb +24 -0
- data/lib/fog/aws/parsers/sns/create_topic.rb +24 -0
- data/lib/fog/aws/parsers/sns/delete_topic.rb +24 -0
- data/lib/fog/aws/parsers/sns/get_topic_attributes.rb +32 -0
- data/lib/fog/aws/parsers/sns/list_subscriptions.rb +29 -0
- data/lib/fog/aws/parsers/sns/list_topics.rb +26 -0
- data/lib/fog/aws/parsers/sns/publish.rb +24 -0
- data/lib/fog/aws/parsers/sns/remove_permission.rb +24 -0
- data/lib/fog/aws/parsers/sns/set_topic_attributes.rb +24 -0
- data/lib/fog/aws/parsers/sns/subscribe.rb +24 -0
- data/lib/fog/aws/parsers/sns/unsubscribe.rb +24 -0
- data/lib/fog/aws/parsers/sqs/basic.rb +23 -0
- data/lib/fog/aws/parsers/sqs/create_queue.rb +26 -0
- data/lib/fog/aws/parsers/sqs/get_queue_attributes.rb +35 -0
- data/lib/fog/aws/parsers/sqs/list_queues.rb +25 -0
- data/lib/fog/aws/parsers/sqs/receive_message.rb +41 -0
- data/lib/fog/aws/parsers/sqs/send_message.rb +28 -0
- data/lib/fog/aws/rds.rb +3 -1
- data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +108 -0
- data/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +105 -0
- data/lib/fog/aws/requests/auto_scaling/delete_auto_scaling_group.rb +45 -0
- data/lib/fog/aws/requests/auto_scaling/delete_launch_configuration.rb +48 -0
- data/lib/fog/aws/requests/auto_scaling/delete_policy.rb +47 -0
- data/lib/fog/aws/requests/auto_scaling/delete_scheduled_action.rb +48 -0
- data/lib/fog/aws/requests/auto_scaling/describe_adjustment_types.rb +52 -0
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_groups.rb +128 -0
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_instances.rb +96 -0
- data/lib/fog/aws/requests/auto_scaling/describe_launch_configurations.rb +108 -0
- data/lib/fog/aws/requests/auto_scaling/describe_metric_collection_types.rb +60 -0
- data/lib/fog/aws/requests/auto_scaling/describe_policies.rb +85 -0
- data/lib/fog/aws/requests/auto_scaling/describe_scaling_activities.rb +88 -0
- data/lib/fog/aws/requests/auto_scaling/describe_scaling_process_types.rb +54 -0
- data/lib/fog/aws/requests/auto_scaling/describe_scheduled_actions.rb +83 -0
- data/lib/fog/aws/requests/auto_scaling/disable_metrics_collection.rb +56 -0
- data/lib/fog/aws/requests/auto_scaling/enable_metrics_collection.rb +66 -0
- data/lib/fog/aws/requests/auto_scaling/execute_policy.rb +50 -0
- data/lib/fog/aws/requests/auto_scaling/put_scaling_policy.rb +66 -0
- data/lib/fog/aws/requests/auto_scaling/put_scheduled_update_group_action.rb +57 -0
- data/lib/fog/aws/requests/auto_scaling/resume_processes.rb +50 -0
- data/lib/fog/aws/requests/auto_scaling/set_desired_capacity.rb +87 -0
- data/lib/fog/aws/requests/auto_scaling/set_instance_health.rb +55 -0
- data/lib/fog/aws/requests/auto_scaling/suspend_processes.rb +57 -0
- data/lib/fog/aws/requests/auto_scaling/terminate_instance_in_auto_scaling_group.rb +65 -0
- data/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb +79 -0
- data/lib/fog/aws/requests/cloud_watch/get_metric_statistics.rb +48 -0
- data/lib/fog/aws/requests/cloud_watch/list_metrics.rb +38 -0
- data/lib/fog/aws/requests/cloud_watch/put_metric_data.rb +73 -0
- data/lib/fog/aws/requests/elb/configure_health_check.rb +24 -0
- data/lib/fog/aws/requests/elb/create_app_cookie_stickiness_policy.rb +21 -0
- data/lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb +21 -0
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +55 -0
- data/lib/fog/aws/requests/elb/create_load_balancer_listeners.rb +28 -0
- data/lib/fog/aws/requests/elb/delete_load_balancer.rb +18 -0
- data/lib/fog/aws/requests/elb/delete_load_balancer_listeners.rb +20 -1
- data/lib/fog/aws/requests/elb/delete_load_balancer_policy.rb +23 -0
- data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +21 -5
- data/lib/fog/aws/requests/elb/describe_instance_health.rb +35 -0
- data/lib/fog/aws/requests/elb/describe_load_balancers.rb +29 -0
- data/lib/fog/aws/requests/elb/disable_availability_zones_for_load_balancer.rb +18 -5
- data/lib/fog/aws/requests/elb/enable_availability_zones_for_load_balancer.rb +18 -3
- data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +22 -5
- data/lib/fog/aws/requests/elb/set_load_balancer_listener_ssl_certificate.rb +40 -0
- data/lib/fog/aws/requests/elb/set_load_balancer_policies_of_listener.rb +37 -0
- data/lib/fog/aws/requests/iam/create_account_alias.rb +19 -0
- data/lib/fog/aws/requests/iam/delete_account_alias.rb +19 -0
- data/lib/fog/aws/requests/iam/delete_server_certificate.rb +14 -0
- data/lib/fog/aws/requests/iam/get_group_policy.rb +36 -0
- data/lib/fog/aws/requests/iam/get_server_certificate.rb +50 -0
- data/lib/fog/aws/requests/iam/list_account_aliases.rb +18 -0
- data/lib/fog/aws/requests/iam/list_server_certificates.rb +12 -0
- data/lib/fog/aws/requests/iam/put_group_policy.rb +1 -1
- data/lib/fog/aws/requests/iam/put_user_policy.rb +1 -1
- data/lib/fog/aws/requests/iam/upload_server_certificate.rb +53 -5
- data/lib/fog/aws/requests/rds/describe_db_engine_versions.rb +34 -0
- data/lib/fog/aws/requests/rds/describe_db_reserved_instances.rb +42 -0
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +29 -17
- data/lib/fog/aws/requests/simpledb/select.rb +11 -3
- data/lib/fog/aws/requests/sns/add_permission.rb +26 -0
- data/lib/fog/aws/requests/sns/confirm_subscription.rb +33 -0
- data/lib/fog/aws/requests/sns/create_topic.rb +29 -0
- data/lib/fog/aws/requests/sns/delete_topic.rb +29 -0
- data/lib/fog/aws/requests/sns/get_topic_attributes.rb +29 -0
- data/lib/fog/aws/requests/sns/list_subscriptions.rb +29 -0
- data/lib/fog/aws/requests/sns/list_subscriptions_by_topic.rb +31 -0
- data/lib/fog/aws/requests/sns/list_topics.rb +29 -0
- data/lib/fog/aws/requests/sns/publish.rb +34 -0
- data/lib/fog/aws/requests/sns/remove_permission.rb +26 -0
- data/lib/fog/aws/requests/sns/set_topic_attributes.rb +33 -0
- data/lib/fog/aws/requests/sns/subscribe.rb +33 -0
- data/lib/fog/aws/requests/sns/unsubscribe.rb +29 -0
- data/lib/fog/aws/requests/sqs/change_message_visibility.rb +33 -0
- data/lib/fog/aws/requests/sqs/create_queue.rb +31 -0
- data/lib/fog/aws/requests/sqs/delete_message.rb +31 -0
- data/lib/fog/aws/requests/sqs/delete_queue.rb +29 -0
- data/lib/fog/aws/requests/sqs/get_queue_attributes.rb +31 -0
- data/lib/fog/aws/requests/sqs/list_queues.rb +28 -0
- data/lib/fog/aws/requests/sqs/receive_message.rb +34 -0
- data/lib/fog/aws/requests/sqs/send_message.rb +31 -0
- data/lib/fog/aws/requests/sqs/set_queue_attributes.rb +33 -0
- data/lib/fog/aws/sns.rb +112 -0
- data/lib/fog/aws/sqs.rb +115 -0
- data/lib/fog/bin.rb +1 -0
- data/lib/fog/bin/aws.rb +16 -0
- data/lib/fog/bin/brightbox.rb +1 -1
- data/lib/fog/bin/ninefold.rb +5 -0
- data/lib/fog/bin/vcloud.rb +30 -0
- data/lib/fog/bin/virtual_box.rb +5 -1
- data/lib/fog/cdn/rackspace.rb +16 -8
- data/lib/fog/compute.rb +4 -1
- data/lib/fog/compute/aws.rb +16 -4
- data/lib/fog/compute/bluebox.rb +2 -2
- data/lib/fog/compute/brightbox.rb +4 -4
- data/lib/fog/compute/go_grid.rb +2 -2
- data/lib/fog/compute/linode.rb +2 -2
- data/lib/fog/compute/models/aws/server.rb +17 -3
- data/lib/fog/compute/models/aws/spot_request.rb +93 -0
- data/lib/fog/compute/models/aws/spot_requests.rb +48 -0
- data/lib/fog/compute/models/aws/volume.rb +13 -13
- data/lib/fog/compute/models/bluebox/server.rb +4 -4
- data/lib/fog/compute/models/go_grid/server.rb +2 -2
- data/lib/fog/compute/models/ninefold/server.rb +18 -14
- data/lib/fog/compute/models/rackspace/flavor.rb +3 -2
- data/lib/fog/compute/models/rackspace/server.rb +2 -2
- data/lib/fog/compute/models/slicehost/server.rb +1 -1
- data/lib/fog/compute/models/vcloud/catalog.rb +22 -0
- data/lib/fog/compute/models/vcloud/catalog_item.rb +29 -0
- data/lib/fog/compute/models/vcloud/catalog_items.rb +32 -0
- data/lib/fog/compute/models/vcloud/catalogs.rb +39 -0
- data/lib/fog/compute/models/vcloud/ip.rb +42 -0
- data/lib/fog/compute/models/vcloud/ips.rb +33 -0
- data/lib/fog/compute/models/vcloud/network.rb +65 -0
- data/lib/fog/compute/models/vcloud/networks.rb +34 -0
- data/lib/fog/compute/models/vcloud/server.rb +291 -0
- data/lib/fog/compute/models/vcloud/servers.rb +58 -0
- data/lib/fog/compute/models/vcloud/task.rb +21 -0
- data/lib/fog/compute/models/vcloud/tasks.rb +32 -0
- data/lib/fog/compute/models/vcloud/vdc.rb +56 -0
- data/lib/fog/compute/models/vcloud/vdcs.rb +40 -0
- data/lib/fog/compute/models/virtual_box/server.rb +2 -2
- data/lib/fog/compute/ninefold.rb +3 -3
- data/lib/fog/compute/parsers/aws/cancel_spot_instance_requests.rb +30 -0
- data/lib/fog/compute/parsers/aws/describe_instances.rb +9 -4
- data/lib/fog/compute/parsers/aws/describe_placement_groups.rb +30 -0
- data/lib/fog/compute/parsers/aws/describe_reserved_instances.rb +1 -1
- data/lib/fog/compute/parsers/aws/describe_reserved_instances_offerings.rb +2 -2
- data/lib/fog/compute/parsers/aws/describe_spot_price_history.rb +34 -0
- data/lib/fog/compute/parsers/aws/purchase_reserved_instances_offering.rb +24 -0
- data/lib/fog/compute/parsers/aws/run_instances.rb +17 -16
- data/lib/fog/compute/parsers/aws/spot_datafeed_subscription.rb +29 -0
- data/lib/fog/compute/parsers/aws/spot_instance_requests.rb +67 -0
- data/lib/fog/compute/rackspace.rb +6 -5
- data/lib/fog/compute/requests/aws/cancel_spot_instance_requests.rb +34 -0
- data/lib/fog/compute/requests/aws/create_placement_group.rb +34 -0
- data/lib/fog/compute/requests/aws/create_spot_datafeed_subscription.rb +41 -0
- data/lib/fog/compute/requests/aws/delete_placement_group.rb +32 -0
- data/lib/fog/compute/requests/aws/delete_spot_datafeed_subscription.rb +28 -0
- data/lib/fog/compute/requests/aws/describe_placement_groups.rb +35 -0
- data/lib/fog/compute/requests/aws/describe_reserved_instances.rb +14 -0
- data/lib/fog/compute/requests/aws/describe_reserved_instances_offerings.rb +25 -0
- data/lib/fog/compute/requests/aws/describe_spot_datafeed_subscription.rb +35 -0
- data/lib/fog/compute/requests/aws/describe_spot_instance_requests.rb +47 -0
- data/lib/fog/compute/requests/aws/describe_spot_price_history.rb +37 -0
- data/lib/fog/compute/requests/aws/describe_volumes.rb +1 -1
- data/lib/fog/compute/requests/aws/purchase_reserved_instances_offering.rb +63 -0
- data/lib/fog/compute/requests/aws/request_spot_instances.rb +83 -0
- data/lib/fog/compute/requests/aws/run_instances.rb +2 -3
- data/lib/fog/compute/requests/brightbox/activate_console_server.rb +1 -1
- data/lib/fog/compute/requests/brightbox/add_listeners_load_balancer.rb +1 -1
- data/lib/fog/compute/requests/brightbox/add_nodes_load_balancer.rb +1 -1
- data/lib/fog/compute/requests/brightbox/create_api_client.rb +1 -1
- data/lib/fog/compute/requests/brightbox/create_cloud_ip.rb +1 -1
- data/lib/fog/compute/requests/brightbox/create_image.rb +1 -1
- data/lib/fog/compute/requests/brightbox/create_load_balancer.rb +1 -1
- data/lib/fog/compute/requests/brightbox/create_server.rb +1 -1
- data/lib/fog/compute/requests/brightbox/destroy_api_client.rb +1 -1
- data/lib/fog/compute/requests/brightbox/destroy_cloud_ip.rb +1 -1
- data/lib/fog/compute/requests/brightbox/destroy_image.rb +1 -1
- data/lib/fog/compute/requests/brightbox/destroy_load_balancer.rb +1 -1
- data/lib/fog/compute/requests/brightbox/destroy_server.rb +1 -1
- data/lib/fog/compute/requests/brightbox/get_account.rb +1 -1
- data/lib/fog/compute/requests/brightbox/get_api_client.rb +1 -1
- data/lib/fog/compute/requests/brightbox/get_cloud_ip.rb +1 -1
- data/lib/fog/compute/requests/brightbox/get_image.rb +1 -1
- data/lib/fog/compute/requests/brightbox/get_interface.rb +1 -1
- data/lib/fog/compute/requests/brightbox/get_load_balancer.rb +1 -1
- data/lib/fog/compute/requests/brightbox/get_server.rb +1 -1
- data/lib/fog/compute/requests/brightbox/get_server_type.rb +1 -1
- data/lib/fog/compute/requests/brightbox/get_user.rb +1 -1
- data/lib/fog/compute/requests/brightbox/get_zone.rb +1 -1
- data/lib/fog/compute/requests/brightbox/list_api_clients.rb +1 -1
- data/lib/fog/compute/requests/brightbox/list_cloud_ips.rb +1 -1
- data/lib/fog/compute/requests/brightbox/list_images.rb +1 -1
- data/lib/fog/compute/requests/brightbox/list_load_balancers.rb +1 -1
- data/lib/fog/compute/requests/brightbox/list_server_types.rb +1 -1
- data/lib/fog/compute/requests/brightbox/list_servers.rb +1 -1
- data/lib/fog/compute/requests/brightbox/list_users.rb +1 -1
- data/lib/fog/compute/requests/brightbox/list_zones.rb +1 -1
- data/lib/fog/compute/requests/brightbox/map_cloud_ip.rb +1 -1
- data/lib/fog/compute/requests/brightbox/remove_listeners_load_balancer.rb +1 -1
- data/lib/fog/compute/requests/brightbox/remove_nodes_load_balancer.rb +1 -1
- data/lib/fog/compute/requests/brightbox/reset_ftp_password_account.rb +1 -1
- data/lib/fog/compute/requests/brightbox/resize_server.rb +1 -1
- data/lib/fog/compute/requests/brightbox/shutdown_server.rb +1 -1
- data/lib/fog/compute/requests/brightbox/snapshot_server.rb +1 -1
- data/lib/fog/compute/requests/brightbox/start_server.rb +1 -1
- data/lib/fog/compute/requests/brightbox/stop_server.rb +1 -1
- data/lib/fog/compute/requests/brightbox/unmap_cloud_ip.rb +1 -1
- data/lib/fog/compute/requests/brightbox/update_account.rb +1 -1
- data/lib/fog/compute/requests/brightbox/update_api_client.rb +1 -1
- data/lib/fog/compute/requests/brightbox/update_image.rb +1 -1
- data/lib/fog/compute/requests/brightbox/update_load_balancer.rb +1 -1
- data/lib/fog/compute/requests/brightbox/update_server.rb +1 -1
- data/lib/fog/compute/requests/brightbox/update_user.rb +1 -1
- data/lib/fog/compute/requests/linode/linode_disk_createfromstackscript.rb +1 -1
- data/lib/fog/compute/requests/rackspace/create_image.rb +1 -1
- data/lib/fog/compute/requests/rackspace/create_server.rb +1 -1
- data/lib/fog/compute/requests/rackspace/server_action.rb +2 -2
- data/lib/fog/compute/requests/rackspace/update_server.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/add_balancer_node.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/clone_server.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/create_server.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/delete_server.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/get_server.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/get_stats.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/list_balancers.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/list_configs.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/list_images.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/list_private_ips.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/list_servers.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/list_templates.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/reboot_server.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/remove_balancer_node.rb +1 -1
- data/lib/fog/compute/requests/storm_on_demand/resize_server.rb +1 -1
- data/lib/fog/compute/requests/vcloud/clone_vapp.rb +40 -0
- data/lib/fog/compute/requests/vcloud/configure_network.rb +43 -0
- data/lib/fog/compute/requests/vcloud/configure_network_ip.rb +46 -0
- data/lib/fog/compute/requests/vcloud/configure_node.rb +38 -0
- data/lib/fog/compute/requests/vcloud/configure_vapp.rb +112 -0
- data/lib/fog/compute/requests/vcloud/configure_vm.rb +247 -0
- data/lib/fog/compute/requests/vcloud/configure_vm_disks.rb +100 -0
- data/lib/fog/compute/requests/vcloud/configure_vm_memory.rb +40 -0
- data/lib/fog/compute/requests/vcloud/configure_vm_name_description.rb +30 -0
- data/lib/fog/compute/requests/vcloud/delete_node.rb +10 -0
- data/lib/fog/compute/requests/vcloud/delete_vapp.rb +10 -0
- data/lib/fog/compute/requests/vcloud/get_catalog.rb +10 -0
- data/lib/fog/compute/requests/vcloud/get_catalog_item.rb +10 -0
- data/lib/fog/compute/requests/vcloud/get_customization_options.rb +10 -0
- data/lib/fog/compute/requests/vcloud/get_network.rb +10 -0
- data/lib/fog/compute/requests/vcloud/get_network_extensions.rb +11 -0
- data/lib/fog/compute/requests/vcloud/get_network_ip.rb +15 -0
- data/lib/fog/compute/requests/vcloud/get_network_ips.rb +15 -0
- data/lib/fog/compute/requests/vcloud/get_organization.rb +11 -0
- data/lib/fog/compute/requests/vcloud/get_task.rb +11 -0
- data/lib/fog/compute/requests/vcloud/get_task_list.rb +11 -0
- data/lib/fog/compute/requests/vcloud/get_vapp.rb +10 -0
- data/lib/fog/compute/requests/vcloud/get_vapp_template.rb +11 -0
- data/lib/fog/compute/requests/vcloud/get_vdc.rb +10 -0
- data/lib/fog/compute/requests/vcloud/get_vm_disks.rb +16 -0
- data/lib/fog/compute/requests/vcloud/get_vm_memory.rb +16 -0
- data/lib/fog/compute/requests/vcloud/instantiate_vapp_template.rb +83 -0
- data/lib/fog/compute/requests/vcloud/login.rb +23 -0
- data/lib/fog/compute/requests/vcloud/power_off.rb +10 -0
- data/lib/fog/compute/requests/vcloud/power_on.rb +11 -0
- data/lib/fog/compute/requests/vcloud/power_reset.rb +11 -0
- data/lib/fog/compute/requests/vcloud/power_shutdown.rb +11 -0
- data/lib/fog/compute/requests/vcloud/undeploy.rb +23 -0
- data/lib/fog/compute/storm_on_demand.rb +2 -2
- data/lib/fog/compute/vcloud.rb +310 -0
- data/lib/fog/core.rb +2 -1
- data/lib/fog/core/attributes.rb +23 -11
- data/lib/fog/core/collection.rb +7 -7
- data/lib/fog/core/credentials.rb +4 -2
- data/lib/fog/core/model.rb +4 -4
- data/lib/fog/core/time.rb +1 -2
- data/lib/fog/core/timeout.rb +11 -0
- data/lib/fog/core/wait_for.rb +2 -2
- data/lib/fog/dns/dnsimple.rb +2 -2
- data/lib/fog/dns/dnsmadeeasy.rb +2 -2
- data/lib/fog/dns/linode.rb +2 -2
- data/lib/fog/dns/requests/dnsimple/create_domain.rb +1 -1
- data/lib/fog/dns/requests/dnsimple/create_record.rb +1 -1
- data/lib/fog/dns/requests/dnsimple/update_record.rb +1 -1
- data/lib/fog/dns/requests/dnsmadeeasy/create_record.rb +1 -1
- data/lib/fog/dns/requests/dnsmadeeasy/create_secondary.rb +1 -1
- data/lib/fog/dns/requests/dnsmadeeasy/update_record.rb +1 -1
- data/lib/fog/dns/requests/dnsmadeeasy/update_secondary.rb +1 -1
- data/lib/fog/providers.rb +1 -0
- data/lib/fog/providers/aws.rb +15 -2
- data/lib/fog/providers/ninefold.rb +1 -0
- data/lib/fog/providers/rackspace.rb +4 -3
- data/lib/fog/providers/vcloud.rb +11 -0
- data/lib/fog/storage.rb +9 -6
- data/lib/fog/storage/aws.rb +18 -1
- data/lib/fog/storage/google.rb +19 -1
- data/lib/fog/storage/models/aws/file.rb +3 -3
- data/lib/fog/storage/models/aws/files.rb +9 -2
- data/lib/fog/storage/models/google/files.rb +9 -2
- data/lib/fog/storage/models/ninefold/directories.rb +48 -0
- data/lib/fog/storage/models/ninefold/directory.rb +53 -0
- data/lib/fog/storage/models/ninefold/file.rb +99 -0
- data/lib/fog/storage/models/ninefold/files.rb +72 -0
- data/lib/fog/storage/models/rackspace/directory.rb +7 -2
- data/lib/fog/storage/ninefold.rb +149 -0
- data/lib/fog/storage/rackspace.rb +8 -2
- data/lib/fog/storage/requests/aws/get_bucket_policy.rb +1 -1
- data/lib/fog/storage/requests/aws/get_object.rb +6 -2
- data/lib/fog/storage/requests/aws/get_object_http_url.rb +51 -0
- data/lib/fog/storage/requests/aws/get_object_https_url.rb +51 -0
- data/lib/fog/storage/requests/aws/get_object_url.rb +4 -24
- data/lib/fog/storage/requests/aws/post_object_hidden_fields.rb +1 -1
- data/lib/fog/storage/requests/aws/put_bucket_policy.rb +1 -1
- data/lib/fog/storage/requests/google/get_object_http_url.rb +51 -0
- data/lib/fog/storage/requests/google/get_object_https_url.rb +51 -0
- data/lib/fog/storage/requests/google/get_object_url.rb +8 -25
- data/lib/fog/storage/requests/ninefold/delete_namespace.rb +19 -0
- data/lib/fog/storage/requests/ninefold/get_namespace.rb +20 -0
- data/lib/fog/storage/requests/ninefold/post_namespace.rb +20 -0
- data/lib/fog/storage/requests/ninefold/put_namespace.rb +20 -0
- data/lib/fog/storage/requests/rackspace/put_object.rb +3 -0
- data/lib/fog/storage/requests/rackspace/put_object_manifest.rb +25 -0
- data/tests/aws/models/auto_scaling/activities_tests.rb +6 -0
- data/tests/aws/models/auto_scaling/configuration_test.rb +13 -0
- data/tests/aws/models/auto_scaling/configurations_tests.rb +11 -0
- data/tests/aws/models/auto_scaling/helper.rb +0 -0
- data/tests/aws/models/auto_scaling/instances_tests.rb +6 -0
- data/tests/aws/models/cloud_watch/metric_statistics_tests.rb +51 -0
- data/tests/aws/models/cloud_watch/metrics_tests.rb +17 -0
- data/tests/aws/{requests → models}/elb/model_tests.rb +82 -18
- data/tests/aws/models/rds/security_group_tests.rb +1 -1
- data/tests/aws/requests/auto_scaling/auto_scaling_tests.rb +80 -0
- data/tests/aws/requests/auto_scaling/helper.rb +185 -0
- data/tests/aws/requests/auto_scaling/model_tests.rb +235 -0
- data/tests/aws/requests/cloud_formation/stack_tests.rb +1 -1
- data/tests/aws/requests/cloud_watch/get_metric_statistics_tests.rb +28 -0
- data/tests/aws/requests/cloud_watch/list_metrics_test.rb +64 -0
- data/tests/aws/requests/cloud_watch/put_metric_data_tests.rb +36 -0
- data/tests/aws/requests/elb/listener_tests.rb +50 -0
- data/tests/aws/requests/elb/load_balancer_tests.rb +23 -44
- data/tests/aws/requests/elb/policy_tests.rb +41 -0
- data/tests/aws/requests/iam/helper.rb +29 -0
- data/tests/aws/requests/iam/login_profile_tests.rb +2 -2
- data/tests/aws/requests/iam/server_certificate_tests.rb +39 -6
- data/tests/aws/requests/rds/helper.rb +1 -0
- data/tests/aws/requests/simpledb/attributes_tests.rb +10 -15
- data/tests/aws/requests/sns/helper.rb +9 -0
- data/tests/aws/requests/sns/subscription_tests.rb +86 -0
- data/tests/aws/requests/sns/topic_tests.rb +50 -0
- data/tests/aws/requests/sqs/helper.rb +15 -0
- data/tests/aws/requests/sqs/message_tests.rb +57 -0
- data/tests/aws/requests/sqs/queue_tests.rb +55 -0
- data/tests/aws/signed_params_tests.rb +3 -1
- data/tests/compute/models/aws/volume_tests.rb +13 -0
- data/tests/compute/models/vcloud/helper.rb +25 -0
- data/tests/compute/models/vcloud/servers_tests.rb +95 -0
- data/tests/compute/requests/aws/address_tests.rb +1 -1
- data/tests/compute/requests/aws/instance_tests.rb +65 -4
- data/tests/compute/requests/aws/placement_group_tests.rb +48 -0
- data/tests/compute/requests/aws/spot_datafeed_subscription_tests.rb +47 -0
- data/tests/compute/requests/aws/spot_instance_tests.rb +53 -0
- data/tests/compute/requests/aws/spot_price_history_tests.rb +24 -0
- data/tests/compute/requests/aws/volume_tests.rb +4 -0
- data/tests/compute/requests/brightbox/helper.rb +2 -1
- data/tests/compute/requests/brightbox/interface_tests.rb +4 -4
- data/tests/compute/requests/ninefold/helper.rb +1 -1
- data/tests/compute/requests/vcloud/disk_configure_tests.rb +114 -0
- data/tests/compute/requests/voxel/server_tests.rb +2 -2
- data/tests/core/attribute_tests.rb +10 -1
- data/tests/core/credential_tests.rb +6 -0
- data/tests/core/timeout_tests.rb +10 -0
- data/tests/helpers/collection_helper.rb +4 -1
- data/tests/helpers/formats_helper.rb +1 -1
- data/tests/helpers/mock_helper.rb +5 -0
- data/tests/storage/helper.rb +4 -1
- data/tests/storage/models/ninefold/file_update_tests.rb +19 -0
- data/tests/storage/models/ninefold/nested_directories_tests.rb +23 -0
- data/tests/storage/requests/aws/multipart_upload_tests.rb +2 -5
- data/tests/storage/requests/rackspace/large_object_tests.rb +47 -0
- metadata +366 -105
@@ -92,9 +92,9 @@ module Fog
|
|
92
92
|
requires :directory, :key
|
93
93
|
if connection.get_object_acl(directory.key, key).body['AccessControlList'].detect {|grant| grant['Grantee']['URI'] == 'http://acs.amazonaws.com/groups/global/AllUsers' && grant['Permission'] == 'READ'}
|
94
94
|
if directory.key.to_s =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
|
95
|
-
"https://#{directory.key}.s3.amazonaws.com/#{key}"
|
95
|
+
"https://#{directory.key}.s3.amazonaws.com/#{Fog::AWS.escape(key)}"
|
96
96
|
else
|
97
|
-
"https://s3.amazonaws.com/#{directory.key}/#{key}"
|
97
|
+
"https://s3.amazonaws.com/#{directory.key}/#{Fog::AWS.escape(key)}"
|
98
98
|
end
|
99
99
|
else
|
100
100
|
nil
|
@@ -113,7 +113,7 @@ module Fog
|
|
113
113
|
options['Content-MD5'] = content_md5 if content_md5
|
114
114
|
options['Content-Type'] = content_type if content_type
|
115
115
|
options['Expires'] = expires if expires
|
116
|
-
options.merge(metadata)
|
116
|
+
options.merge!(metadata)
|
117
117
|
options['x-amz-storage-class'] = storage_class if storage_class
|
118
118
|
|
119
119
|
data = connection.put_object(directory.key, key, body, options)
|
@@ -6,6 +6,8 @@ module Fog
|
|
6
6
|
class AWS
|
7
7
|
|
8
8
|
class Files < Fog::Collection
|
9
|
+
extend Fog::Deprecation
|
10
|
+
deprecate :get_url, :get_https_url
|
9
11
|
|
10
12
|
attribute :common_prefixes, :aliases => 'CommonPrefixes'
|
11
13
|
attribute :delimiter, :aliases => 'Delimiter'
|
@@ -76,9 +78,14 @@ module Fog
|
|
76
78
|
end
|
77
79
|
end
|
78
80
|
|
79
|
-
def
|
81
|
+
def get_http_url(key, expires)
|
80
82
|
requires :directory
|
81
|
-
connection.
|
83
|
+
connection.get_object_http_url(directory.key, key, expires)
|
84
|
+
end
|
85
|
+
|
86
|
+
def get_https_url(key, expires)
|
87
|
+
requires :directory
|
88
|
+
connection.get_object_https_url(directory.key, key, expires)
|
82
89
|
end
|
83
90
|
|
84
91
|
def head(key, options = {})
|
@@ -6,6 +6,8 @@ module Fog
|
|
6
6
|
class Google
|
7
7
|
|
8
8
|
class Files < Fog::Collection
|
9
|
+
extend Fog::Deprecation
|
10
|
+
deprecate :get_url, :get_https_url
|
9
11
|
|
10
12
|
attribute :common_prefixes, :aliases => 'CommonPrefixes'
|
11
13
|
attribute :delimiter, :aliases => 'Delimiter'
|
@@ -68,9 +70,14 @@ module Fog
|
|
68
70
|
nil
|
69
71
|
end
|
70
72
|
|
71
|
-
def
|
73
|
+
def get_http_url(key, expires)
|
72
74
|
requires :directory
|
73
|
-
connection.
|
75
|
+
connection.get_object_http_url(directory.key, key, expires)
|
76
|
+
end
|
77
|
+
|
78
|
+
def get_https_url(key, expires)
|
79
|
+
requires :directory
|
80
|
+
connection.get_object_https_url(directory.key, key, expires)
|
74
81
|
end
|
75
82
|
|
76
83
|
def head(key, options = {})
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/storage/models/ninefold/directory'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Storage
|
6
|
+
class Ninefold
|
7
|
+
|
8
|
+
class Directories < Fog::Collection
|
9
|
+
|
10
|
+
attribute :directory
|
11
|
+
|
12
|
+
model Fog::Storage::Ninefold::Directory
|
13
|
+
|
14
|
+
def all
|
15
|
+
directory ? ns = directory.key : ns = ''
|
16
|
+
ns = ns + '/' unless ns =~ /\/$/
|
17
|
+
data = connection.get_namespace(ns).body[:DirectoryList]
|
18
|
+
data = {:DirectoryEntry => []} if data.kind_of? String
|
19
|
+
data[:DirectoryEntry] = [data[:DirectoryEntry]] if data[:DirectoryEntry].kind_of? Hash
|
20
|
+
dirs = data[:DirectoryEntry].select {|de| de[:FileType] == 'directory'}
|
21
|
+
dirs.each do |d|
|
22
|
+
d[:Filename] = ns + d[:Filename] if directory
|
23
|
+
d[:Filename] += '/' unless d[:Filename] =~ /\/$/
|
24
|
+
end
|
25
|
+
load(dirs)
|
26
|
+
end
|
27
|
+
|
28
|
+
def get(key, options = {})
|
29
|
+
return nil if key == '' # Root dir shouldn't be retrieved like this.
|
30
|
+
key =~ /\/$/ ? ns = key : ns = key + '/'
|
31
|
+
res = connection.get_namespace ns
|
32
|
+
emc_meta = res.headers['x-emc-meta']
|
33
|
+
obj_id = emc_meta.scan(/objectid=(\w+),/).flatten[0]
|
34
|
+
new(:objectid => obj_id, :key => ns)
|
35
|
+
rescue Fog::Storage::Ninefold::NotFound
|
36
|
+
nil
|
37
|
+
end
|
38
|
+
|
39
|
+
def new(attributes ={})
|
40
|
+
attributes = {:directory => directory}.merge(attributes) if directory
|
41
|
+
super(attributes)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Storage
|
5
|
+
class Ninefold
|
6
|
+
|
7
|
+
class Directory < Fog::Model
|
8
|
+
|
9
|
+
identity :key, :aliases => :Filename
|
10
|
+
attribute :objectid, :aliases => :ObjectID
|
11
|
+
|
12
|
+
def files
|
13
|
+
@files ||= begin
|
14
|
+
Fog::Storage::Ninefold::Files.new(
|
15
|
+
:directory => self,
|
16
|
+
:connection => connection
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def directories
|
22
|
+
@directories ||= begin
|
23
|
+
Fog::Storage::Ninefold::Directories.new(
|
24
|
+
:directory => self,
|
25
|
+
:connection => connection
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def save
|
31
|
+
self.key = attributes[:directory].key + key if attributes[:directory]
|
32
|
+
self.key = key + '/' unless key =~ /\/$/
|
33
|
+
res = connection.post_namespace key
|
34
|
+
reload
|
35
|
+
end
|
36
|
+
|
37
|
+
def destroy(opts={})
|
38
|
+
if opts[:recursive]
|
39
|
+
files.each {|f| f.destroy }
|
40
|
+
directories.each do |d|
|
41
|
+
d.files.each {|f| f.destroy }
|
42
|
+
d.destroy(opts)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
connection.delete_namespace key
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Storage
|
5
|
+
class Ninefold
|
6
|
+
|
7
|
+
class File < Fog::Model
|
8
|
+
|
9
|
+
identity :key, :aliases => :Filename
|
10
|
+
|
11
|
+
attribute :content_length, :aliases => ['bytes', 'Content-Length'], :type => :integer
|
12
|
+
attribute :content_type, :aliases => ['content_type', 'Content-Type']
|
13
|
+
attribute :objectid, :aliases => :ObjectID
|
14
|
+
|
15
|
+
def body
|
16
|
+
attributes[:body] ||= if last_modified
|
17
|
+
collection.get(identity).body
|
18
|
+
else
|
19
|
+
''
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def body=(new_body)
|
24
|
+
attributes[:body] = new_body
|
25
|
+
end
|
26
|
+
|
27
|
+
def directory
|
28
|
+
@directory
|
29
|
+
end
|
30
|
+
|
31
|
+
def destroy
|
32
|
+
requires :directory, :key
|
33
|
+
connection.delete_namespace([directory.key, key].join('/'))
|
34
|
+
true
|
35
|
+
end
|
36
|
+
|
37
|
+
# def owner=(new_owner)
|
38
|
+
# if new_owner
|
39
|
+
# attributes[:owner] = {
|
40
|
+
# :display_name => new_owner['DisplayName'],
|
41
|
+
# :id => new_owner['ID']
|
42
|
+
# }
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
|
46
|
+
def public=(new_public)
|
47
|
+
# NOOP - we don't need to flag files as public, getting the public URL for a file handles it.
|
48
|
+
end
|
49
|
+
|
50
|
+
# By default, expire in 5 years
|
51
|
+
def public_url(expires = (Time.now + 5 * 365 * 24 * 60 * 60))
|
52
|
+
requires :objectid
|
53
|
+
# TODO - more efficient method to get this?
|
54
|
+
storage = Fog::Storage.new(:provider => 'Ninefold')
|
55
|
+
uri = URI::HTTP.build(:scheme => Fog::Storage::Ninefold::STORAGE_SCHEME, :host => Fog::Storage::Ninefold::STORAGE_HOST, :port => Fog::Storage::Ninefold::STORAGE_PORT.to_i, :path => "/rest/objects/#{objectid}" )
|
56
|
+
Fog::Storage.new(:provider => 'Ninefold').uid
|
57
|
+
|
58
|
+
|
59
|
+
sb = "GET\n"
|
60
|
+
sb += uri.path.downcase + "\n"
|
61
|
+
sb += storage.uid + "\n"
|
62
|
+
sb += String(expires.to_i())
|
63
|
+
|
64
|
+
signature = storage.sign( sb )
|
65
|
+
uri.query = "uid=#{CGI::escape(storage.uid)}&expires=#{expires.to_i()}&signature=#{CGI::escape(signature)}"
|
66
|
+
uri.to_s
|
67
|
+
end
|
68
|
+
|
69
|
+
def save(options = {})
|
70
|
+
requires :body, :directory, :key
|
71
|
+
directory.kind_of?(Directory) ? ns = directory.key : ns = directory
|
72
|
+
ns += key
|
73
|
+
options[:headers] ||= {}
|
74
|
+
options[:headers]['Content-Type'] = content_type if content_type
|
75
|
+
options[:body] = body
|
76
|
+
p options
|
77
|
+
if objectid
|
78
|
+
# pre-existing file, do a PUT
|
79
|
+
data = connection.put_namespace(ns, options)
|
80
|
+
else
|
81
|
+
# new file, POST
|
82
|
+
data = connection.post_namespace(ns, options)
|
83
|
+
self.objectid = data.headers['location'].split('/')[-1]
|
84
|
+
end
|
85
|
+
# merge_attributes(data.headers)
|
86
|
+
true
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def directory=(new_directory)
|
92
|
+
@directory = new_directory
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/storage/models/ninefold/file'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Storage
|
6
|
+
class Ninefold
|
7
|
+
|
8
|
+
class Files < Fog::Collection
|
9
|
+
|
10
|
+
attribute :directory
|
11
|
+
attribute :limit
|
12
|
+
attribute :marker
|
13
|
+
attribute :path
|
14
|
+
attribute :prefix
|
15
|
+
|
16
|
+
model Fog::Storage::Ninefold::File
|
17
|
+
|
18
|
+
def all(options = {})
|
19
|
+
requires :directory
|
20
|
+
directory ? ns = directory.key : ns = ''
|
21
|
+
ns = ns + '/' unless ns =~ /\/$/
|
22
|
+
data = connection.get_namespace(ns).body[:DirectoryList]
|
23
|
+
data = {:DirectoryEntry => []} if data.kind_of? String
|
24
|
+
data[:DirectoryEntry] = [data[:DirectoryEntry]] if data[:DirectoryEntry].kind_of? Hash
|
25
|
+
files = data[:DirectoryEntry].select {|de| de[:FileType] == 'regular'}
|
26
|
+
files.each do |s|
|
27
|
+
s[:directory] = directory
|
28
|
+
end
|
29
|
+
# TODO - Load additional file meta?
|
30
|
+
load(files)
|
31
|
+
end
|
32
|
+
|
33
|
+
def get(key, &block)
|
34
|
+
requires :directory
|
35
|
+
data = connection.get_namespace(directory.key + key, :parse => false)#, &block)
|
36
|
+
file_data = data.headers.merge({
|
37
|
+
:body => data.body,
|
38
|
+
:key => key
|
39
|
+
})
|
40
|
+
new(file_data)
|
41
|
+
rescue Fog::Storage::Ninefold::NotFound
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_url(key)
|
46
|
+
requires :directory
|
47
|
+
if self.directory.public_url
|
48
|
+
"#{self.directory.public_url}/#{key}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def head(key, options = {})
|
53
|
+
requires :directory
|
54
|
+
data = connection.head_object(directory.key, key)
|
55
|
+
file_data = data.headers.merge({
|
56
|
+
:key => key
|
57
|
+
})
|
58
|
+
new(file_data)
|
59
|
+
rescue Fog::Storage::Rackspace::NotFound
|
60
|
+
nil
|
61
|
+
end
|
62
|
+
|
63
|
+
def new(attributes = {})
|
64
|
+
requires :directory
|
65
|
+
super({ :directory => directory }.merge!(attributes))
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -55,11 +55,16 @@ module Fog
|
|
55
55
|
def save
|
56
56
|
requires :key
|
57
57
|
connection.put_container(key)
|
58
|
-
|
58
|
+
|
59
|
+
if @connection.cdn && @public
|
60
|
+
# if public and CDN connection then update cdn to public
|
59
61
|
@public_url = connection.cdn.put_container(key, 'X-CDN-Enabled' => 'True').headers['X-CDN-URI']
|
60
|
-
|
62
|
+
elsif @connection.cdn && !@public
|
61
63
|
connection.cdn.put_container(key, 'X-CDN-Enabled' => 'False')
|
62
64
|
@public_url = nil
|
65
|
+
elsif !@connection.cdn && @public
|
66
|
+
# if public but no CDN connection then error
|
67
|
+
raise(Fog::Storage::Rackspace::Error.new("Directory can not be set as :public without a CDN provided"))
|
63
68
|
end
|
64
69
|
true
|
65
70
|
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'hmac-sha1'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Storage
|
6
|
+
class Ninefold < Fog::Service
|
7
|
+
STORAGE_HOST = "onlinestorage.ninefold.com" #"api.ninefold.com"
|
8
|
+
STORAGE_PATH = "" #"/storage/v1.0"
|
9
|
+
STORAGE_PORT = "80" # "443"
|
10
|
+
STORAGE_SCHEME = "http" # "https"
|
11
|
+
|
12
|
+
requires :ninefold_storage_token, :ninefold_storage_secret
|
13
|
+
|
14
|
+
model_path 'fog/storage/models/ninefold'
|
15
|
+
model :directory
|
16
|
+
collection :directories
|
17
|
+
model :file
|
18
|
+
collection :files
|
19
|
+
|
20
|
+
request_path 'fog/storage/requests/ninefold'
|
21
|
+
# request :delete_container
|
22
|
+
request :get_namespace
|
23
|
+
request :post_namespace
|
24
|
+
request :put_namespace
|
25
|
+
request :delete_namespace
|
26
|
+
|
27
|
+
module Utils
|
28
|
+
end
|
29
|
+
|
30
|
+
class Mock
|
31
|
+
include Utils
|
32
|
+
|
33
|
+
def initialize(options={})
|
34
|
+
require 'mime/types'
|
35
|
+
@ninefold_storage_token = options[:ninefold_storage_token]
|
36
|
+
@ninefold_storage_secret = options[:ninefold_storage_secret]
|
37
|
+
end
|
38
|
+
|
39
|
+
def request(options)
|
40
|
+
raise "Ninefold Storage mocks not implemented"
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
class Real
|
46
|
+
include Utils
|
47
|
+
|
48
|
+
def initialize(options={})
|
49
|
+
require 'mime/types'
|
50
|
+
@ninefold_storage_token = options[:ninefold_storage_token]
|
51
|
+
@ninefold_storage_secret = options[:ninefold_storage_secret]
|
52
|
+
@ninefold_storage_secret_decoded = Base64.decode64( @ninefold_storage_secret )
|
53
|
+
|
54
|
+
Excon.ssl_verify_peer = false if options[:rackspace_servicenet] == true
|
55
|
+
@connection = Fog::Connection.new("#{Fog::Storage::Ninefold::STORAGE_SCHEME}://#{Fog::Storage::Ninefold::STORAGE_HOST}:#{Fog::Storage::Ninefold::STORAGE_PORT}", true) # persistent
|
56
|
+
end
|
57
|
+
|
58
|
+
def uid
|
59
|
+
@ninefold_storage_token#.split('/')[-1]
|
60
|
+
end
|
61
|
+
|
62
|
+
def sign(string)
|
63
|
+
value = ::HMAC::SHA1.digest( @ninefold_storage_secret_decoded, string )
|
64
|
+
Base64.encode64( value ).chomp()
|
65
|
+
end
|
66
|
+
|
67
|
+
def reload
|
68
|
+
@connection.reset
|
69
|
+
end
|
70
|
+
|
71
|
+
def request(params, &block)
|
72
|
+
req_path = params[:path]
|
73
|
+
# Force set host and port
|
74
|
+
params.merge!({
|
75
|
+
:host => Fog::Storage::Ninefold::STORAGE_HOST,
|
76
|
+
:path => "#{Fog::Storage::Ninefold::STORAGE_PATH}/rest/#{params[:path]}",
|
77
|
+
})
|
78
|
+
# Set default method and headers
|
79
|
+
params = {:method => 'GET', :headers => {}}.merge params
|
80
|
+
|
81
|
+
params[:headers]["Content-Type"] ||= "application/octet-stream"
|
82
|
+
|
83
|
+
# Add request date
|
84
|
+
params[:headers]["date"] = Time.now().httpdate()
|
85
|
+
params[:headers]["x-emc-uid"] = @ninefold_storage_token
|
86
|
+
|
87
|
+
# Build signature string
|
88
|
+
signstring = ""
|
89
|
+
signstring += params[:method]
|
90
|
+
signstring += "\n"
|
91
|
+
signstring += params[:headers]["Content-Type"]
|
92
|
+
signstring += "\n"
|
93
|
+
if( params[:headers]["range"] )
|
94
|
+
signstring += params[:headers]["range"]
|
95
|
+
end
|
96
|
+
signstring += "\n"
|
97
|
+
signstring += params[:headers]["date"]
|
98
|
+
signstring += "\n"
|
99
|
+
|
100
|
+
signstring += "/rest/" + URI.unescape( req_path ).downcase
|
101
|
+
query_str = params[:query].map{|k,v| "#{k}=#{v}"}.join('&')
|
102
|
+
signstring += '?' + query_str unless query_str.empty?
|
103
|
+
signstring += "\n"
|
104
|
+
|
105
|
+
customheaders = {}
|
106
|
+
params[:headers].each { |key,value|
|
107
|
+
if key == "x-emc-date"
|
108
|
+
#skip
|
109
|
+
elsif key =~ /^x-emc-/
|
110
|
+
customheaders[ key.downcase ] = value
|
111
|
+
end
|
112
|
+
}
|
113
|
+
header_arr = customheaders.sort()
|
114
|
+
first = true
|
115
|
+
header_arr.each { |key,value|
|
116
|
+
# Values are lowercase and whitespace-normalized
|
117
|
+
signstring += key + ":" + value.strip.chomp.squeeze( " " ) + "\n"
|
118
|
+
}
|
119
|
+
|
120
|
+
digest = ::HMAC::SHA1.digest( @ninefold_storage_secret_decoded, signstring.chomp() )
|
121
|
+
signature = Base64.encode64( digest ).chomp()
|
122
|
+
params[:headers]["x-emc-signature"] = signature
|
123
|
+
|
124
|
+
begin
|
125
|
+
response = @connection.request(params, &block)
|
126
|
+
rescue Excon::Errors::HTTPStatusError => error
|
127
|
+
raise case error
|
128
|
+
when Excon::Errors::NotFound
|
129
|
+
Fog::Storage::Ninefold::NotFound.slurp(error)
|
130
|
+
else
|
131
|
+
error
|
132
|
+
end
|
133
|
+
end
|
134
|
+
unless response.body.empty?
|
135
|
+
if params[:parse]
|
136
|
+
document = Fog::ToHashDocument.new
|
137
|
+
parser = Nokogiri::XML::SAX::PushParser.new(document)
|
138
|
+
parser << response.body
|
139
|
+
parser.finish
|
140
|
+
response.body = document.body
|
141
|
+
end
|
142
|
+
end
|
143
|
+
response
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|