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
@@ -0,0 +1,40 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def validate_clone_vapp_options(options)
|
7
|
+
valid_opts = [:name, :poweron]
|
8
|
+
unless valid_opts.all? { |opt| options.keys.include?(opt) }
|
9
|
+
raise ArgumentError.new("Required data missing: #{(valid_opts - options.keys).map(&:inspect).join(", ")}")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate_clone_vapp_request(uri, options)
|
14
|
+
xml = Builder::XmlMarkup.new
|
15
|
+
xml.CloneVAppParams(xmlns.merge!(:name => options[:name], :deploy => "true", :powerOn => options[:poweron])) {
|
16
|
+
xml.VApp( :href => uri, :type => "application/vnd.vmware.vcloud.vApp+xml",
|
17
|
+
:xmlns => "http://www.vmware.com/vcloud/v0.8")
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def clone_vapp(vdc_uri, vapp_uri, options = {})
|
22
|
+
unless options.has_key?(:poweron)
|
23
|
+
options[:poweron] = "false"
|
24
|
+
end
|
25
|
+
|
26
|
+
validate_clone_vapp_options(options)
|
27
|
+
|
28
|
+
request(
|
29
|
+
:body => generate_clone_vapp_request(vapp_uri, options),
|
30
|
+
:expects => 202,
|
31
|
+
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.cloneVAppParams+xml'},
|
32
|
+
:method => 'POST',
|
33
|
+
:uri => vdc_uri + '/action/clonevapp',
|
34
|
+
:parse => true
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def validate_network_data(network_data, configure=false)
|
7
|
+
valid_opts = [:id, :href, :name, :address, :broadcast, :gateway]
|
8
|
+
unless valid_opts.all? { |opt| network_data.keys.include?(opt) }
|
9
|
+
raise ArgumentError.new("Required data missing: #{(valid_opts - network_data.keys).map(&:inspect).join(", ")}")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def configure_network(network_uri, network_data)
|
14
|
+
validate_network_data(network_data)
|
15
|
+
|
16
|
+
request(
|
17
|
+
:body => generate_configure_network_request(network_data),
|
18
|
+
:expects => 200,
|
19
|
+
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.networkService+xml'},
|
20
|
+
:method => 'PUT',
|
21
|
+
:uri => network_uri,
|
22
|
+
:parse => true
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def generate_configure_network_request(network_data)
|
29
|
+
builder = Builder::XmlMarkup.new
|
30
|
+
builder.Network(xmlns) {
|
31
|
+
builder.Id(network_data[:id])
|
32
|
+
builder.Href(network_data[:href])
|
33
|
+
builder.Name(network_data[:name])
|
34
|
+
builder.Address(network_data[:address])
|
35
|
+
builder.BroadcastAddress(network_data[:broadcast])
|
36
|
+
builder.GatewayAddress(network_data[:gateway])
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
class Compute
|
4
|
+
module Shared
|
5
|
+
private
|
6
|
+
|
7
|
+
def validate_network_ip_data(network_ip_data)
|
8
|
+
valid_opts = [:id, :href, :name, :status, :server]
|
9
|
+
unless valid_opts.all? { |opt| network_ip_data.keys.include?(opt) }
|
10
|
+
raise ArgumentError.new("Required data missing: #{(valid_opts - network_ip_data.keys).map(&:inspect).join(", ")}")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Real
|
16
|
+
include Shared
|
17
|
+
|
18
|
+
def configure_network_ip(network_ip_uri, network_ip_data)
|
19
|
+
validate_network_ip_data(network_ip_data)
|
20
|
+
|
21
|
+
request(
|
22
|
+
:body => generate_configure_network_ip_request(network_ip_data),
|
23
|
+
:expects => 200,
|
24
|
+
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.ip+xml' },
|
25
|
+
:method => 'PUT',
|
26
|
+
:uri => network_ip_uri,
|
27
|
+
:parse => true
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def generate_configure_network_ip_request(network_ip_data)
|
34
|
+
builder = Builder::XmlMarkup.new
|
35
|
+
builder.IpAddress(xmlns) {
|
36
|
+
builder.Id(network_ip_data[:id])
|
37
|
+
builder.Href(network_ip_data[:href])
|
38
|
+
builder.Name(network_ip_data[:name])
|
39
|
+
builder.Status(network_ip_data[:status])
|
40
|
+
builder.Server(network_ip_data[:server])
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
class Compute
|
4
|
+
module Shared
|
5
|
+
private
|
6
|
+
|
7
|
+
def generate_configure_node_request(node_data)
|
8
|
+
builder = Builder::XmlMarkup.new
|
9
|
+
builder.NodeService(:"xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance",
|
10
|
+
:xmlns => "urn:tmrk:eCloudExtensions-2.0") {
|
11
|
+
builder.Name(node_data[:name])
|
12
|
+
builder.Enabled(node_data[:enabled].to_s)
|
13
|
+
builder.Description(node_data[:description])
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
class Real
|
20
|
+
include Shared
|
21
|
+
|
22
|
+
def configure_node(node_uri, node_data)
|
23
|
+
validate_node_data(node_data, true)
|
24
|
+
|
25
|
+
request(
|
26
|
+
:body => generate_configure_node_request(node_data),
|
27
|
+
:expects => 200,
|
28
|
+
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.nodeService+xml'},
|
29
|
+
:method => 'PUT',
|
30
|
+
:uri => node_uri,
|
31
|
+
:parse => true
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
module Fog
|
2
|
+
module Vcloud
|
3
|
+
class Compute
|
4
|
+
module Shared
|
5
|
+
private
|
6
|
+
|
7
|
+
def validate_vapp_data(vapp_data)
|
8
|
+
valid_opts = [:name, :cpus, :memory, :disks]
|
9
|
+
unless valid_opts.all? { |opt| vapp_data.keys.include?(opt) }
|
10
|
+
raise ArgumentError.new("Required Vapp data missing: #{(valid_opts - vapp_data.keys).map(&:inspect).join(", ")}")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Real
|
16
|
+
include Shared
|
17
|
+
|
18
|
+
def generate_configure_vapp_request(vapp_uri, vapp_data)
|
19
|
+
rasd_xmlns = { "xmlns" => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" }
|
20
|
+
|
21
|
+
xml = Nokogiri::XML(request( :uri => vapp_uri).body)
|
22
|
+
xml.root['name'] = vapp_data[:name]
|
23
|
+
|
24
|
+
#cpu
|
25
|
+
xml.at("//xmlns:ResourceType[.='3']/..", rasd_xmlns).at('.//xmlns:VirtualQuantity', rasd_xmlns).content = vapp_data[:cpus]
|
26
|
+
|
27
|
+
#memory
|
28
|
+
xml.at("//xmlns:ResourceType[.='4']/..", rasd_xmlns).at('.//xmlns:VirtualQuantity', rasd_xmlns).content = vapp_data[:memory]
|
29
|
+
|
30
|
+
#disks
|
31
|
+
real_disks = xml.xpath("//xmlns:ResourceType[ .='17']/..", rasd_xmlns)
|
32
|
+
real_disk_numbers = real_disks.map { |disk| disk.at('.//xmlns:AddressOnParent', rasd_xmlns).content }
|
33
|
+
disk_numbers = vapp_data[:disks].map { |vdisk| vdisk[:number].to_s }
|
34
|
+
|
35
|
+
if vapp_data[:disks].length < real_disks.length
|
36
|
+
#Assume we're removing a disk
|
37
|
+
remove_disk_numbers = real_disk_numbers - disk_numbers
|
38
|
+
remove_disk_numbers.each do |number|
|
39
|
+
if result = xml.at("//xmlns:ResourceType[ .='17']/../xmlns:AddressOnParent[.='#{number}']/..", rasd_xmlns)
|
40
|
+
result.remove
|
41
|
+
end
|
42
|
+
end
|
43
|
+
elsif vapp_data[:disks].length > real_disks.length
|
44
|
+
add_disk_numbers = disk_numbers - real_disk_numbers
|
45
|
+
|
46
|
+
add_disk_numbers.each do |number|
|
47
|
+
new_disk = real_disks.first.dup
|
48
|
+
new_disk.at('.//xmlns:AddressOnParent', rasd_xmlns).content = -1
|
49
|
+
new_disk.at('.//xmlns:VirtualQuantity', rasd_xmlns).content = vapp_data[:disks].detect { |disk| disk[:number].to_s == number.to_s }[:size]
|
50
|
+
real_disks.first.parent << new_disk
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
#puts xml.root.to_s
|
55
|
+
xml.root.to_s
|
56
|
+
|
57
|
+
#builder = Builder::XmlMarkup.new
|
58
|
+
#builder.Vapp(:href => vapp_uri.to_s,
|
59
|
+
# :type => 'application/vnd.vmware.vcloud.vApp+xml',
|
60
|
+
# :name => vapp_data[:name],
|
61
|
+
# :status => 2,
|
62
|
+
# :size => 0,
|
63
|
+
# :xmlns => 'http://www.vmware.com/vcloud/v0.8',
|
64
|
+
# :"xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance',
|
65
|
+
# :"xmlns:xsd" => 'http://www.w3.org/2001/XMLSchema') {
|
66
|
+
# #builder.VirtualHardwareSection(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
|
67
|
+
# builder.Section(:"xsi:type" => "q2:VirtualHardwareSection_Type", :xmlns => "http://schemas.dmtf.org/ovf/envelope/1", :"xmlns:q2" => "http://www.vmware.com/vcloud/v0.8") {
|
68
|
+
# builder.Info('Virtual Hardware')
|
69
|
+
# builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
|
70
|
+
# #builder.Item {
|
71
|
+
# builder.InstanceID(1, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
72
|
+
# builder.ResourceType(3, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
73
|
+
# builder.VirtualQuantity(vapp_data[:cpus], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
74
|
+
# }
|
75
|
+
# builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
|
76
|
+
# #builder.Item {
|
77
|
+
# builder.InstanceID(2, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
78
|
+
# builder.ResourceType(4, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
79
|
+
# builder.VirtualQuantity(vapp_data[:memory], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
80
|
+
# }
|
81
|
+
# vapp_data[:disks].each do |disk_data|
|
82
|
+
# #builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
|
83
|
+
# builder.Item {
|
84
|
+
# builder.AddressOnParent(disk_data[:number], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
85
|
+
# builder.HostResource(disk_data[:resource], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
86
|
+
# builder.InstanceID(9, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
87
|
+
# builder.ResourceType(17, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
88
|
+
# builder.VirtualQuantity(disk_data[:size], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
89
|
+
# }
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# }
|
93
|
+
#}
|
94
|
+
end
|
95
|
+
|
96
|
+
def configure_vapp(vapp_uri, vapp_data)
|
97
|
+
validate_vapp_data(vapp_data)
|
98
|
+
|
99
|
+
request(
|
100
|
+
:body => generate_configure_vapp_request(vapp_uri, vapp_data),
|
101
|
+
:expects => 202,
|
102
|
+
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vApp+xml' },
|
103
|
+
:method => 'PUT',
|
104
|
+
:uri => vapp_uri,
|
105
|
+
:parse => true
|
106
|
+
)
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,247 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
hardware_hash = {:xmlns_vcloud=>"http://www.vmware.com/vcloud/v1",
|
3
|
+
:vcloud_href=>
|
4
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/",
|
5
|
+
:vcloud_type=>"application/vnd.vmware.vcloud.virtualHardwareSection+xml",
|
6
|
+
:"ovf:Info"=>"Virtual hardware requirements",
|
7
|
+
:"ovf:System"=>
|
8
|
+
{:"vssd:ElementName"=>"Virtual Hardware Family",
|
9
|
+
:"vssd:InstanceID"=>"0",
|
10
|
+
:"vssd:VirtualSystemIdentifier"=>"centos",
|
11
|
+
:"vssd:VirtualSystemType"=>"vmx-07"},
|
12
|
+
:"ovf:Item"=>
|
13
|
+
[{:"rasd:Address"=>"00:50:56:01:00:db",
|
14
|
+
:"rasd:AddressOnParent"=>"0",
|
15
|
+
:"rasd:AutomaticAllocation"=>"true",
|
16
|
+
:"rasd:Connection"=>"Gandalf_Dev_OrgNW_to_ExtNW_DirectConnect",
|
17
|
+
:"rasd:Description"=>"PCNet32 ethernet adapter",
|
18
|
+
:"rasd:ElementName"=>"Network adapter 0",
|
19
|
+
:"rasd:InstanceID"=>"1",
|
20
|
+
:"rasd:ResourceSubType"=>"PCNet32",
|
21
|
+
:"rasd:ResourceType"=>"10"},
|
22
|
+
{:"rasd:Address"=>"0",
|
23
|
+
:"rasd:Description"=>"SCSI Controller",
|
24
|
+
:"rasd:ElementName"=>"SCSI Controller 0",
|
25
|
+
:"rasd:InstanceID"=>"2",
|
26
|
+
:"rasd:ResourceSubType"=>"lsilogic",
|
27
|
+
:"rasd:ResourceType"=>"6"},
|
28
|
+
{:"rasd:AddressOnParent"=>"0",
|
29
|
+
:"rasd:Description"=>"Hard disk",
|
30
|
+
:"rasd:ElementName"=>"Hard disk 1",
|
31
|
+
:"rasd:HostResource"=>
|
32
|
+
{:vcloud_capacity=>"8192",
|
33
|
+
:vcloud_busType=>"6",
|
34
|
+
:vcloud_busSubType=>"lsilogic"},
|
35
|
+
:"rasd:InstanceID"=>"2000",
|
36
|
+
:"rasd:Parent"=>"2",
|
37
|
+
:"rasd:ResourceType"=>"17"},
|
38
|
+
{:"rasd:Address"=>"0",
|
39
|
+
:"rasd:Description"=>"IDE Controller",
|
40
|
+
:"rasd:ElementName"=>"IDE Controller 0",
|
41
|
+
:"rasd:InstanceID"=>"3",
|
42
|
+
:"rasd:ResourceType"=>"5"},
|
43
|
+
{:"rasd:AddressOnParent"=>"0",
|
44
|
+
:"rasd:AutomaticAllocation"=>"false",
|
45
|
+
:"rasd:Description"=>"CD/DVD Drive",
|
46
|
+
:"rasd:ElementName"=>"CD/DVD Drive 1",
|
47
|
+
:"rasd:HostResource"=>"",
|
48
|
+
:"rasd:InstanceID"=>"3000",
|
49
|
+
:"rasd:Parent"=>"3",
|
50
|
+
:"rasd:ResourceType"=>"15"},
|
51
|
+
{:"rasd:AddressOnParent"=>"0",
|
52
|
+
:"rasd:AutomaticAllocation"=>"false",
|
53
|
+
:"rasd:Description"=>"Floppy Drive",
|
54
|
+
:"rasd:ElementName"=>"Floppy Drive 1",
|
55
|
+
:"rasd:HostResource"=>"",
|
56
|
+
:"rasd:InstanceID"=>"8000",
|
57
|
+
:"rasd:ResourceType"=>"14"},
|
58
|
+
{:vcloud_href=>
|
59
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/cpu",
|
60
|
+
:vcloud_type=>"application/vnd.vmware.vcloud.rasdItem+xml",
|
61
|
+
:"rasd:AllocationUnits"=>"hertz * 10^6",
|
62
|
+
:"rasd:Description"=>"Number of Virtual CPUs",
|
63
|
+
:"rasd:ElementName"=>"1 virtual CPU(s)",
|
64
|
+
:"rasd:InstanceID"=>"4",
|
65
|
+
:"rasd:Reservation"=>"0",
|
66
|
+
:"rasd:ResourceType"=>"3",
|
67
|
+
:"rasd:VirtualQuantity"=>"1",
|
68
|
+
:"rasd:Weight"=>"0",
|
69
|
+
:Link=>
|
70
|
+
{:rel=>"edit",
|
71
|
+
:type=>"application/vnd.vmware.vcloud.rasdItem+xml",
|
72
|
+
:href=>
|
73
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/cpu"}},
|
74
|
+
{:vcloud_href=>
|
75
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/memory",
|
76
|
+
:vcloud_type=>"application/vnd.vmware.vcloud.rasdItem+xml",
|
77
|
+
:"rasd:AllocationUnits"=>"byte * 2^20",
|
78
|
+
:"rasd:Description"=>"Memory Size",
|
79
|
+
:"rasd:ElementName"=>"512 MB of memory",
|
80
|
+
:"rasd:InstanceID"=>"5",
|
81
|
+
:"rasd:Reservation"=>"0",
|
82
|
+
:"rasd:ResourceType"=>"4",
|
83
|
+
:"rasd:VirtualQuantity"=>"768",
|
84
|
+
:"rasd:Weight"=>"0",
|
85
|
+
:Link=>
|
86
|
+
{:rel=>"edit",
|
87
|
+
:type=>"application/vnd.vmware.vcloud.rasdItem+xml",
|
88
|
+
:href=>
|
89
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/memory"}}],
|
90
|
+
:Link=>
|
91
|
+
[{:rel=>"edit",
|
92
|
+
:type=>"application/vnd.vmware.vcloud.virtualHardwareSection+xml",
|
93
|
+
:href=>
|
94
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/"},
|
95
|
+
{:rel=>"down",
|
96
|
+
:type=>"application/vnd.vmware.vcloud.rasdItem+xml",
|
97
|
+
:href=>
|
98
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/cpu"},
|
99
|
+
{:rel=>"edit",
|
100
|
+
:type=>"application/vnd.vmware.vcloud.rasdItem+xml",
|
101
|
+
:href=>
|
102
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/cpu"},
|
103
|
+
{:rel=>"down",
|
104
|
+
:type=>"application/vnd.vmware.vcloud.rasdItem+xml",
|
105
|
+
:href=>
|
106
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/memory"},
|
107
|
+
{:rel=>"edit",
|
108
|
+
:type=>"application/vnd.vmware.vcloud.rasdItem+xml",
|
109
|
+
:href=>
|
110
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/memory"},
|
111
|
+
{:rel=>"down",
|
112
|
+
:type=>"application/vnd.vmware.vcloud.rasdItemsList+xml",
|
113
|
+
:href=>
|
114
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/disks"},
|
115
|
+
{:rel=>"edit",
|
116
|
+
:type=>"application/vnd.vmware.vcloud.rasdItemsList+xml",
|
117
|
+
:href=>
|
118
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/disks"},
|
119
|
+
{:rel=>"down",
|
120
|
+
:type=>"application/vnd.vmware.vcloud.rasdItemsList+xml",
|
121
|
+
:href=>
|
122
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/media"},
|
123
|
+
{:rel=>"down",
|
124
|
+
:type=>"application/vnd.vmware.vcloud.rasdItemsList+xml",
|
125
|
+
:href=>
|
126
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/networkCards"},
|
127
|
+
{:rel=>"edit",
|
128
|
+
:type=>"application/vnd.vmware.vcloud.rasdItemsList+xml",
|
129
|
+
:href=>
|
130
|
+
"https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-624535987/virtualHardwareSection/networkCards"}]}
|
131
|
+
|
132
|
+
|
133
|
+
module Fog
|
134
|
+
module Vcloud
|
135
|
+
class Compute
|
136
|
+
module Shared
|
137
|
+
private
|
138
|
+
|
139
|
+
def validate_vm_data(vm_data)
|
140
|
+
valid_opts = [:name, :cpus, :memory, :disks]
|
141
|
+
unless valid_opts.all? { |opt| vm_data.keys.include?(opt) }
|
142
|
+
raise ArgumentError.new("Required vm data missing: #{(valid_opts - vm_data.keys).map(&:inspect).join(", ")}")
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
class Real
|
148
|
+
include Shared
|
149
|
+
|
150
|
+
def generate_configure_vm_request(vm_data)
|
151
|
+
xmlns = 'http://schemas.dmtf.org/ovf/envelope/1'
|
152
|
+
xmlns_vcloud = 'http://www.vmware.com/vcloud/v1'
|
153
|
+
xmlns_rasd = 'http://schemas.dmtf.org/wbem/wscim/1/cim‐schema/2/CIM_ResourceAllocationSettingData'
|
154
|
+
xmlns_vssd = 'http://schemas.dmtf.org/wbem/wscim/1/cim‐schema/2/CIM_VirtualSystemSettingData'
|
155
|
+
|
156
|
+
builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2) # TODO - remove params
|
157
|
+
builder.VirtualHardwareSection(
|
158
|
+
:"vcloud:href" => vm_data[:"vcloud_href"],
|
159
|
+
:"vcloud:type" => vm_data[:"vcloud_type"],
|
160
|
+
:name => vm_data[:name],
|
161
|
+
:status => 2,
|
162
|
+
:size => 0,
|
163
|
+
:xmlns => xmlns,
|
164
|
+
:"xmlns:vcloud" => xmlns_vcloud,
|
165
|
+
:"xmlns:rasd" => xmlns_rasd,
|
166
|
+
:"xmlns:vssd" => xmlns_vssd) {
|
167
|
+
#builder.VirtualHardwareSection(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
|
168
|
+
|
169
|
+
builder.Info(vm_data[:"ovf:Info"])
|
170
|
+
if system = vm_data[:"ovf:System"]
|
171
|
+
builder.System {
|
172
|
+
builder.ElementName(system[:"vssd:ElementName"], :xmlns => xmlns_vssd) if system[:"vssd:ElementName"]
|
173
|
+
builder.InstanceID(system[:"vssd:InstanceID"], :xmlns => xmlns_vssd) if system[:"vssd:InstanceID"]
|
174
|
+
builder.VirtualSystemIdentifier(system[:"vssd:VirtualSystemIdentifier"], :xmlns => xmlns_vssd) if system[:"vssd:VirtualSystemIdentifier"]
|
175
|
+
builder.VirtualSystemType(system[:"vssd:VirtualSystemType"], :xmlns => xmlns_vssd) if system[:"vssd:VirtualSystemType"]
|
176
|
+
}
|
177
|
+
end
|
178
|
+
|
179
|
+
vm_data[:'ovf:Item'].each do |oi|
|
180
|
+
builder.Item {
|
181
|
+
builder.Address(oi[:'rasd:Address'], :xmlns => xmlns_rasd) if oi[:'rasd:Address']
|
182
|
+
builder.AddressOnParent(oi[:'rasd:AddressOnParent'], :xmlns => xmlns_rasd) if oi[:'rasd:AddressOnParent']
|
183
|
+
builder.AutomaticAllocation(oi[:'rasd:AutomaticAllocation'], :xmlns => xmlns_rasd) if oi[:'rasd:AutomaticAllocation']
|
184
|
+
builder.Connection(oi[:'rasd:Connection'], :xmlns => xmlns_rasd) if oi[:'rasd:Connection']
|
185
|
+
builder.Description(oi[:'rasd:Description'], :xmlns => xmlns_rasd) if oi[:'rasd:Description']
|
186
|
+
builder.ElementName(oi[:'rasd:ElementName'], :xmlns => xmlns_rasd) if oi[:'rasd:ElementName']
|
187
|
+
builder.InstanceID(oi[:'rasd:InstanceID'], :xmlns => xmlns_rasd) if oi[:'rasd:InstanceID']
|
188
|
+
builder.ResourceSubType(oi[:'rasd:ResourceSubType'], :xmlns => xmlns_rasd) if oi[:'rasd:ResourceSubType']
|
189
|
+
builder.ResourceType(oi[:'rasd:ResourceType'], :xmlns => xmlns_rasd) if oi[:'rasd:ResourceType']
|
190
|
+
if hr = oi[:'rasd:HostResource']
|
191
|
+
attrs = {}
|
192
|
+
attrs[]
|
193
|
+
end
|
194
|
+
}
|
195
|
+
end
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
# builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
|
200
|
+
# #builder.Item {
|
201
|
+
# builder.InstanceID(1, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
202
|
+
# builder.ResourceType(3, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
203
|
+
# builder.VirtualQuantity(vm_data[:cpus], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
204
|
+
# }
|
205
|
+
# builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
|
206
|
+
# #builder.Item {
|
207
|
+
# builder.InstanceID(2, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
208
|
+
# builder.ResourceType(4, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
209
|
+
# builder.VirtualQuantity(vm_data[:memory], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
210
|
+
# }
|
211
|
+
# vm_data[:disks].each do |disk_data|
|
212
|
+
# #builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
|
213
|
+
# builder.Item {
|
214
|
+
# builder.AddressOnParent(disk_data[:number], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
215
|
+
# builder.HostResource(disk_data[:resource], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
216
|
+
# builder.InstanceID(9, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
217
|
+
# builder.ResourceType(17, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
218
|
+
# builder.VirtualQuantity(disk_data[:size], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
|
219
|
+
# }
|
220
|
+
# end
|
221
|
+
|
222
|
+
}
|
223
|
+
end
|
224
|
+
|
225
|
+
def configure_vm(vm_uri, vm_data)
|
226
|
+
validate_vm_data(vm_data)
|
227
|
+
|
228
|
+
request(
|
229
|
+
:body => generate_configure_vm_request(vm_uri, vm_data),
|
230
|
+
:expects => 202,
|
231
|
+
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vm+xml' },
|
232
|
+
:method => 'PUT',
|
233
|
+
:uri => vm_uri,
|
234
|
+
:parse => true
|
235
|
+
)
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
if $0 == __FILE__
|
244
|
+
require 'builder'
|
245
|
+
i = Fog::Vcloud::Compute::Real.new
|
246
|
+
puts i.generate_configure_vm_request(hardware_hash)
|
247
|
+
end
|