fog 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +21 -0
- data/README.md +3 -1
- data/Rakefile +4 -1
- data/changelog.txt +462 -0
- data/docs/storage/index.markdown +4 -4
- data/fog.gemspec +2 -2
- data/lib/fog.rb +1 -1
- data/lib/fog/atmos.rb +11 -0
- data/lib/fog/atmos/models/storage/directories.rb +48 -0
- data/lib/fog/atmos/models/storage/directory.rb +53 -0
- data/lib/fog/atmos/models/storage/file.rb +107 -0
- data/lib/fog/atmos/models/storage/files.rb +73 -0
- data/lib/fog/atmos/requests/storage/delete_namespace.rb +19 -0
- data/lib/fog/atmos/requests/storage/get_namespace.rb +20 -0
- data/lib/fog/atmos/requests/storage/head_namespace.rb +20 -0
- data/lib/fog/atmos/requests/storage/post_namespace.rb +20 -0
- data/lib/fog/atmos/requests/storage/put_namespace.rb +20 -0
- data/lib/fog/atmos/storage.rb +186 -0
- data/lib/fog/aws.rb +2 -0
- data/lib/fog/aws/auto_scaling.rb +15 -1
- data/lib/fog/aws/compute.rb +26 -17
- data/lib/fog/aws/elb.rb +14 -2
- data/lib/fog/aws/glacier.rb +172 -0
- data/lib/fog/aws/iam.rb +35 -29
- data/lib/fog/aws/models/auto_scaling/group.rb +1 -1
- data/lib/fog/aws/models/compute/flavors.rb +11 -0
- data/lib/fog/aws/models/compute/security_group.rb +22 -6
- data/lib/fog/aws/models/compute/server.rb +5 -1
- data/lib/fog/aws/models/compute/spot_request.rb +12 -0
- data/lib/fog/aws/models/compute/spot_requests.rb +1 -2
- data/lib/fog/aws/models/compute/volume.rb +7 -1
- data/lib/fog/aws/models/glacier/archive.rb +70 -0
- data/lib/fog/aws/models/glacier/archives.rb +30 -0
- data/lib/fog/aws/models/glacier/job.rb +65 -0
- data/lib/fog/aws/models/glacier/jobs.rb +45 -0
- data/lib/fog/aws/models/glacier/vault.rb +53 -0
- data/lib/fog/aws/models/glacier/vaults.rb +28 -0
- data/lib/fog/aws/models/rds/server.rb +3 -1
- data/lib/fog/aws/models/rds/snapshot.rb +1 -0
- data/lib/fog/aws/models/rds/snapshots.rb +3 -0
- data/lib/fog/aws/models/storage/file.rb +4 -3
- data/lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb +8 -1
- data/lib/fog/aws/parsers/compute/create_volume.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_instance_status.rb +8 -1
- data/lib/fog/aws/parsers/compute/describe_instances.rb +2 -0
- data/lib/fog/aws/parsers/compute/describe_reserved_instances_offerings.rb +1 -1
- data/lib/fog/aws/parsers/compute/describe_volumes.rb +2 -2
- data/lib/fog/aws/parsers/compute/run_instances.rb +2 -0
- data/lib/fog/aws/parsers/compute/spot_instance_requests.rb +1 -1
- data/lib/fog/aws/parsers/dns/list_resource_record_sets.rb +3 -1
- data/lib/fog/aws/parsers/rds/db_parser.rb +3 -1
- data/lib/fog/aws/parsers/rds/snapshot_parser.rb +1 -0
- data/lib/fog/aws/rds.rb +9 -9
- data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +1 -0
- data/lib/fog/aws/requests/auto_scaling/delete_auto_scaling_group.rb +1 -1
- data/lib/fog/aws/requests/compute/create_volume.rb +53 -14
- data/lib/fog/aws/requests/compute/describe_instance_status.rb +2 -0
- data/lib/fog/aws/requests/compute/describe_instances.rb +3 -1
- data/lib/fog/aws/requests/compute/describe_internet_gateways.rb +13 -7
- data/lib/fog/aws/requests/compute/describe_spot_instance_requests.rb +1 -0
- data/lib/fog/aws/requests/compute/describe_subnets.rb +13 -7
- data/lib/fog/aws/requests/compute/describe_volumes.rb +2 -0
- data/lib/fog/aws/requests/compute/describe_vpcs.rb +12 -6
- data/lib/fog/aws/requests/compute/request_spot_instances.rb +2 -0
- data/lib/fog/aws/requests/compute/run_instances.rb +8 -2
- data/lib/fog/aws/requests/dns/change_resource_record_sets.rb +20 -1
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +2 -2
- data/lib/fog/aws/requests/elb/describe_load_balancers.rb +1 -1
- data/lib/fog/aws/requests/glacier/abort_multipart_upload.rb +35 -0
- data/lib/fog/aws/requests/glacier/complete_multipart_upload.rb +42 -0
- data/lib/fog/aws/requests/glacier/create_archive.rb +43 -0
- data/lib/fog/aws/requests/glacier/create_vault.rb +34 -0
- data/lib/fog/aws/requests/glacier/delete_archive.rb +35 -0
- data/lib/fog/aws/requests/glacier/delete_vault.rb +34 -0
- data/lib/fog/aws/requests/glacier/delete_vault_notification_configuration.rb +33 -0
- data/lib/fog/aws/requests/glacier/describe_job.rb +35 -0
- data/lib/fog/aws/requests/glacier/describe_vault.rb +34 -0
- data/lib/fog/aws/requests/glacier/get_job_output.rb +41 -0
- data/lib/fog/aws/requests/glacier/get_vault_notification_configuration.rb +34 -0
- data/lib/fog/aws/requests/glacier/initiate_job.rb +41 -0
- data/lib/fog/aws/requests/glacier/initiate_multipart_upload.rb +38 -0
- data/lib/fog/aws/requests/glacier/list_jobs.rb +39 -0
- data/lib/fog/aws/requests/glacier/list_multipart_uploads.rb +37 -0
- data/lib/fog/aws/requests/glacier/list_parts.rb +37 -0
- data/lib/fog/aws/requests/glacier/list_vaults.rb +36 -0
- data/lib/fog/aws/requests/glacier/set_vault_notification_configuration.rb +37 -0
- data/lib/fog/aws/requests/glacier/upload_part.rb +46 -0
- data/lib/fog/aws/requests/rds/create_db_instance.rb +7 -5
- data/lib/fog/aws/requests/rds/create_db_instance_read_replica.rb +41 -1
- data/lib/fog/aws/requests/rds/create_db_snapshot.rb +1 -1
- data/lib/fog/aws/requests/rds/describe_db_instances.rb +8 -10
- data/lib/fog/aws/requests/rds/describe_db_security_groups.rb +1 -1
- data/lib/fog/aws/requests/rds/describe_db_snapshots.rb +2 -0
- data/lib/fog/aws/requests/rds/modify_db_instance.rb +7 -6
- data/lib/fog/aws/requests/rds/reboot_db_instance.rb +6 -5
- data/lib/fog/aws/requests/storage/get_object.rb +45 -2
- data/lib/fog/aws/requests/storage/upload_part.rb +1 -0
- data/lib/fog/aws/signaturev4.rb +73 -0
- data/lib/fog/aws/sqs.rb +2 -6
- data/lib/fog/bare_metal_cloud/compute.rb +3 -1
- data/lib/fog/bare_metal_cloud/requests/compute/add_server_by_configuration.rb +33 -0
- data/lib/fog/bare_metal_cloud/requests/compute/get_server.rb +17 -12
- data/lib/fog/bare_metal_cloud/requests/compute/list_configurations.rb +27 -0
- data/lib/fog/bare_metal_cloud/requests/compute/list_images.rb +4 -4
- data/lib/fog/bare_metal_cloud/requests/compute/list_plans.rb +7 -7
- data/lib/fog/bare_metal_cloud/requests/compute/list_servers.rb +2 -2
- data/lib/fog/bin.rb +7 -0
- data/lib/fog/bin/atmos.rb +31 -0
- data/lib/fog/bin/aws.rb +4 -0
- data/lib/fog/bin/ecloud.rb +4 -0
- data/lib/fog/bin/rackspace.rb +7 -0
- data/lib/fog/bin/serverlove.rb +31 -0
- data/lib/fog/bluebox/requests/compute/create_block.rb +18 -4
- data/lib/fog/brightbox/compute.rb +52 -0
- data/lib/fog/brightbox/models/compute/cloud_ip.rb +2 -0
- data/lib/fog/brightbox/models/compute/image.rb +1 -0
- data/lib/fog/brightbox/models/compute/server.rb +46 -3
- data/lib/fog/brightbox/requests/compute/create_cloud_ip.rb +3 -3
- data/lib/fog/cloudstack/compute.rb +4 -1
- data/lib/fog/cloudstack/models/compute/images.rb +15 -6
- data/lib/fog/cloudstack/models/compute/job.rb +1 -1
- data/lib/fog/cloudstack/requests/compute/attach_volume.rb +1 -1
- data/lib/fog/cloudstack/requests/compute/register_template.rb +35 -0
- data/lib/fog/compute.rb +15 -3
- data/lib/fog/core/errors.rb +1 -0
- data/lib/fog/core/time.rb +4 -0
- data/lib/fog/dynect/dns.rb +5 -5
- data/lib/fog/ecloud.rb +6 -0
- data/lib/fog/ecloud/compute.rb +3 -1
- data/lib/fog/ecloud/models/compute/ip_addresses.rb +1 -0
- data/lib/fog/ecloud/models/compute/networks.rb +1 -0
- data/lib/fog/ecloud/models/compute/server.rb +31 -1
- data/lib/fog/ecloud/requests/compute/virtual_machine_add_ip.rb +40 -0
- data/lib/fog/ecloud/requests/compute/virtual_machine_upload_file.rb +31 -0
- data/lib/fog/google/models/storage/directory.rb +2 -2
- data/lib/fog/google/models/storage/file.rb +2 -2
- data/lib/fog/google/requests/storage/get_bucket.rb +1 -2
- data/lib/fog/google/requests/storage/put_object.rb +1 -2
- data/lib/fog/google/storage.rb +1 -1
- data/lib/fog/hp/models/compute/image.rb +1 -1
- data/lib/fog/hp/models/compute/server.rb +4 -0
- data/lib/fog/hp/requests/compute/delete_security_group_rule.rb +4 -4
- data/lib/fog/hp/requests/storage/get_object.rb +8 -2
- data/lib/fog/hp/storage.rb +1 -0
- data/lib/fog/libvirt/models/compute/server.rb +1 -1
- data/lib/fog/libvirt/models/compute/templates/server.xml.erb +1 -1
- data/lib/fog/openstack.rb +7 -0
- data/lib/fog/openstack/compute.rb +4 -1
- data/lib/fog/openstack/models/compute/server.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +8 -2
- data/lib/fog/openstack/requests/identity/list_roles_for_user_on_tenant.rb +1 -1
- data/lib/fog/openstack/requests/identity/list_tenants.rb +1 -0
- data/lib/fog/providers.rb +2 -0
- data/lib/fog/rackspace.rb +9 -7
- data/lib/fog/rackspace/block_storage.rb +114 -0
- data/lib/fog/rackspace/compute_v2.rb +123 -0
- data/lib/fog/rackspace/models/block_storage/snapshot.rb +46 -0
- data/lib/fog/rackspace/models/block_storage/snapshots.rb +25 -0
- data/lib/fog/rackspace/models/block_storage/volume.rb +58 -0
- data/lib/fog/rackspace/models/block_storage/volume_type.rb +14 -0
- data/lib/fog/rackspace/models/block_storage/volume_types.rb +25 -0
- data/lib/fog/rackspace/models/block_storage/volumes.rb +25 -0
- data/lib/fog/rackspace/models/compute_v2/attachment.rb +34 -0
- data/lib/fog/rackspace/models/compute_v2/attachments.rb +25 -0
- data/lib/fog/rackspace/models/compute_v2/flavor.rb +17 -0
- data/lib/fog/rackspace/models/compute_v2/flavors.rb +25 -0
- data/lib/fog/rackspace/models/compute_v2/image.rb +30 -0
- data/lib/fog/rackspace/models/compute_v2/images.rb +25 -0
- data/lib/fog/rackspace/models/compute_v2/server.rb +147 -0
- data/lib/fog/rackspace/models/compute_v2/servers.rb +25 -0
- data/lib/fog/rackspace/models/storage/directory.rb +3 -3
- data/lib/fog/rackspace/requests/block_storage/create_snapshot.rb +26 -0
- data/lib/fog/rackspace/requests/block_storage/create_volume.rb +27 -0
- data/lib/fog/rackspace/requests/block_storage/delete_snapshot.rb +15 -0
- data/lib/fog/rackspace/requests/block_storage/delete_volume.rb +15 -0
- data/lib/fog/rackspace/requests/block_storage/get_snapshot.rb +15 -0
- data/lib/fog/rackspace/requests/block_storage/get_volume.rb +15 -0
- data/lib/fog/rackspace/requests/block_storage/get_volume_type.rb +15 -0
- data/lib/fog/rackspace/requests/block_storage/list_snapshots.rb +15 -0
- data/lib/fog/rackspace/requests/block_storage/list_volume_types.rb +15 -0
- data/lib/fog/rackspace/requests/block_storage/list_volumes.rb +15 -0
- data/lib/fog/rackspace/requests/compute_v2/attach_volume.rb +23 -0
- data/lib/fog/rackspace/requests/compute_v2/change_server_password.rb +22 -0
- data/lib/fog/rackspace/requests/compute_v2/confirm_resize_server.rb +20 -0
- data/lib/fog/rackspace/requests/compute_v2/create_server.rb +28 -0
- data/lib/fog/rackspace/requests/compute_v2/delete_attachment.rb +15 -0
- data/lib/fog/rackspace/requests/compute_v2/delete_server.rb +15 -0
- data/lib/fog/rackspace/requests/compute_v2/get_attachment.rb +15 -0
- data/lib/fog/rackspace/requests/compute_v2/get_flavor.rb +15 -0
- data/lib/fog/rackspace/requests/compute_v2/get_image.rb +15 -0
- data/lib/fog/rackspace/requests/compute_v2/get_server.rb +15 -0
- data/lib/fog/rackspace/requests/compute_v2/list_attachments.rb +15 -0
- data/lib/fog/rackspace/requests/compute_v2/list_flavors.rb +15 -0
- data/lib/fog/rackspace/requests/compute_v2/list_images.rb +15 -0
- data/lib/fog/rackspace/requests/compute_v2/list_servers.rb +15 -0
- data/lib/fog/rackspace/requests/compute_v2/reboot_server.rb +22 -0
- data/lib/fog/rackspace/requests/compute_v2/rebuild_server.rb +22 -0
- data/lib/fog/rackspace/requests/compute_v2/resize_server.rb +22 -0
- data/lib/fog/rackspace/requests/compute_v2/revert_resize_server.rb +20 -0
- data/lib/fog/rackspace/requests/compute_v2/update_server.rb +22 -0
- data/lib/fog/rackspace/requests/storage/delete_object.rb +1 -1
- data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +51 -0
- data/lib/fog/rackspace/requests/storage/post_set_meta_temp_url_key.rb +37 -0
- data/lib/fog/rackspace/storage.rb +4 -0
- data/lib/fog/serverlove.rb +10 -0
- data/lib/fog/serverlove/compute.rb +97 -0
- data/lib/fog/serverlove/models/compute/image.rb +57 -0
- data/lib/fog/serverlove/models/compute/images.rb +26 -0
- data/lib/fog/serverlove/models/compute/server.rb +72 -0
- data/lib/fog/serverlove/models/compute/servers.rb +26 -0
- data/lib/fog/serverlove/requests/compute/create_image.rb +32 -0
- data/lib/fog/serverlove/requests/compute/create_server.rb +34 -0
- data/lib/fog/serverlove/requests/compute/destroy_image.rb +13 -0
- data/lib/fog/serverlove/requests/compute/destroy_server.rb +13 -0
- data/lib/fog/serverlove/requests/compute/get_image.rb +13 -0
- data/lib/fog/serverlove/requests/compute/get_images.rb +13 -0
- data/lib/fog/serverlove/requests/compute/get_server.rb +13 -0
- data/lib/fog/serverlove/requests/compute/get_servers.rb +13 -0
- data/lib/fog/serverlove/requests/compute/load_standard_image.rb +13 -0
- data/lib/fog/serverlove/requests/compute/reset_server.rb +13 -0
- data/lib/fog/serverlove/requests/compute/shutdown_server.rb +13 -0
- data/lib/fog/serverlove/requests/compute/start_server.rb +13 -0
- data/lib/fog/serverlove/requests/compute/stop_server.rb +13 -0
- data/lib/fog/serverlove/requests/compute/update_image.rb +15 -0
- data/lib/fog/serverlove/requests/compute/update_server.rb +15 -0
- data/lib/fog/serverlove/util/compute/password_generator.rb +11 -0
- data/lib/fog/storage.rb +3 -0
- data/lib/fog/terremark/models/shared/image.rb +22 -0
- data/lib/fog/terremark/models/shared/images.rb +48 -0
- data/lib/fog/terremark/models/shared/internetservice.rb +67 -0
- data/lib/fog/terremark/models/shared/internetservices.rb +42 -0
- data/lib/fog/terremark/models/shared/nodeservice.rb +52 -0
- data/lib/fog/terremark/models/shared/nodeservices.rb +32 -0
- data/lib/fog/terremark/models/shared/server.rb +114 -15
- data/lib/fog/terremark/models/shared/servers.rb +7 -8
- data/lib/fog/terremark/models/shared/vdc.rb +6 -1
- data/lib/fog/terremark/parsers/shared/get_catalog.rb +7 -2
- data/lib/fog/terremark/parsers/shared/get_keys_list.rb +56 -0
- data/lib/fog/terremark/requests/shared/add_internet_service.rb +10 -9
- data/lib/fog/terremark/requests/shared/add_node_service.rb +10 -12
- data/lib/fog/terremark/requests/shared/configure_vapp.rb +61 -0
- data/lib/fog/terremark/requests/shared/create_internet_service.rb +16 -11
- data/lib/fog/terremark/requests/shared/delete_internet_service.rb +2 -1
- data/lib/fog/terremark/requests/shared/delete_node_service.rb +2 -1
- data/lib/fog/terremark/requests/shared/delete_public_ip.rb +2 -1
- data/lib/fog/terremark/requests/shared/get_internet_services.rb +2 -1
- data/lib/fog/terremark/requests/shared/get_keys_list.rb +36 -0
- data/lib/fog/terremark/requests/shared/get_node_services.rb +2 -1
- data/lib/fog/terremark/requests/shared/instantiate_vapp_template.rb +11 -1
- data/lib/fog/terremark/shared.rb +19 -1
- data/lib/fog/terremark/vcloud.rb +10 -1
- data/lib/fog/vcloud/compute.rb +13 -13
- data/lib/fog/vcloud/models/compute/catalog_items.rb +6 -2
- data/lib/fog/vcloud/models/compute/organizations.rb +1 -2
- data/lib/fog/vcloud/models/compute/server.rb +37 -3
- data/lib/fog/vcloud/models/compute/vapps.rb +1 -1
- data/lib/fog/vcloud/requests/compute/configure_org_network.rb +141 -0
- data/lib/fog/vcloud/requests/compute/configure_vm_cpus.rb +38 -0
- data/lib/fog/vcloud/requests/compute/configure_vm_memory.rb +11 -12
- data/lib/fog/vcloud/requests/compute/configure_vm_password.rb +39 -0
- data/lib/fog/vcloud/requests/compute/undeploy.rb +9 -1
- data/lib/fog/vsphere/requests/compute/vm_reboot.rb +1 -1
- data/tests/atmos/models/storage/file_update_tests.rb +19 -0
- data/tests/atmos/models/storage/nested_directories_tests.rb +23 -0
- data/tests/aws/models/compute/security_group_tests.rb +21 -12
- data/tests/aws/models/dns/records_tests.rb +8 -2
- data/tests/aws/models/glacier/model_tests.rb +47 -0
- data/tests/aws/models/iam/policies_tests.rb +2 -2
- data/tests/aws/models/rds/server_tests.rb +5 -2
- data/tests/aws/models/storage/directory_tests.rb +1 -1
- data/tests/aws/models/storage/file_tests.rb +1 -1
- data/tests/aws/models/storage/files_tests.rb +1 -1
- data/tests/aws/models/storage/url_tests.rb +8 -8
- data/tests/aws/models/storage/version_tests.rb +1 -1
- data/tests/aws/models/storage/versions_tests.rb +1 -1
- data/tests/aws/requests/auto_scaling/auto_scaling_tests.rb +5 -0
- data/tests/aws/requests/auto_scaling/helper.rb +2 -1
- data/tests/aws/requests/compute/instance_tests.rb +17 -23
- data/tests/aws/requests/compute/spot_instance_tests.rb +2 -1
- data/tests/aws/requests/compute/tag_tests.rb +1 -0
- data/tests/aws/requests/compute/volume_tests.rb +45 -4
- data/tests/aws/requests/elb/helper.rb +2 -2
- data/tests/aws/requests/elb/listener_tests.rb +2 -2
- data/tests/aws/requests/elb/load_balancer_tests.rb +1 -1
- data/tests/aws/requests/glacier/archive_tests.rb +13 -0
- data/tests/aws/requests/glacier/multipart_upload_tests.rb +30 -0
- data/tests/aws/requests/glacier/tree_hash_tests.rb +63 -0
- data/tests/aws/requests/glacier/vault_tests.rb +35 -0
- data/tests/aws/requests/rds/helper.rb +11 -5
- data/tests/aws/requests/rds/instance_tests.rb +0 -2
- data/tests/aws/requests/storage/acl_utils_tests.rb +1 -1
- data/tests/aws/requests/storage/bucket_tests.rb +1 -1
- data/tests/aws/requests/storage/multipart_upload_tests.rb +1 -1
- data/tests/aws/requests/storage/object_tests.rb +8 -0
- data/tests/aws/requests/storage/versioning_tests.rb +1 -1
- data/tests/aws/signaturev4_tests.rb +41 -0
- data/tests/brightbox/compute_tests.rb +9 -0
- data/tests/brightbox/requests/compute/helper.rb +21 -6
- data/tests/cloudstack/compute/models/volume_tests.rb +1 -1
- data/tests/cloudstack/requests/volume_tests.rb +1 -1
- data/tests/compute/helper.rb +10 -4
- data/tests/dynect/requests/dns/dns_tests.rb +39 -0
- data/tests/google/requests/storage/bucket_tests.rb +2 -3
- data/tests/google/requests/storage/object_tests.rb +1 -1
- data/tests/helper.rb +10 -3
- data/tests/helpers/formats_helper.rb +4 -2
- data/tests/helpers/formats_helper_tests.rb +9 -0
- data/tests/helpers/mock_helper.rb +6 -1
- data/tests/helpers/model_helper.rb +0 -3
- data/tests/hp/models/compute/address_tests.rb +1 -1
- data/tests/hp/models/compute/addresses_tests.rb +1 -1
- data/tests/hp/models/compute/key_pair_tests.rb +1 -1
- data/tests/hp/models/compute/key_pairs_tests.rb +1 -1
- data/tests/hp/models/compute/security_group_tests.rb +1 -1
- data/tests/hp/models/compute/security_groups_tests.rb +1 -1
- data/tests/hp/requests/cdn/container_tests.rb +1 -1
- data/tests/hp/requests/compute/address_tests.rb +1 -1
- data/tests/hp/requests/compute/flavor_tests.rb +1 -1
- data/tests/hp/requests/compute/image_tests.rb +1 -1
- data/tests/hp/requests/compute/key_pair_tests.rb +1 -1
- data/tests/hp/requests/compute/security_group_rule_tests.rb +1 -1
- data/tests/hp/requests/compute/security_group_tests.rb +1 -1
- data/tests/hp/requests/compute/server_address_tests.rb +1 -1
- data/tests/hp/requests/compute/server_tests.rb +1 -1
- data/tests/hp/requests/storage/container_tests.rb +1 -1
- data/tests/hp/requests/storage/object_tests.rb +1 -1
- data/tests/local/models/file_tests.rb +1 -1
- data/tests/rackspace/models/block_storage/snapshot_tests.rb +20 -0
- data/tests/rackspace/models/block_storage/snapshots_tests.rb +20 -0
- data/tests/rackspace/models/block_storage/volume_tests.rb +27 -0
- data/tests/rackspace/models/block_storage/volume_types_tests.rb +20 -0
- data/tests/rackspace/models/block_storage/volumes_tests.rb +11 -0
- data/tests/rackspace/models/compute_v2/flavors_tests.rb +20 -0
- data/tests/rackspace/models/compute_v2/images_tests.rb +22 -0
- data/tests/rackspace/models/compute_v2/server_tests.rb +62 -0
- data/tests/rackspace/models/compute_v2/servers_tests.rb +14 -0
- data/tests/rackspace/requests/block_storage/snapshot_tests.rb +81 -0
- data/tests/rackspace/requests/block_storage/volume_tests.rb +61 -0
- data/tests/rackspace/requests/block_storage/volume_type_tests.rb +31 -0
- data/tests/rackspace/requests/compute_v2/attachment_tests.rb +68 -0
- data/tests/rackspace/requests/compute_v2/flavor_tests.rb +43 -0
- data/tests/rackspace/requests/compute_v2/image_tests.rb +47 -0
- data/tests/rackspace/requests/compute_v2/server_tests.rb +147 -0
- data/tests/rackspace/requests/storage/account_tests.rb +17 -0
- data/tests/rackspace/requests/storage/container_tests.rb +1 -1
- data/tests/rackspace/requests/storage/large_object_tests.rb +1 -1
- data/tests/rackspace/requests/storage/object_tests.rb +41 -2
- data/tests/serverlove/requests/compute/image_tests.rb +57 -0
- data/tests/serverlove/requests/compute/server_tests.rb +85 -0
- data/tests/serverlove/util/compute/password_generator_tests.rb +19 -0
- data/tests/storage/models/directories_tests.rb +1 -1
- data/tests/storage/models/directory_test.rb +1 -1
- data/tests/storage/models/file_tests.rb +1 -1
- data/tests/storage/models/files_tests.rb +1 -1
- metadata +188 -3
@@ -0,0 +1,31 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ecloud
|
4
|
+
module Shared
|
5
|
+
|
6
|
+
def validate_upload_file_options(options)
|
7
|
+
required_opts = [:file, :path, :credentials]
|
8
|
+
unless required_opts.all? { |opt| options.has_key?(opt) }
|
9
|
+
raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
class Real
|
16
|
+
|
17
|
+
def virtual_machine_upload_file(vm_uri, options)
|
18
|
+
validate_upload_file_options(options)
|
19
|
+
request(
|
20
|
+
:expects => 204,
|
21
|
+
:method => 'POST',
|
22
|
+
:headers => {'Content-Type' => 'application/octet-stream', 'X-Guest-User' => options[:credentials][:user], 'X-Guest-Password' => options[:credentials][:password], 'Content-Range' => "0-#{options[:file].bytesize - 1}/#{options[:file].bytesize}"},
|
23
|
+
:body => options[:file],
|
24
|
+
:uri => vm_uri + "?path=#{options[:path]}",
|
25
|
+
:parse => true
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -49,9 +49,9 @@ module Fog
|
|
49
49
|
requires :key
|
50
50
|
if connection.get_bucket_acl(key).body['AccessControlList'].detect {|entry| entry['Scope']['type'] == 'AllUsers' && entry['Permission'] == 'READ'}
|
51
51
|
if key.to_s =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
|
52
|
-
"https://#{key}.
|
52
|
+
"https://#{key}.storage.googleapis.com"
|
53
53
|
else
|
54
|
-
"https://
|
54
|
+
"https://storage.googleapis.com/#{key}"
|
55
55
|
end
|
56
56
|
else
|
57
57
|
nil
|
@@ -94,9 +94,9 @@ module Fog
|
|
94
94
|
requires :directory, :key
|
95
95
|
if connection.get_object_acl(directory.key, key).body['AccessControlList'].detect {|entry| entry['Scope']['type'] == 'AllUsers' && entry['Permission'] == 'READ'}
|
96
96
|
if directory.key.to_s =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
|
97
|
-
"https://#{directory.key}.
|
97
|
+
"https://#{directory.key}.storage.googleapis.com/#{key}"
|
98
98
|
else
|
99
|
-
"https://
|
99
|
+
"https://storage.googleapis.com/#{directory.key}/#{key}"
|
100
100
|
end
|
101
101
|
else
|
102
102
|
nil
|
@@ -36,7 +36,6 @@ module Fog
|
|
36
36
|
# * 'DisplayName'<~String> - Display name of object owner
|
37
37
|
# * 'ID'<~String> - Id of object owner
|
38
38
|
# * 'Size'<~Integer> - Size of object
|
39
|
-
# * 'StorageClass'<~String> - Storage class of object
|
40
39
|
#
|
41
40
|
def get_bucket(bucket_name, options = {})
|
42
41
|
unless bucket_name
|
@@ -69,7 +68,7 @@ module Fog
|
|
69
68
|
(options['prefix'] && object['Key'][0...options['prefix'].length] != options['prefix']) ||
|
70
69
|
(options['marker'] && object['Key'] <= options['marker'])
|
71
70
|
end.map do |object|
|
72
|
-
data = object.reject {|key, value| !['ETag', 'Key'
|
71
|
+
data = object.reject {|key, value| !['ETag', 'Key'].include?(key)}
|
73
72
|
data.merge!({
|
74
73
|
'LastModified' => Time.parse(object['Last-Modified']),
|
75
74
|
'Owner' => bucket['Owner'],
|
@@ -63,8 +63,7 @@ module Fog
|
|
63
63
|
'ETag' => Fog::Google::Mock.etag,
|
64
64
|
'Key' => object_name,
|
65
65
|
'Last-Modified' => Fog::Time.now.to_date_header,
|
66
|
-
'Content-Length' => options['Content-Length'] || data[:headers]['Content-Length']
|
67
|
-
'StorageClass' => 'STANDARD'
|
66
|
+
'Content-Length' => options['Content-Length'] || data[:headers]['Content-Length']
|
68
67
|
}
|
69
68
|
|
70
69
|
for key, value in options
|
data/lib/fog/google/storage.rb
CHANGED
@@ -191,7 +191,7 @@ module Fog
|
|
191
191
|
@google_storage_secret_access_key = options[:google_storage_secret_access_key]
|
192
192
|
@connection_options = options[:connection_options] || {}
|
193
193
|
@hmac = Fog::HMAC.new('sha1', @google_storage_secret_access_key)
|
194
|
-
@host = options[:host] || '
|
194
|
+
@host = options[:host] || 'storage.googleapis.com'
|
195
195
|
@persistent = options.fetch(:persistent, true)
|
196
196
|
@port = options[:port] || 443
|
197
197
|
@scheme = options[:scheme] || 'https'
|
@@ -16,7 +16,7 @@ module Fog
|
|
16
16
|
attribute :minDisk, :aliases => 'min_disk'
|
17
17
|
attribute :minRam, :aliases => 'min_ram'
|
18
18
|
attribute :server, :aliases => 'server'
|
19
|
-
|
19
|
+
attribute :metadata
|
20
20
|
attribute :links
|
21
21
|
|
22
22
|
def destroy
|
@@ -25,14 +25,14 @@ module Fog
|
|
25
25
|
response = Excon::Response.new
|
26
26
|
|
27
27
|
sg_rule = nil
|
28
|
-
|
29
28
|
self.data[:security_groups].each do |_, sgv|
|
30
29
|
if sgv['rules']
|
31
|
-
|
32
|
-
|
30
|
+
sg_rule_index = sgv['rules'].find_index { |r| !r.nil? && r['id'] == security_group_rule_id }
|
31
|
+
if sg_rule_index
|
32
|
+
sg_rule = sgv['rules'].delete_at sg_rule_index
|
33
|
+
end
|
33
34
|
end
|
34
35
|
end
|
35
|
-
|
36
36
|
if sg_rule && !sg_rule.empty?
|
37
37
|
response.status = 202
|
38
38
|
response.body = "202 Accepted\n\nThe request is accepted for processing.\n\n "
|
@@ -10,12 +10,18 @@ module Fog
|
|
10
10
|
# * object<~String> - Name of object to look for
|
11
11
|
#
|
12
12
|
def get_object(container, object, &block)
|
13
|
-
|
13
|
+
params = {}
|
14
|
+
|
15
|
+
if block_given?
|
16
|
+
params[:response_block] = Proc.new
|
17
|
+
end
|
18
|
+
|
19
|
+
response = request(params.merge!({
|
14
20
|
:block => block,
|
15
21
|
:expects => 200,
|
16
22
|
:method => 'GET',
|
17
23
|
:path => "#{Fog::HP.escape(container)}/#{Fog::HP.escape(object)}"
|
18
|
-
}, false
|
24
|
+
}), false)
|
19
25
|
response
|
20
26
|
end
|
21
27
|
|
data/lib/fog/hp/storage.rb
CHANGED
@@ -240,7 +240,7 @@ module Fog
|
|
240
240
|
# It returns an array of public and private ip addresses
|
241
241
|
# Currently only one ip address is returned, but in the future this could be multiple
|
242
242
|
# if the server has multiple network interface
|
243
|
-
def addresses(connection, options={})
|
243
|
+
def addresses(connection=connection, options={})
|
244
244
|
mac=self.mac
|
245
245
|
|
246
246
|
# Aug 24 17:34:41 juno arpwatch: new station 10.247.4.137 52:54:00:88:5a:0a eth0.4
|
@@ -45,7 +45,7 @@
|
|
45
45
|
<target port='0'/>
|
46
46
|
</console>
|
47
47
|
<input type='mouse' bus='ps2'/>
|
48
|
-
|
48
|
+
<graphics type='<%= display[:type] %>' port='<%= display[:port] %>' autoport='yes' <% if display[:listen] and !(display[:listen].empty?) %> listen='<%= display[:listen] %>'<% end %> <% if display[:password] and !(display[:password].empty?) %>passwd='<%=display[:password] %>'<% end %> />
|
49
49
|
<video>
|
50
50
|
<model type='cirrus' vram='9216' heads='1'/>
|
51
51
|
</video>
|
data/lib/fog/openstack.rb
CHANGED
@@ -80,6 +80,7 @@ module Fog
|
|
80
80
|
@service_name = options[:openstack_service_name]
|
81
81
|
@identity_service_name = options[:openstack_identity_service_name]
|
82
82
|
@endpoint_type = options[:openstack_endpoint_type] || 'publicURL'
|
83
|
+
@openstack_region = options[:openstack_region]
|
83
84
|
|
84
85
|
if @openstack_auth_token
|
85
86
|
req_body = {
|
@@ -133,6 +134,12 @@ module Fog
|
|
133
134
|
detect{|x| @service_name.include?(x['type']) }
|
134
135
|
end
|
135
136
|
|
137
|
+
svc['endpoints'] = svc['endpoints'].select{ |x| x['region'] == @openstack_region } if @openstack_region
|
138
|
+
if svc['endpoints'].count > 1
|
139
|
+
regions = svc["endpoints"].map { |x| x['region'] }.uniq.join(',')
|
140
|
+
raise Errors::NotFound.new("Multiple regions available choose one of these '#{regions}'")
|
141
|
+
end
|
142
|
+
|
136
143
|
identity_svc = body['access']['serviceCatalog'].
|
137
144
|
detect{|x| @identity_service_name.include?(x['type']) } if @identity_service_name
|
138
145
|
tenant = body['access']['token']['tenant']
|
@@ -9,7 +9,7 @@ module Fog
|
|
9
9
|
recognizes :openstack_auth_token, :openstack_management_url,
|
10
10
|
:persistent, :openstack_service_name, :openstack_tenant,
|
11
11
|
:openstack_api_key, :openstack_username, :openstack_identity_endpoint,
|
12
|
-
:current_user, :current_tenant
|
12
|
+
:current_user, :current_tenant, :openstack_region
|
13
13
|
|
14
14
|
## MODELS
|
15
15
|
#
|
@@ -249,6 +249,7 @@ module Fog
|
|
249
249
|
@openstack_must_reauthenticate = false
|
250
250
|
@openstack_service_name = options[:openstack_service_name] || ['nova', 'compute']
|
251
251
|
@openstack_identity_service_name = options[:openstack_identity_service_name] || 'identity'
|
252
|
+
@openstack_region = options[:openstack_region]
|
252
253
|
|
253
254
|
@connection_options = options[:connection_options] || {}
|
254
255
|
|
@@ -267,6 +268,7 @@ module Fog
|
|
267
268
|
:openstack_auth_token => @auth_token,
|
268
269
|
:openstack_management_url => @openstack_management_url,
|
269
270
|
:openstack_identity_endpoint => @openstack_identity_public_endpoint,
|
271
|
+
:openstack_region => @openstack_region,
|
270
272
|
:current_user => @current_user,
|
271
273
|
:current_tenant => @current_tenant }
|
272
274
|
end
|
@@ -319,6 +321,7 @@ module Fog
|
|
319
321
|
:openstack_username => @openstack_username,
|
320
322
|
:openstack_auth_token => @openstack_auth_token,
|
321
323
|
:openstack_auth_uri => @openstack_auth_uri,
|
324
|
+
:openstack_region => @openstack_region,
|
322
325
|
:openstack_tenant => @openstack_tenant,
|
323
326
|
:openstack_service_name => @openstack_service_name,
|
324
327
|
:openstack_identity_service_name => @openstack_identity_service_name
|
@@ -13,12 +13,18 @@ module Fog
|
|
13
13
|
}
|
14
14
|
|
15
15
|
vanilla_options = ['metadata', 'accessIPv4', 'accessIPv6',
|
16
|
-
'availability_zone', 'user_data', 'key_name',
|
17
|
-
'security_groups', 'adminPass']
|
16
|
+
'availability_zone', 'user_data', 'key_name', 'adminPass']
|
18
17
|
vanilla_options.select{|o| options[o]}.each do |key|
|
19
18
|
data['server'][key] = options[key]
|
20
19
|
end
|
21
20
|
|
21
|
+
if options['security_groups']
|
22
|
+
# security names requires a hash with a name prefix
|
23
|
+
data['server']['security_groups'] = [options['security_groups']].flatten.map do |sg|
|
24
|
+
{ :name => sg.is_a?(Fog::Compute::OpenStack::SecurityGroup) ? sg.name : sg }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
22
28
|
if options['personality']
|
23
29
|
data['server']['personality'] = []
|
24
30
|
for file in options['personality']
|
@@ -14,7 +14,7 @@ module Fog
|
|
14
14
|
class Mock
|
15
15
|
def list_roles_for_user_on_tenant(tenant_id, user_id)
|
16
16
|
Excon::Response.new(
|
17
|
-
:body => { 'roles' => self.data[:roles] },
|
17
|
+
:body => { 'roles' => self.data[:roles].values },
|
18
18
|
:status => 200
|
19
19
|
)
|
20
20
|
end # def list_roles_for_user_on_tenant
|
data/lib/fog/providers.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'fog/atmos'
|
1
2
|
require 'fog/aws'
|
2
3
|
require 'fog/bluebox'
|
3
4
|
require 'fog/brightbox'
|
@@ -21,6 +22,7 @@ require 'fog/ninefold'
|
|
21
22
|
require 'fog/rackspace'
|
22
23
|
require 'fog/openstack'
|
23
24
|
require 'fog/ovirt'
|
25
|
+
require 'fog/serverlove'
|
24
26
|
require 'fog/storm_on_demand'
|
25
27
|
require 'fog/vcloud'
|
26
28
|
require 'fog/virtual_box'
|
data/lib/fog/rackspace.rb
CHANGED
@@ -42,13 +42,15 @@ module Fog
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
service(:
|
46
|
-
service(:
|
47
|
-
service(:
|
48
|
-
service(:
|
49
|
-
service(:
|
50
|
-
service(:
|
51
|
-
service(:
|
45
|
+
service(:block_storage, 'rackspace/block_storage', 'BlockStorage')
|
46
|
+
service(:cdn, 'rackspace/cdn', 'CDN')
|
47
|
+
service(:compute, 'rackspace/compute', 'Compute')
|
48
|
+
service(:compute_v2, 'rackspace/compute_v2', 'Compute v2')
|
49
|
+
service(:dns, 'rackspace/dns', 'DNS')
|
50
|
+
service(:storage, 'rackspace/storage', 'Storage')
|
51
|
+
service(:load_balancers, 'rackspace/load_balancers', 'LoadBalancers')
|
52
|
+
service(:identity, 'rackspace/identity', 'Identity')
|
53
|
+
service(:databases, 'rackspace/databases', 'Databases')
|
52
54
|
|
53
55
|
def self.authenticate(options, connection_options = {})
|
54
56
|
rackspace_auth_url = options[:rackspace_auth_url] || "auth.api.rackspacecloud.com"
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rackspace'))
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Rackspace
|
5
|
+
class BlockStorage < Fog::Service
|
6
|
+
|
7
|
+
class ServiceError < Fog::Rackspace::Errors::ServiceError; end
|
8
|
+
class InternalServerError < Fog::Rackspace::Errors::InternalServerError; end
|
9
|
+
class BadRequest < Fog::Rackspace::Errors::BadRequest; end
|
10
|
+
|
11
|
+
DFW_ENDPOINT = 'https://dfw.blockstorage.api.rackspacecloud.com/v1'
|
12
|
+
LON_ENDPOINT = 'https://lon.blockstorage.api.rackspacecloud.com/v1'
|
13
|
+
ORD_ENDPOINT = 'https://ord.blockstorage.api.rackspacecloud.com/v1'
|
14
|
+
|
15
|
+
requires :rackspace_api_key, :rackspace_username
|
16
|
+
recognizes :rackspace_auth_url
|
17
|
+
recognizes :rackspace_endpoint
|
18
|
+
|
19
|
+
model_path 'fog/rackspace/models/block_storage'
|
20
|
+
model :volume
|
21
|
+
collection :volumes
|
22
|
+
|
23
|
+
model :volume_type
|
24
|
+
collection :volume_types
|
25
|
+
model :snapshot
|
26
|
+
collection :snapshots
|
27
|
+
|
28
|
+
model :snapshot
|
29
|
+
collection :snapshots
|
30
|
+
|
31
|
+
request_path 'fog/rackspace/requests/block_storage'
|
32
|
+
request :create_volume
|
33
|
+
request :delete_volume
|
34
|
+
request :get_volume
|
35
|
+
request :list_volumes
|
36
|
+
|
37
|
+
request :get_volume_type
|
38
|
+
request :list_volume_types
|
39
|
+
|
40
|
+
request :create_snapshot
|
41
|
+
request :delete_snapshot
|
42
|
+
request :get_snapshot
|
43
|
+
request :list_snapshots
|
44
|
+
|
45
|
+
class Mock
|
46
|
+
def request(params)
|
47
|
+
Fog::Mock.not_implemented
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class Real
|
52
|
+
def initialize(options = {})
|
53
|
+
@rackspace_api_key = options[:rackspace_api_key]
|
54
|
+
@rackspace_username = options[:rackspace_username]
|
55
|
+
@rackspace_auth_url = options[:rackspace_auth_url]
|
56
|
+
@rackspace_must_reauthenticate = false
|
57
|
+
@connection_options = options[:connection_options] || {}
|
58
|
+
|
59
|
+
endpoint = options[:rackspace_endpoint] || DFW_ENDPOINT
|
60
|
+
uri = URI.parse(endpoint)
|
61
|
+
|
62
|
+
@host = uri.host
|
63
|
+
@persistent = options[:persistent] || false
|
64
|
+
@path = uri.path
|
65
|
+
@port = uri.port
|
66
|
+
@scheme = uri.scheme
|
67
|
+
|
68
|
+
authenticate
|
69
|
+
|
70
|
+
@connection = Fog::Connection.new(uri.to_s, @persistent, @connection_options)
|
71
|
+
end
|
72
|
+
|
73
|
+
def request(params)
|
74
|
+
begin
|
75
|
+
response = @connection.request(params.merge!({
|
76
|
+
:headers => {
|
77
|
+
'Content-Type' => 'application/json',
|
78
|
+
'X-Auth-Token' => @auth_token
|
79
|
+
}.merge!(params[:headers] || {}),
|
80
|
+
:host => @host,
|
81
|
+
:path => "#{@path}/#{params[:path]}"
|
82
|
+
}))
|
83
|
+
rescue Excon::Errors::NotFound => error
|
84
|
+
raise NotFound.slurp error
|
85
|
+
rescue Excon::Errors::BadRequest => error
|
86
|
+
raise BadRequest.slurp error
|
87
|
+
rescue Excon::Errors::InternalServerError => error
|
88
|
+
raise InternalServerError.slurp error
|
89
|
+
rescue Excon::Errors::HTTPStatusError => error
|
90
|
+
raise ServiceError.slurp error
|
91
|
+
end
|
92
|
+
unless response.body.empty?
|
93
|
+
response.body = Fog::JSON.decode(response.body)
|
94
|
+
end
|
95
|
+
response
|
96
|
+
end
|
97
|
+
|
98
|
+
private
|
99
|
+
|
100
|
+
def authenticate
|
101
|
+
options = {
|
102
|
+
:rackspace_api_key => @rackspace_api_key,
|
103
|
+
:rackspace_username => @rackspace_username,
|
104
|
+
:rackspace_auth_url => @rackspace_auth_url
|
105
|
+
}
|
106
|
+
credentials = Fog::Rackspace.authenticate(options, @connection_options)
|
107
|
+
@auth_token = credentials['X-Auth-Token']
|
108
|
+
account_id = credentials['X-Server-Management-Url'].match(/.*\/([\d]+)$/)[1]
|
109
|
+
@path = "#{@path}/#{account_id}"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'fog/compute'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class RackspaceV2 < Fog::Service
|
6
|
+
|
7
|
+
class ServiceError < Fog::Rackspace::Errors::ServiceError; end
|
8
|
+
class InternalServerError < Fog::Rackspace::Errors::InternalServerError; end
|
9
|
+
class BadRequest < Fog::Rackspace::Errors::BadRequest; end
|
10
|
+
|
11
|
+
DFW_ENDPOINT = 'https://dfw.servers.api.rackspacecloud.com/v2'
|
12
|
+
ORD_ENDPOINT = 'https://ord.servers.api.rackspacecloud.com/v2'
|
13
|
+
LON_ENDPOINT = 'https://lon.servers.api.rackspacecloud.com/v2'
|
14
|
+
|
15
|
+
requires :rackspace_username, :rackspace_api_key
|
16
|
+
recognizes :rackspace_endpoint
|
17
|
+
recognizes :rackspace_auth_url
|
18
|
+
recognizes :rackspace_auth_token
|
19
|
+
|
20
|
+
model_path 'fog/rackspace/models/compute_v2'
|
21
|
+
model :server
|
22
|
+
collection :servers
|
23
|
+
model :flavor
|
24
|
+
collection :flavors
|
25
|
+
model :image
|
26
|
+
collection :images
|
27
|
+
model :attachments
|
28
|
+
collection :attachments
|
29
|
+
|
30
|
+
request_path 'fog/rackspace/requests/compute_v2'
|
31
|
+
request :list_servers
|
32
|
+
request :get_server
|
33
|
+
request :create_server
|
34
|
+
request :update_server
|
35
|
+
request :delete_server
|
36
|
+
request :change_server_password
|
37
|
+
request :reboot_server
|
38
|
+
request :rebuild_server
|
39
|
+
request :resize_server
|
40
|
+
request :confirm_resize_server
|
41
|
+
request :revert_resize_server
|
42
|
+
|
43
|
+
request :list_images
|
44
|
+
request :get_image
|
45
|
+
|
46
|
+
request :list_flavors
|
47
|
+
request :get_flavor
|
48
|
+
|
49
|
+
request :attach_volume
|
50
|
+
request :get_attachment
|
51
|
+
request :list_attachments
|
52
|
+
request :delete_attachment
|
53
|
+
|
54
|
+
class Mock
|
55
|
+
def request(params)
|
56
|
+
Fog::Mock.not_implemented
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class Real
|
61
|
+
def initialize(options = {})
|
62
|
+
@rackspace_api_key = options[:rackspace_api_key]
|
63
|
+
@rackspace_username = options[:rackspace_username]
|
64
|
+
@rackspace_auth_url = options[:rackspace_auth_url]
|
65
|
+
@rackspace_must_reauthenticate = false
|
66
|
+
@connection_options = options[:connection_options] || {}
|
67
|
+
|
68
|
+
endpoint = options[:rackspace_endpoint] || DFW_ENDPOINT
|
69
|
+
uri = URI.parse(endpoint)
|
70
|
+
|
71
|
+
@host = uri.host
|
72
|
+
@persistent = options[:persistent] || false
|
73
|
+
@path = uri.path
|
74
|
+
@port = uri.port
|
75
|
+
@scheme = uri.scheme
|
76
|
+
|
77
|
+
authenticate
|
78
|
+
|
79
|
+
@connection = Fog::Connection.new(uri.to_s, @persistent, @connection_options)
|
80
|
+
end
|
81
|
+
|
82
|
+
def request(params)
|
83
|
+
begin
|
84
|
+
response = @connection.request(params.merge!({
|
85
|
+
:headers => {
|
86
|
+
'Content-Type' => 'application/json',
|
87
|
+
'X-Auth-Token' => @auth_token
|
88
|
+
}.merge!(params[:headers] || {}),
|
89
|
+
:host => @host,
|
90
|
+
:path => "#{@path}/#{params[:path]}"
|
91
|
+
}))
|
92
|
+
rescue Excon::Errors::NotFound => error
|
93
|
+
raise NotFound.slurp error
|
94
|
+
rescue Excon::Errors::BadRequest => error
|
95
|
+
raise BadRequest.slurp error
|
96
|
+
rescue Excon::Errors::InternalServerError => error
|
97
|
+
raise InternalServerError.slurp error
|
98
|
+
rescue Excon::Errors::HTTPStatusError => error
|
99
|
+
raise ServiceError.slurp error
|
100
|
+
end
|
101
|
+
unless response.body.empty?
|
102
|
+
response.body = Fog::JSON.decode(response.body)
|
103
|
+
end
|
104
|
+
response
|
105
|
+
end
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
def authenticate
|
110
|
+
options = {
|
111
|
+
:rackspace_api_key => @rackspace_api_key,
|
112
|
+
:rackspace_username => @rackspace_username,
|
113
|
+
:rackspace_auth_url => @rackspace_auth_url
|
114
|
+
}
|
115
|
+
credentials = Fog::Rackspace.authenticate(options, @connection_options)
|
116
|
+
@auth_token = credentials['X-Auth-Token']
|
117
|
+
account_id = credentials['X-Server-Management-Url'].match(/.*\/([\d]+)$/)[1]
|
118
|
+
@path = "#{@path}/#{account_id}"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|