fog 1.10.0 → 1.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/benchs/load_times.rb +31 -0
- data/changelog.txt +320 -0
- data/fog.gemspec +3 -3
- data/lib/fog.rb +42 -15
- data/lib/fog/aws/auto_scaling.rb +1 -1
- data/lib/fog/aws/beanstalk.rb +1 -1
- data/lib/fog/aws/cloud_formation.rb +1 -1
- data/lib/fog/aws/compute.rb +1 -1
- data/lib/fog/aws/elasticache.rb +1 -1
- data/lib/fog/aws/elb.rb +1 -1
- data/lib/fog/aws/iam.rb +1 -1
- data/lib/fog/aws/models/beanstalk/environment.rb +6 -2
- data/lib/fog/aws/models/cdn/distributions.rb +2 -1
- data/lib/fog/aws/models/cdn/distributions_helper.rb +2 -1
- data/lib/fog/aws/models/cdn/streaming_distributions.rb +2 -1
- data/lib/fog/aws/models/compute/server.rb +1 -1
- data/lib/fog/aws/models/storage/directory.rb +1 -1
- data/lib/fog/aws/models/storage/file.rb +1 -1
- data/lib/fog/aws/parsers/beanstalk/describe_environment_resources.rb +11 -0
- data/lib/fog/aws/rds.rb +1 -1
- data/lib/fog/aws/requests/cdn/delete_distribution.rb +5 -7
- data/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb +5 -7
- data/lib/fog/aws/requests/cdn/get_distribution.rb +28 -31
- data/lib/fog/aws/requests/cdn/get_distribution_list.rb +29 -33
- data/lib/fog/aws/requests/cdn/get_invalidation.rb +15 -13
- data/lib/fog/aws/requests/cdn/get_invalidation_list.rb +15 -17
- data/lib/fog/aws/requests/cdn/get_streaming_distribution.rb +23 -26
- data/lib/fog/aws/requests/cdn/get_streaming_distribution_list.rb +29 -33
- data/lib/fog/aws/requests/cdn/post_distribution.rb +40 -42
- data/lib/fog/aws/requests/cdn/post_invalidation.rb +14 -18
- data/lib/fog/aws/requests/cdn/post_streaming_distribution.rb +28 -30
- data/lib/fog/aws/requests/cdn/put_distribution_config.rb +41 -43
- data/lib/fog/aws/requests/cdn/put_streaming_distribution_config.rb +31 -33
- data/lib/fog/aws/requests/cloud_formation/create_stack.rb +16 -20
- data/lib/fog/aws/requests/cloud_formation/delete_stack.rb +5 -8
- data/lib/fog/aws/requests/cloud_formation/describe_stack_events.rb +19 -22
- data/lib/fog/aws/requests/cloud_formation/describe_stack_resources.rb +18 -21
- data/lib/fog/aws/requests/cloud_formation/describe_stacks.rb +18 -21
- data/lib/fog/aws/requests/cloud_formation/get_template.rb +7 -10
- data/lib/fog/aws/requests/cloud_formation/update_stack.rb +12 -16
- data/lib/fog/aws/requests/cloud_formation/validate_template.rb +9 -12
- data/lib/fog/aws/requests/compute/associate_address.rb +13 -7
- data/lib/fog/aws/requests/compute/describe_reserved_instances_offerings.rb +16 -2
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -2
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +10 -0
- data/lib/fog/aws/requests/iam/update_server_certificate.rb +27 -0
- data/lib/fog/aws/requests/storage/get_object.rb +6 -2
- data/lib/fog/aws/storage.rb +6 -4
- data/lib/fog/aws/sts.rb +1 -1
- data/lib/fog/bin.rb +2 -0
- data/lib/fog/bin/digitalocean.rb +31 -0
- data/lib/fog/bin/riakcs.rb +27 -0
- data/lib/fog/cloudstack/compute.rb +3 -0
- data/lib/fog/cloudstack/models/compute/snapshot.rb +46 -0
- data/lib/fog/cloudstack/models/compute/snapshots.rb +25 -0
- data/lib/fog/cloudstack/requests/compute/create_snapshot.rb +24 -0
- data/lib/fog/compute.rb +3 -0
- data/lib/fog/compute/models/server.rb +6 -7
- data/lib/fog/core.rb +10 -5
- data/lib/fog/core/errors.rb +2 -0
- data/lib/fog/core/scp.rb +3 -3
- data/lib/fog/core/ssh.rb +1 -1
- data/lib/fog/digitalocean.rb +9 -0
- data/lib/fog/digitalocean/CHANGELOG.md +6 -0
- data/lib/fog/digitalocean/compute.rb +107 -0
- data/lib/fog/digitalocean/examples/getting_started.md +106 -0
- data/lib/fog/digitalocean/models/compute/flavor.rb +14 -0
- data/lib/fog/digitalocean/models/compute/flavors.rb +25 -0
- data/lib/fog/digitalocean/models/compute/image.rb +15 -0
- data/lib/fog/digitalocean/models/compute/images.rb +25 -0
- data/lib/fog/digitalocean/models/compute/region.rb +14 -0
- data/lib/fog/digitalocean/models/compute/regions.rb +25 -0
- data/lib/fog/digitalocean/models/compute/server.rb +150 -0
- data/lib/fog/digitalocean/models/compute/servers.rb +27 -0
- data/lib/fog/digitalocean/models/compute/ssh_key.rb +28 -0
- data/lib/fog/digitalocean/models/compute/ssh_keys.rb +27 -0
- data/lib/fog/digitalocean/requests/compute/create_server.rb +68 -0
- data/lib/fog/digitalocean/requests/compute/create_ssh_key.rb +38 -0
- data/lib/fog/digitalocean/requests/compute/destroy_server.rb +34 -0
- data/lib/fog/digitalocean/requests/compute/destroy_ssh_key.rb +37 -0
- data/lib/fog/digitalocean/requests/compute/get_server_details.rb +35 -0
- data/lib/fog/digitalocean/requests/compute/get_ssh_key.rb +39 -0
- data/lib/fog/digitalocean/requests/compute/list_flavors.rb +38 -0
- data/lib/fog/digitalocean/requests/compute/list_images.rb +49 -0
- data/lib/fog/digitalocean/requests/compute/list_regions.rb +34 -0
- data/lib/fog/digitalocean/requests/compute/list_servers.rb +31 -0
- data/lib/fog/digitalocean/requests/compute/list_ssh_keys.rb +31 -0
- data/lib/fog/digitalocean/requests/compute/power_cycle_server.rb +33 -0
- data/lib/fog/digitalocean/requests/compute/power_off_server.rb +33 -0
- data/lib/fog/digitalocean/requests/compute/power_on_server.rb +33 -0
- data/lib/fog/digitalocean/requests/compute/reboot_server.rb +33 -0
- data/lib/fog/digitalocean/requests/compute/shutdown_server.rb +36 -0
- data/lib/fog/dreamhost/CHANGELOG.md +8 -0
- data/lib/fog/glesys/models/compute/server.rb +3 -3
- data/lib/fog/google/storage.rb +1 -1
- data/lib/fog/hp.rb +1 -1
- data/lib/fog/hp/CHANGELOG.hp +12 -2
- data/lib/fog/hp/block_storage.rb +1 -0
- data/lib/fog/hp/cdn.rb +1 -0
- data/lib/fog/hp/compute.rb +1 -0
- data/lib/fog/hp/models/compute/server.rb +14 -8
- data/lib/fog/hp/models/storage/directories.rb +1 -1
- data/lib/fog/hp/models/storage/directory.rb +28 -3
- data/lib/fog/hp/models/storage/files.rb +1 -1
- data/lib/fog/hp/requests/compute/create_server.rb +4 -14
- data/lib/fog/hp/storage.rb +2 -0
- data/lib/fog/internet_archive.rb +3 -1
- data/lib/fog/internet_archive/models/storage/directory.rb +25 -42
- data/lib/fog/internet_archive/models/storage/file.rb +45 -64
- data/lib/fog/internet_archive/models/storage/ia_attributes.rb +39 -0
- data/lib/fog/internet_archive/requests/storage/delete_multiple_objects.rb +4 -78
- data/lib/fog/internet_archive/requests/storage/delete_object.rb +2 -70
- data/lib/fog/internet_archive/requests/storage/get_object.rb +1 -22
- data/lib/fog/internet_archive/requests/storage/get_object_acl.rb +0 -4
- data/lib/fog/internet_archive/requests/storage/get_service.rb +1 -2
- data/lib/fog/internet_archive/requests/storage/head_object.rb +0 -4
- data/lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb +1 -1
- data/lib/fog/internet_archive/requests/storage/put_object.rb +2 -17
- data/lib/fog/internet_archive/requests/storage/put_object_acl.rb +0 -5
- data/lib/fog/internet_archive/storage.rb +6 -18
- data/lib/fog/joyent.rb +2 -0
- data/lib/fog/libvirt/requests/compute/get_node_info.rb +1 -1
- data/lib/fog/openstack/CHANGELOG.md +47 -0
- data/lib/fog/openstack/examples/identity/basics.rb +69 -0
- data/lib/fog/openstack/examples/image/upload-test-image.rb +77 -0
- data/lib/fog/openstack/examples/network/network_subnets_routers.rb +63 -0
- data/lib/fog/openstack/examples/storage/set-account-quota.rb +66 -0
- data/lib/fog/openstack/image.rb +4 -0
- data/lib/fog/openstack/models/compute/server.rb +4 -2
- data/lib/fog/openstack/models/network/floating_ip.rb +2 -2
- data/lib/fog/openstack/models/network/floating_ips.rb +1 -1
- data/lib/fog/openstack/models/network/router.rb +56 -0
- data/lib/fog/openstack/models/network/routers.rb +34 -0
- data/lib/fog/openstack/network.rb +15 -2
- data/lib/fog/openstack/requests/compute/create_server.rb +11 -0
- data/lib/fog/openstack/requests/compute/rebuild_server.rb +9 -1
- data/lib/fog/openstack/requests/network/add_router_interface.rb +48 -0
- data/lib/fog/openstack/requests/network/create_network.rb +57 -2
- data/lib/fog/openstack/requests/network/create_router.rb +57 -0
- data/lib/fog/openstack/requests/network/delete_router.rb +30 -0
- data/lib/fog/openstack/requests/network/get_router.rb +32 -0
- data/lib/fog/openstack/requests/network/list_routers.rb +27 -0
- data/lib/fog/openstack/requests/network/remove_router_interface.rb +36 -0
- data/lib/fog/openstack/requests/network/update_router.rb +85 -0
- data/lib/fog/openstack/storage.rb +57 -0
- data/lib/fog/ovirt/compute.rb +4 -0
- data/lib/fog/ovirt/models/compute/quota.rb +21 -0
- data/lib/fog/ovirt/models/compute/quotas.rb +24 -0
- data/lib/fog/ovirt/models/compute/server.rb +2 -1
- data/lib/fog/ovirt/models/compute/volume.rb +1 -0
- data/lib/fog/ovirt/requests/compute/get_quota.rb +19 -0
- data/lib/fog/ovirt/requests/compute/list_quotas.rb +21 -0
- data/lib/fog/ovirt/requests/compute/mock_files/quotas.xml +7 -0
- data/lib/fog/rackspace.rb +11 -0
- data/lib/fog/rackspace/block_storage.rb +73 -20
- data/lib/fog/rackspace/cdn.rb +57 -19
- data/lib/fog/rackspace/compute.rb +53 -28
- data/lib/fog/rackspace/compute_v2.rb +99 -22
- data/lib/fog/rackspace/databases.rb +74 -18
- data/lib/fog/rackspace/dns.rb +55 -22
- data/lib/fog/rackspace/docs/block_storage.md +417 -0
- data/lib/fog/rackspace/docs/compute_v2.md +114 -55
- data/lib/fog/rackspace/docs/getting_started.md +20 -10
- data/lib/fog/rackspace/docs/storage.md +496 -0
- data/lib/fog/rackspace/examples/README.md +1 -1
- data/lib/fog/rackspace/examples/block_storage/create_snapshot.rb +118 -0
- data/lib/fog/rackspace/examples/block_storage/create_volume.rb +58 -0
- data/lib/fog/rackspace/examples/block_storage/delete_volume.rb +53 -0
- data/lib/fog/rackspace/examples/compute_v2/create_image.rb +2 -2
- data/lib/fog/rackspace/examples/compute_v2/create_server.rb +1 -1
- data/lib/fog/rackspace/examples/compute_v2/delete_image.rb +2 -2
- data/lib/fog/rackspace/examples/compute_v2/delete_server.rb +2 -2
- data/lib/fog/rackspace/examples/compute_v2/detach_volume.rb +4 -4
- data/lib/fog/rackspace/examples/compute_v2/resize_server.rb +2 -2
- data/lib/fog/rackspace/examples/compute_v2/server_attachments.rb +3 -3
- data/lib/fog/rackspace/examples/compute_v2/server_metadata.rb +2 -2
- data/lib/fog/rackspace/examples/storage/create_cdn_directory.rb +44 -0
- data/lib/fog/rackspace/examples/storage/create_private_directory.rb +46 -0
- data/lib/fog/rackspace/examples/storage/delete_directory.rb +62 -0
- data/lib/fog/rackspace/examples/storage/delete_file.rb +70 -0
- data/lib/fog/rackspace/examples/storage/download_file.rb +75 -0
- data/lib/fog/rackspace/examples/storage/lorem.txt +1 -0
- data/lib/fog/rackspace/examples/storage/storage_metadata.rb +82 -0
- data/lib/fog/rackspace/examples/storage/upload_file.rb +45 -0
- data/lib/fog/rackspace/identity.rb +10 -3
- data/lib/fog/rackspace/load_balancers.rb +76 -18
- data/lib/fog/rackspace/models/block_storage/snapshot.rb +42 -0
- data/lib/fog/rackspace/models/block_storage/snapshots.rb +15 -0
- data/lib/fog/rackspace/models/block_storage/volume.rb +65 -0
- data/lib/fog/rackspace/models/block_storage/volume_type.rb +6 -0
- data/lib/fog/rackspace/models/block_storage/volume_types.rb +15 -0
- data/lib/fog/rackspace/models/block_storage/volumes.rb +15 -0
- data/lib/fog/rackspace/models/compute_v2/attachment.rb +8 -0
- data/lib/fog/rackspace/models/compute_v2/attachments.rb +9 -1
- data/lib/fog/rackspace/models/compute_v2/flavors.rb +9 -1
- data/lib/fog/rackspace/models/compute_v2/image.rb +10 -2
- data/lib/fog/rackspace/models/compute_v2/images.rb +9 -1
- data/lib/fog/rackspace/models/compute_v2/meta_parent.rb +1 -1
- data/lib/fog/rackspace/models/compute_v2/metadata.rb +17 -5
- data/lib/fog/rackspace/models/compute_v2/metadatum.rb +8 -0
- data/lib/fog/rackspace/models/compute_v2/server.rb +72 -13
- data/lib/fog/rackspace/models/compute_v2/servers.rb +16 -2
- data/lib/fog/rackspace/models/dns/zones.rb +5 -9
- data/lib/fog/rackspace/models/identity/service_catalog.rb +83 -0
- data/lib/fog/rackspace/models/storage/account.rb +26 -0
- data/lib/fog/rackspace/models/storage/directories.rb +23 -3
- data/lib/fog/rackspace/models/storage/directory.rb +89 -5
- data/lib/fog/rackspace/models/storage/file.rb +112 -2
- data/lib/fog/rackspace/models/storage/files.rb +78 -0
- data/lib/fog/rackspace/models/storage/metadata.rb +28 -5
- data/lib/fog/rackspace/requests/block_storage/create_snapshot.rb +24 -0
- data/lib/fog/rackspace/requests/block_storage/create_volume.rb +29 -0
- data/lib/fog/rackspace/requests/block_storage/delete_snapshot.rb +10 -0
- data/lib/fog/rackspace/requests/block_storage/delete_volume.rb +11 -0
- data/lib/fog/rackspace/requests/block_storage/get_snapshot.rb +20 -0
- data/lib/fog/rackspace/requests/block_storage/get_volume.rb +24 -0
- data/lib/fog/rackspace/requests/block_storage/get_volume_type.rb +14 -0
- data/lib/fog/rackspace/requests/block_storage/list_snapshots.rb +17 -0
- data/lib/fog/rackspace/requests/block_storage/list_volume_types.rb +13 -0
- data/lib/fog/rackspace/requests/block_storage/list_volumes.rb +21 -0
- data/lib/fog/rackspace/requests/cdn/delete_object.rb +5 -1
- data/lib/fog/rackspace/requests/cdn/get_containers.rb +5 -0
- data/lib/fog/rackspace/requests/cdn/head_container.rb +5 -0
- data/lib/fog/rackspace/requests/cdn/post_container.rb +6 -1
- data/lib/fog/rackspace/requests/cdn/put_container.rb +6 -1
- data/lib/fog/rackspace/requests/compute_v2/attach_volume.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/change_server_password.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/confirm_resize_server.rb +5 -0
- data/lib/fog/rackspace/requests/compute_v2/create_image.rb +9 -4
- data/lib/fog/rackspace/requests/compute_v2/create_server.rb +9 -5
- data/lib/fog/rackspace/requests/compute_v2/delete_attachment.rb +5 -0
- data/lib/fog/rackspace/requests/compute_v2/delete_image.rb +5 -0
- data/lib/fog/rackspace/requests/compute_v2/delete_metadata_item.rb +5 -0
- data/lib/fog/rackspace/requests/compute_v2/delete_server.rb +5 -0
- data/lib/fog/rackspace/requests/compute_v2/get_attachment.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/get_flavor.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/get_image.rb +5 -1
- data/lib/fog/rackspace/requests/compute_v2/get_metadata_item.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/get_server.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/list_addresses.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/list_addresses_by_network.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/list_attachments.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/list_flavors.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/list_images.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/list_metadata.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/list_servers.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/reboot_server.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/rebuild_server.rb +8 -4
- data/lib/fog/rackspace/requests/compute_v2/resize_server.rb +6 -1
- data/lib/fog/rackspace/requests/compute_v2/revert_resize_server.rb +8 -3
- data/lib/fog/rackspace/requests/compute_v2/set_metadata.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/set_metadata_item.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/update_metadata.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/update_server.rb +4 -0
- data/lib/fog/rackspace/requests/storage/copy_object.rb +4 -0
- data/lib/fog/rackspace/requests/storage/delete_container.rb +4 -1
- data/lib/fog/rackspace/requests/storage/delete_object.rb +4 -1
- data/lib/fog/rackspace/requests/storage/get_container.rb +4 -0
- data/lib/fog/rackspace/requests/storage/get_containers.rb +4 -0
- data/lib/fog/rackspace/requests/storage/get_object.rb +4 -1
- data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +7 -4
- data/lib/fog/rackspace/requests/storage/head_container.rb +4 -0
- data/lib/fog/rackspace/requests/storage/head_containers.rb +4 -0
- data/lib/fog/rackspace/requests/storage/head_object.rb +4 -1
- data/lib/fog/rackspace/requests/storage/post_set_meta_temp_url_key.rb +4 -1
- data/lib/fog/rackspace/requests/storage/put_container.rb +4 -1
- data/lib/fog/rackspace/requests/storage/put_object.rb +4 -1
- data/lib/fog/rackspace/requests/storage/put_object_manifest.rb +4 -1
- data/lib/fog/rackspace/service.rb +78 -0
- data/lib/fog/rackspace/storage.rb +62 -22
- data/lib/fog/riakcs.rb +122 -0
- data/lib/fog/riakcs/provisioning.rb +100 -0
- data/lib/fog/riakcs/requests/provisioning/create_user.rb +77 -0
- data/lib/fog/riakcs/requests/provisioning/disable_user.rb +23 -0
- data/lib/fog/riakcs/requests/provisioning/enable_user.rb +23 -0
- data/lib/fog/riakcs/requests/provisioning/get_user.rb +41 -0
- data/lib/fog/riakcs/requests/provisioning/list_users.rb +43 -0
- data/lib/fog/riakcs/requests/provisioning/regrant_secret.rb +23 -0
- data/lib/fog/riakcs/requests/provisioning/update_user.rb +23 -0
- data/lib/fog/riakcs/requests/usage/get_usage.rb +68 -0
- data/lib/fog/riakcs/usage.rb +66 -0
- data/lib/fog/vcloud/compute.rb +1 -1
- data/lib/fog/vcloud/models/compute/catalog_item.rb +8 -0
- data/lib/fog/vcloud/models/compute/server.rb +1 -0
- data/lib/fog/vcloud/requests/compute/configure_vm_network.rb +1 -2
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/compute.rb +1 -1
- data/lib/fog/vsphere/models/compute/servers.rb +9 -9
- data/lib/fog/xenserver.rb +2 -0
- data/lib/fog/xenserver/CHANGELOG.md +7 -1
- data/lib/fog/xenserver/compute.rb +6 -0
- data/lib/fog/xenserver/examples/networks-and-vlans.rb +45 -0
- data/lib/fog/xenserver/models/compute/network.rb +33 -0
- data/lib/fog/xenserver/models/compute/vlan.rb +80 -0
- data/lib/fog/xenserver/models/compute/vlans.rb +39 -0
- data/lib/fog/xenserver/requests/compute/create_network.rb +42 -0
- data/lib/fog/xenserver/requests/compute/create_vlan.rb +35 -0
- data/lib/fog/xenserver/requests/compute/destroy_network.rb +33 -0
- data/lib/fog/xenserver/requests/compute/destroy_vlan.rb +32 -0
- data/lib/fog/zerigo/models/dns/records.rb +15 -12
- data/lib/tasks/changelog_task.rb +1 -0
- data/tests/aws/requests/compute/address_tests.rb +4 -0
- data/tests/aws/requests/iam/server_certificate_tests.rb +32 -0
- data/tests/cloudstack/compute/models/snapshot_tests.rb +34 -0
- data/tests/digitalocean/helper.rb +44 -0
- data/tests/digitalocean/models/compute/flavor_tests.rb +30 -0
- data/tests/digitalocean/models/compute/image_tests.rb +31 -0
- data/tests/digitalocean/models/compute/region_tests.rb +30 -0
- data/tests/digitalocean/models/compute/server_tests.rb +84 -0
- data/tests/digitalocean/models/compute/servers_tests.rb +35 -0
- data/tests/digitalocean/models/compute/ssh_key_tests.rb +40 -0
- data/tests/digitalocean/models/compute/ssh_keys_tests.rb +28 -0
- data/tests/digitalocean/requests/compute/create_server_tests.rb +28 -0
- data/tests/digitalocean/requests/compute/create_ssh_key_tests.rb +22 -0
- data/tests/digitalocean/requests/compute/destroy_server_tests.rb +15 -0
- data/tests/digitalocean/requests/compute/destroy_ssh_key_tests.rb +23 -0
- data/tests/digitalocean/requests/compute/get_server_details_tests.rb +13 -0
- data/tests/digitalocean/requests/compute/get_ssh_key_tests.rb +22 -0
- data/tests/digitalocean/requests/compute/list_flavors_tests.rb +23 -0
- data/tests/digitalocean/requests/compute/list_images_tests.rb +24 -0
- data/tests/digitalocean/requests/compute/list_regions_tests.rb +23 -0
- data/tests/digitalocean/requests/compute/list_servers_tests.rb +26 -0
- data/tests/digitalocean/requests/compute/list_ssh_keys_tests.rb +21 -0
- data/tests/digitalocean/requests/compute/power_cycle_server_tests.rb +20 -0
- data/tests/digitalocean/requests/compute/power_state_tests.rb +25 -0
- data/tests/digitalocean/requests/compute/reboot_server_tests.rb +14 -0
- data/tests/helpers/collection_helper.rb +36 -1
- data/tests/helpers/mock_helper.rb +2 -0
- data/tests/internet_archive/models/storage/directory_tests.rb +24 -32
- data/tests/internet_archive/models/storage/file_tests.rb +16 -35
- data/tests/internet_archive/models/storage/files_tests.rb +33 -31
- data/tests/internet_archive/models/storage/url_tests.rb +1 -1
- data/tests/internet_archive/requests/storage/bucket_tests.rb +34 -38
- data/tests/internet_archive/requests/storage/multipart_upload_tests.rb +1 -1
- data/tests/openstack/models/network/network_tests.rb +17 -0
- data/tests/openstack/models/network/router_tests.rb +38 -0
- data/tests/openstack/models/network/routers_tests.rb +21 -0
- data/tests/openstack/requests/network/network_tests.rb +61 -10
- data/tests/openstack/requests/network/router_tests.rb +75 -0
- data/tests/openstack/storage_tests.rb +19 -0
- data/tests/ovirt/requests/compute/list_quotas_tests.rb +12 -0
- data/tests/rackspace/block_storage_tests.rb +101 -0
- data/tests/rackspace/cdn_tests.rb +144 -52
- data/tests/rackspace/compute_tests.rb +88 -0
- data/tests/rackspace/compute_v2_tests.rb +101 -0
- data/tests/rackspace/databases_tests.rb +98 -0
- data/tests/rackspace/dns_tests.rb +82 -0
- data/tests/rackspace/load_balancer_tests.rb +99 -0
- data/tests/rackspace/models/compute_v2/image_tests.rb +51 -0
- data/tests/rackspace/models/compute_v2/server_tests.rb +51 -0
- data/tests/rackspace/models/identity/service_catalog_tests.rb +81 -0
- data/tests/rackspace/models/storage/file_tests.rb +10 -1
- data/tests/rackspace/rackspace_tests.rb +21 -0
- data/tests/rackspace/requests/compute_v2/metadata_tests.rb +2 -2
- data/tests/rackspace/requests/storage/object_tests.rb +2 -2
- data/tests/rackspace/storage_tests.rb +99 -3
- data/tests/riakcs/requests/provisioning/provisioning_tests.rb +174 -0
- data/tests/riakcs/requests/usage/usage_tests.rb +29 -0
- data/tests/xenserver/models/compute/network_tests.rb +18 -6
- data/tests/xenserver/models/compute/vlan_tests.rb +76 -0
- data/tests/xenserver/models/compute/vlans_tests.rb +36 -0
- data/tests/xenserver/requests/compute/create_network_tests.rb +20 -0
- data/tests/xenserver/requests/compute/create_vlan_tests.rb +36 -0
- data/tests/xenserver/requests/compute/destroy_network_tests.rb +13 -0
- data/tests/xenserver/requests/compute/destroy_vlan_tests.rb +36 -0
- metadata +178 -21
- data/lib/fog/internet_archive/models/storage/version.rb +0 -36
- data/lib/fog/internet_archive/models/storage/versions.rb +0 -38
- data/lib/fog/internet_archive/parsers/storage/get_bucket_object_versions.rb +0 -88
- data/lib/fog/internet_archive/parsers/storage/get_bucket_versioning.rb +0 -24
- data/lib/fog/internet_archive/requests/storage/get_bucket_object_versions.rb +0 -162
- data/lib/fog/internet_archive/requests/storage/get_bucket_versioning.rb +0 -69
- data/lib/fog/internet_archive/requests/storage/put_bucket_versioning.rb +0 -75
- data/lib/fog/openstack/README.identity.md +0 -69
- data/lib/fog/providers.rb +0 -34
- data/lib/fog/rackspace/examples/compute_v2/README.md +0 -47
- data/tests/internet_archive/models/storage/version_tests.rb +0 -52
- data/tests/internet_archive/models/storage/versions_tests.rb +0 -56
- data/tests/internet_archive/requests/storage/versioning_tests.rb +0 -258
@@ -7,7 +7,7 @@ module Fog
|
|
7
7
|
|
8
8
|
requires :rackspace_api_key, :rackspace_username
|
9
9
|
recognizes :rackspace_auth_url, :rackspace_servicenet, :persistent
|
10
|
-
recognizes :rackspace_auth_token, :rackspace_management_url
|
10
|
+
recognizes :rackspace_auth_token, :rackspace_management_url, :rackspace_compute_v1_url, :rackspace_region
|
11
11
|
|
12
12
|
model_path 'fog/rackspace/models/compute'
|
13
13
|
model :flavor
|
@@ -41,7 +41,7 @@ module Fog
|
|
41
41
|
request :server_action
|
42
42
|
request :update_server
|
43
43
|
|
44
|
-
class Mock
|
44
|
+
class Mock < Fog::Rackspace::Service
|
45
45
|
|
46
46
|
def self.data
|
47
47
|
@data ||= Hash.new do |hash, key|
|
@@ -180,7 +180,7 @@ module Fog
|
|
180
180
|
|
181
181
|
end
|
182
182
|
|
183
|
-
class Real
|
183
|
+
class Real < Fog::Rackspace::Service
|
184
184
|
|
185
185
|
def initialize(options={})
|
186
186
|
@rackspace_api_key = options[:rackspace_api_key]
|
@@ -188,13 +188,13 @@ module Fog
|
|
188
188
|
@rackspace_auth_url = options[:rackspace_auth_url]
|
189
189
|
@rackspace_servicenet = options[:rackspace_servicenet]
|
190
190
|
@rackspace_auth_token = options[:rackspace_auth_token]
|
191
|
-
@
|
191
|
+
@rackspace_endpoint = Fog::Rackspace.normalize_url(options[:rackspace_compute_v1_url] || options[:rackspace_management_url])
|
192
192
|
@rackspace_must_reauthenticate = false
|
193
193
|
@connection_options = options[:connection_options] || {}
|
194
194
|
authenticate
|
195
|
-
Excon.ssl_verify_peer = false if
|
195
|
+
Excon.defaults[:ssl_verify_peer] = false if service_net?
|
196
196
|
@persistent = options[:persistent] || false
|
197
|
-
@connection = Fog::Connection.new(
|
197
|
+
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
198
198
|
end
|
199
199
|
|
200
200
|
def reload
|
@@ -206,10 +206,10 @@ module Fog
|
|
206
206
|
response = @connection.request(params.merge({
|
207
207
|
:headers => {
|
208
208
|
'Content-Type' => 'application/json',
|
209
|
-
'X-Auth-Token' =>
|
209
|
+
'X-Auth-Token' => auth_token
|
210
210
|
}.merge!(params[:headers] || {}),
|
211
|
-
:host =>
|
212
|
-
:path => "#{
|
211
|
+
:host => endpoint_uri.host,
|
212
|
+
:path => "#{endpoint_uri.path}/#{params[:path]}",
|
213
213
|
:query => ('ignore_awful_caching' << Time.now.to_i.to_s)
|
214
214
|
}))
|
215
215
|
rescue Excon::Errors::Unauthorized => error
|
@@ -234,28 +234,53 @@ module Fog
|
|
234
234
|
response
|
235
235
|
end
|
236
236
|
|
237
|
-
private
|
238
237
|
|
239
|
-
def
|
240
|
-
|
241
|
-
options = {
|
242
|
-
:rackspace_api_key => @rackspace_api_key,
|
243
|
-
:rackspace_username => @rackspace_username,
|
244
|
-
:rackspace_auth_url => @rackspace_auth_url
|
245
|
-
}
|
246
|
-
credentials = Fog::Rackspace.authenticate(options, @connection_options)
|
247
|
-
@auth_token = credentials['X-Auth-Token']
|
248
|
-
uri = URI.parse(credentials['X-Server-Management-Url'])
|
249
|
-
else
|
250
|
-
@auth_token = @rackspace_auth_token
|
251
|
-
uri = URI.parse(@rackspace_management_url)
|
252
|
-
end
|
253
|
-
@host = @rackspace_servicenet == true ? "snet-#{uri.host}" : uri.host
|
254
|
-
@path = uri.path
|
255
|
-
@port = uri.port
|
256
|
-
@scheme = uri.scheme
|
238
|
+
def service_net?
|
239
|
+
@rackspace_servicenet == true
|
257
240
|
end
|
258
241
|
|
242
|
+
def authenticate
|
243
|
+
if @rackspace_must_reauthenticate || @rackspace_auth_token.nil?
|
244
|
+
options = {
|
245
|
+
:rackspace_api_key => @rackspace_api_key,
|
246
|
+
:rackspace_username => @rackspace_username,
|
247
|
+
:rackspace_auth_url => @rackspace_auth_url
|
248
|
+
}
|
249
|
+
super(options)
|
250
|
+
else
|
251
|
+
@auth_token = @rackspace_auth_token
|
252
|
+
@uri = URI.parse(@rackspace_endpoint)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
def service_name
|
257
|
+
:cloudServers
|
258
|
+
end
|
259
|
+
|
260
|
+
def region
|
261
|
+
@rackspace_region
|
262
|
+
end
|
263
|
+
|
264
|
+
def endpoint_uri(service_endpoint_url=nil)
|
265
|
+
return @uri if @uri
|
266
|
+
|
267
|
+
@uri = super(@rackspace_endpoint || service_endpoint_url, :rackspace_compute_v1_url)
|
268
|
+
@uri.host = "snet-#{@uri.host}" if service_net?
|
269
|
+
@uri
|
270
|
+
end
|
271
|
+
|
272
|
+
private
|
273
|
+
|
274
|
+
def deprecation_warnings(options)
|
275
|
+
Fog::Logger.deprecation("The :rackspace_management_url option is deprecated. Please use :rackspace_compute_v1_url for custom endpoints") if options[:rackspace_management_url]
|
276
|
+
end
|
277
|
+
|
278
|
+
def authenticate_v1(options)
|
279
|
+
credentials = Fog::Rackspace.authenticate(options, @connection_options)
|
280
|
+
endpoint_uri credentials['X-Server-Management-Url']
|
281
|
+
@auth_token = credentials['X-Auth-Token']
|
282
|
+
end
|
283
|
+
|
259
284
|
end
|
260
285
|
end
|
261
286
|
end
|
@@ -8,6 +8,29 @@ module Fog
|
|
8
8
|
class InternalServerError < Fog::Rackspace::Errors::InternalServerError; end
|
9
9
|
class BadRequest < Fog::Rackspace::Errors::BadRequest; end
|
10
10
|
|
11
|
+
class InvalidStateException < ::RuntimeError
|
12
|
+
|
13
|
+
attr_reader :desired_state
|
14
|
+
attr_reader :current_state
|
15
|
+
|
16
|
+
def initialize(desired_state, current_state)
|
17
|
+
@desired_state = desired_state
|
18
|
+
@current_state = current_state
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class InvalidServerStateException < InvalidStateException
|
23
|
+
def to_s
|
24
|
+
"Server should have transitioned to '#{desired_state}' not '#{state}'"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class InvalidImageStateException < InvalidStateException
|
29
|
+
def to_s
|
30
|
+
"Image should have transitioned to '#{desired_state}' not '#{state}'"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
11
34
|
DFW_ENDPOINT = 'https://dfw.servers.api.rackspacecloud.com/v2'
|
12
35
|
ORD_ENDPOINT = 'https://ord.servers.api.rackspacecloud.com/v2'
|
13
36
|
LON_ENDPOINT = 'https://lon.servers.api.rackspacecloud.com/v2'
|
@@ -16,6 +39,8 @@ module Fog
|
|
16
39
|
recognizes :rackspace_endpoint
|
17
40
|
recognizes :rackspace_auth_url
|
18
41
|
recognizes :rackspace_auth_token
|
42
|
+
recognizes :rackspace_region
|
43
|
+
recognizes :rackspace_compute_url
|
19
44
|
|
20
45
|
model_path 'fog/rackspace/models/compute_v2'
|
21
46
|
model :server
|
@@ -69,8 +94,8 @@ module Fog
|
|
69
94
|
request :create_network
|
70
95
|
request :delete_network
|
71
96
|
|
72
|
-
class Mock
|
73
|
-
include Fog::Rackspace::MockData
|
97
|
+
class Mock < Fog::Rackspace::Service
|
98
|
+
include Fog::Rackspace::MockData
|
74
99
|
|
75
100
|
def initialize(options)
|
76
101
|
@rackspace_api_key = options[:rackspace_api_key]
|
@@ -93,26 +118,22 @@ module Fog
|
|
93
118
|
end
|
94
119
|
end
|
95
120
|
|
96
|
-
class Real
|
121
|
+
class Real < Fog::Rackspace::Service
|
122
|
+
|
97
123
|
def initialize(options = {})
|
98
124
|
@rackspace_api_key = options[:rackspace_api_key]
|
99
125
|
@rackspace_username = options[:rackspace_username]
|
100
126
|
@rackspace_auth_url = options[:rackspace_auth_url]
|
127
|
+
setup_custom_endpoint(options)
|
101
128
|
@rackspace_must_reauthenticate = false
|
102
129
|
@connection_options = options[:connection_options] || {}
|
103
130
|
|
104
|
-
endpoint = options[:rackspace_endpoint] || DFW_ENDPOINT
|
105
|
-
uri = URI.parse(endpoint)
|
106
|
-
|
107
|
-
@host = uri.host
|
108
|
-
@persistent = options[:persistent] || false
|
109
|
-
@path = uri.path
|
110
|
-
@port = uri.port
|
111
|
-
@scheme = uri.scheme
|
112
|
-
|
113
131
|
authenticate
|
114
132
|
|
115
|
-
|
133
|
+
deprecation_warnings(options)
|
134
|
+
|
135
|
+
@persistent = options[:persistent] || false
|
136
|
+
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
116
137
|
end
|
117
138
|
|
118
139
|
def request(params)
|
@@ -121,10 +142,10 @@ module Fog
|
|
121
142
|
:headers => {
|
122
143
|
'Content-Type' => 'application/json',
|
123
144
|
'Accept' => 'application/json',
|
124
|
-
'X-Auth-Token' =>
|
145
|
+
'X-Auth-Token' => auth_token
|
125
146
|
}.merge!(params[:headers] || {}),
|
126
|
-
:host =>
|
127
|
-
:path => "#{
|
147
|
+
:host => endpoint_uri.host,
|
148
|
+
:path => "#{endpoint_uri.path}/#{params[:path]}"
|
128
149
|
}))
|
129
150
|
rescue Excon::Errors::NotFound => error
|
130
151
|
raise NotFound.slurp error
|
@@ -145,19 +166,75 @@ module Fog
|
|
145
166
|
end
|
146
167
|
response
|
147
168
|
end
|
148
|
-
|
149
|
-
private
|
150
|
-
|
169
|
+
|
151
170
|
def authenticate
|
152
171
|
options = {
|
153
|
-
:rackspace_api_key
|
172
|
+
:rackspace_api_key => @rackspace_api_key,
|
154
173
|
:rackspace_username => @rackspace_username,
|
155
174
|
:rackspace_auth_url => @rackspace_auth_url
|
156
175
|
}
|
176
|
+
super(options)
|
177
|
+
end
|
178
|
+
|
179
|
+
def service_name
|
180
|
+
:cloudServersOpenStack
|
181
|
+
end
|
182
|
+
|
183
|
+
def region
|
184
|
+
@rackspace_region
|
185
|
+
end
|
186
|
+
|
187
|
+
def endpoint_uri(service_endpoint_url=nil)
|
188
|
+
@uri = super(@rackspace_endpoint || service_endpoint_url, :rackspace_compute_url)
|
189
|
+
end
|
190
|
+
|
191
|
+
private
|
192
|
+
|
193
|
+
def setup_custom_endpoint(options)
|
194
|
+
@rackspace_endpoint = Fog::Rackspace.normalize_url(options[:rackspace_compute_url] || options[:rackspace_endpoint])
|
195
|
+
|
196
|
+
if v2_authentication?
|
197
|
+
case @rackspace_endpoint
|
198
|
+
when DFW_ENDPOINT
|
199
|
+
@rackspace_endpoint = nil
|
200
|
+
@rackspace_region = :dfw
|
201
|
+
when ORD_ENDPOINT
|
202
|
+
@rackspace_endpoint = nil
|
203
|
+
@rackspace_region = :ord
|
204
|
+
when LON_ENDPOINT
|
205
|
+
@rackspace_endpoint = nil
|
206
|
+
@rackspace_region = :lon
|
207
|
+
else
|
208
|
+
# we are actually using a custom endpoint
|
209
|
+
@rackspace_region = options[:rackspace_region] || :dfw
|
210
|
+
end
|
211
|
+
else
|
212
|
+
#if we are using auth1 and the endpoint is not set, default to DFW_ENDPOINT for historical reasons
|
213
|
+
@rackspace_endpoint ||= DFW_ENDPOINT
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
def deprecation_warnings(options)
|
218
|
+
Fog::Logger.deprecation("The :rackspace_endpoint option is deprecated. Please use :rackspace_compute_url for custom endpoints") if options[:rackspace_endpoint]
|
219
|
+
|
220
|
+
if [DFW_ENDPOINT, ORD_ENDPOINT, LON_ENDPOINT].include?(@rackspace_endpoint) && v2_authentication?
|
221
|
+
regions = @identity_service.service_catalog.display_service_regions(service_name)
|
222
|
+
Fog::Logger.deprecation("Please specify region using :rackspace_region rather than :rackspace_endpoint. Valid regions for :rackspace_region are #{regions}.")
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
def append_tenant_v1(credentials)
|
227
|
+
account_id = credentials['X-Server-Management-Url'].match(/.*\/([\d]+)$/)[1]
|
228
|
+
|
229
|
+
endpoint = @rackspace_endpoint || credentials['X-Server-Management-Url'] || DFW_ENDPOINT
|
230
|
+
@uri = URI.parse(endpoint)
|
231
|
+
@uri.path = "#{@uri.path}/#{account_id}"
|
232
|
+
end
|
233
|
+
|
234
|
+
def authenticate_v1(options)
|
157
235
|
credentials = Fog::Rackspace.authenticate(options, @connection_options)
|
236
|
+
append_tenant_v1 credentials
|
158
237
|
@auth_token = credentials['X-Auth-Token']
|
159
|
-
account_id = credentials['X-Server-Management-Url'].match(/.*\/([\d]+)$/)[1]
|
160
|
-
@path = "#{@path}/#{account_id}"
|
161
238
|
end
|
162
239
|
end
|
163
240
|
end
|
@@ -16,6 +16,9 @@ module Fog
|
|
16
16
|
recognizes :rackspace_auth_url
|
17
17
|
recognizes :rackspace_auth_token
|
18
18
|
recognizes :rackspace_endpoint
|
19
|
+
recognizes :rackspace_region
|
20
|
+
recognizes :rackspace_database_url
|
21
|
+
|
19
22
|
|
20
23
|
model_path 'fog/rackspace/models/databases'
|
21
24
|
model :flavor
|
@@ -49,32 +52,36 @@ module Fog
|
|
49
52
|
request :create_user
|
50
53
|
request :delete_user
|
51
54
|
|
52
|
-
class Mock
|
55
|
+
class Mock < Fog::Rackspace::Service
|
53
56
|
def request(params)
|
54
57
|
Fog::Mock.not_implemented
|
55
58
|
end
|
56
59
|
end
|
57
60
|
|
58
|
-
class Real
|
61
|
+
class Real < Fog::Rackspace::Service
|
62
|
+
|
63
|
+
def service_name
|
64
|
+
:cloudDatabases
|
65
|
+
end
|
66
|
+
|
67
|
+
def region
|
68
|
+
@rackspace_region
|
69
|
+
end
|
70
|
+
|
59
71
|
def initialize(options = {})
|
60
72
|
@rackspace_api_key = options[:rackspace_api_key]
|
61
73
|
@rackspace_username = options[:rackspace_username]
|
62
74
|
@rackspace_auth_url = options[:rackspace_auth_url]
|
63
75
|
@rackspace_must_reauthenticate = false
|
64
76
|
@connection_options = options[:connection_options] || {}
|
65
|
-
|
66
|
-
endpoint = options[:rackspace_endpoint] || DFW_ENDPOINT
|
67
|
-
uri = URI.parse(endpoint)
|
68
|
-
|
69
|
-
@host = uri.host
|
70
|
-
@persistent = options[:persistent] || false
|
71
|
-
@path = uri.path
|
72
|
-
@port = uri.port
|
73
|
-
@scheme = uri.scheme
|
77
|
+
setup_custom_endpoint(options)
|
74
78
|
|
75
79
|
authenticate
|
76
80
|
|
77
|
-
|
81
|
+
deprecation_warnings(options)
|
82
|
+
|
83
|
+
@persistent = options[:persistent] || false
|
84
|
+
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
78
85
|
end
|
79
86
|
|
80
87
|
def request(params)
|
@@ -83,10 +90,10 @@ module Fog
|
|
83
90
|
:headers => {
|
84
91
|
'Content-Type' => 'application/json',
|
85
92
|
'Accept' => 'application/json',
|
86
|
-
'X-Auth-Token' =>
|
93
|
+
'X-Auth-Token' => auth_token
|
87
94
|
}.merge!(params[:headers] || {}),
|
88
|
-
:host =>
|
89
|
-
:path => "#{
|
95
|
+
:host => endpoint_uri.host,
|
96
|
+
:path => "#{endpoint_uri.path}/#{params[:path]}"
|
90
97
|
}))
|
91
98
|
rescue Excon::Errors::NotFound => error
|
92
99
|
raise NotFound.slurp error
|
@@ -103,7 +110,9 @@ module Fog
|
|
103
110
|
response
|
104
111
|
end
|
105
112
|
|
106
|
-
|
113
|
+
def endpoint_uri(service_endpoint_url=nil)
|
114
|
+
@uri = super(@rackspace_endpoint || service_endpoint_url, :rackspace_database_url)
|
115
|
+
end
|
107
116
|
|
108
117
|
def authenticate
|
109
118
|
options = {
|
@@ -111,10 +120,57 @@ module Fog
|
|
111
120
|
:rackspace_username => @rackspace_username,
|
112
121
|
:rackspace_auth_url => @rackspace_auth_url
|
113
122
|
}
|
123
|
+
|
124
|
+
super(options)
|
125
|
+
end
|
126
|
+
|
127
|
+
private
|
128
|
+
|
129
|
+
def setup_custom_endpoint(options)
|
130
|
+
@rackspace_endpoint = Fog::Rackspace.normalize_url(options[:rackspace_database_url] || options[:rackspace_endpoint])
|
131
|
+
|
132
|
+
if v2_authentication?
|
133
|
+
case @rackspace_endpoint
|
134
|
+
when DFW_ENDPOINT
|
135
|
+
@rackspace_endpoint = nil
|
136
|
+
@rackspace_region = :dfw
|
137
|
+
when ORD_ENDPOINT
|
138
|
+
@rackspace_endpoint = nil
|
139
|
+
@rackspace_region = :ord
|
140
|
+
when LON_ENDPOINT
|
141
|
+
@rackspace_endpoint = nil
|
142
|
+
@rackspace_region = :lon
|
143
|
+
else
|
144
|
+
# we are actually using a custom endpoint
|
145
|
+
@rackspace_region = options[:rackspace_region] || :dfw
|
146
|
+
end
|
147
|
+
else
|
148
|
+
#if we are using auth1 and the endpoint is not set, default to DFW_ENDPOINT for historical reasons
|
149
|
+
@rackspace_endpoint ||= DFW_ENDPOINT
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def deprecation_warnings(options)
|
154
|
+
Fog::Logger.deprecation("The :rackspace_endpoint option is deprecated. Please use :rackspace_database_url for custom endpoints") if options[:rackspace_endpoint]
|
155
|
+
|
156
|
+
if [DFW_ENDPOINT, ORD_ENDPOINT, LON_ENDPOINT].include?(@rackspace_endpoint) && v2_authentication?
|
157
|
+
regions = @identity_service.service_catalog.display_service_regions(service_name)
|
158
|
+
Fog::Logger.deprecation("Please specify region using :rackspace_region rather than :rackspace_endpoint. Valid region for :rackspace_region are #{regions}.")
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def append_tenant_v1(credentials)
|
163
|
+
account_id = credentials['X-Server-Management-Url'].match(/.*\/([\d]+)$/)[1]
|
164
|
+
|
165
|
+
endpoint = @rackspace_endpoint || credentials['X-Server-Management-Url'] || DFW_ENDPOINT
|
166
|
+
@uri = URI.parse(endpoint)
|
167
|
+
@uri.path = "#{@uri.path}/#{account_id}"
|
168
|
+
end
|
169
|
+
|
170
|
+
def authenticate_v1(options)
|
114
171
|
credentials = Fog::Rackspace.authenticate(options, @connection_options)
|
172
|
+
append_tenant_v1 credentials
|
115
173
|
@auth_token = credentials['X-Auth-Token']
|
116
|
-
account_id = credentials['X-Server-Management-Url'].match(/.*\/([\d]+)$/)[1]
|
117
|
-
@path = "#{@path}/#{account_id}"
|
118
174
|
end
|
119
175
|
end
|
120
176
|
end
|
data/lib/fog/rackspace/dns.rb
CHANGED
@@ -18,7 +18,7 @@ module Fog
|
|
18
18
|
UK_ENDPOINT = 'https://lon.dns.api.rackspacecloud.com/v1.0'
|
19
19
|
|
20
20
|
requires :rackspace_api_key, :rackspace_username
|
21
|
-
recognizes :rackspace_auth_url, :rackspace_auth_token, :rackspace_dns_endpoint
|
21
|
+
recognizes :rackspace_auth_url, :rackspace_auth_token, :rackspace_dns_endpoint, :rackspace_dns_url, :rackspace_region
|
22
22
|
|
23
23
|
model_path 'fog/rackspace/models/dns'
|
24
24
|
model :record
|
@@ -43,7 +43,7 @@ module Fog
|
|
43
43
|
request :remove_records
|
44
44
|
request :add_records
|
45
45
|
|
46
|
-
class Mock
|
46
|
+
class Mock < Fog::Rackspace::Service
|
47
47
|
|
48
48
|
def initialize(options={})
|
49
49
|
@rackspace_api_key = options[:rackspace_api_key]
|
@@ -71,22 +71,38 @@ module Fog
|
|
71
71
|
|
72
72
|
end
|
73
73
|
|
74
|
-
class Real
|
74
|
+
class Real < Fog::Rackspace::Service
|
75
|
+
|
76
|
+
def service_name
|
77
|
+
:cloudDNS
|
78
|
+
end
|
79
|
+
|
80
|
+
def region
|
81
|
+
#Note: DNS does not currently support multiple regions
|
82
|
+
@rackspace_region
|
83
|
+
end
|
84
|
+
|
75
85
|
def initialize(options={})
|
76
86
|
@rackspace_api_key = options[:rackspace_api_key]
|
77
87
|
@rackspace_username = options[:rackspace_username]
|
78
88
|
@rackspace_auth_url = options[:rackspace_auth_url]
|
79
89
|
@connection_options = options[:connection_options] || {}
|
80
|
-
|
90
|
+
@rackspace_endpoint = Fog::Rackspace.normalize_url(options[:rackspace_dns_url] || options[:rackspace_dns_endpoint])
|
91
|
+
@rackspace_region = options[:rackspace_region]
|
81
92
|
|
82
|
-
|
83
|
-
|
84
|
-
|
93
|
+
authenticate
|
94
|
+
|
95
|
+
deprecation_warnings(options)
|
85
96
|
|
86
97
|
@connection_options[:headers] ||= {}
|
87
|
-
@connection_options[:headers].merge!({ 'Content-Type' => 'application/json', 'X-Auth-Token' =>
|
98
|
+
@connection_options[:headers].merge!({ 'Content-Type' => 'application/json', 'X-Auth-Token' => auth_token })
|
99
|
+
|
100
|
+
@persistent = options[:persistent] || false
|
101
|
+
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
102
|
+
end
|
88
103
|
|
89
|
-
|
104
|
+
def endpoint_uri(service_endpoint_url=nil)
|
105
|
+
@uri = super(@rackspace_endpoint || service_endpoint_url, :rackspace_dns_url)
|
90
106
|
end
|
91
107
|
|
92
108
|
private
|
@@ -95,7 +111,7 @@ module Fog
|
|
95
111
|
#TODO - Unify code with other rackspace services
|
96
112
|
begin
|
97
113
|
response = @connection.request(params.merge!({
|
98
|
-
:path => "#{
|
114
|
+
:path => "#{endpoint_uri.path}/#{params[:path]}"
|
99
115
|
}))
|
100
116
|
rescue Excon::Errors::BadRequest => error
|
101
117
|
raise Fog::Rackspace::Errors::BadRequest.slurp error
|
@@ -112,18 +128,6 @@ module Fog
|
|
112
128
|
response
|
113
129
|
end
|
114
130
|
|
115
|
-
def authenticate
|
116
|
-
options = {
|
117
|
-
:rackspace_api_key => @rackspace_api_key,
|
118
|
-
:rackspace_username => @rackspace_username,
|
119
|
-
:rackspace_auth_url => @rackspace_auth_url
|
120
|
-
}
|
121
|
-
credentials = Fog::Rackspace.authenticate(options, @connection_options)
|
122
|
-
auth_token = credentials['X-Auth-Token']
|
123
|
-
account_id = credentials['X-Server-Management-Url'].match(/.*\/([\d]+)$/)[1]
|
124
|
-
[auth_token, account_id]
|
125
|
-
end
|
126
|
-
|
127
131
|
def array_to_query_string(arr)
|
128
132
|
arr.collect {|k,v| "#{k}=#{v}" }.join('&')
|
129
133
|
end
|
@@ -133,6 +137,35 @@ module Fog
|
|
133
137
|
raise ArgumentError.new("#{name} cannot be null or empty")
|
134
138
|
end
|
135
139
|
end
|
140
|
+
|
141
|
+
private
|
142
|
+
|
143
|
+
def deprecation_warnings(options)
|
144
|
+
Fog::Logger.deprecation("The :rackspace_dns_endpoint option is deprecated. Please use :rackspace_dns_url for custom endpoints") if options[:rackspace_dns_endpoint]
|
145
|
+
end
|
146
|
+
|
147
|
+
def setup_endpoint(credentials)
|
148
|
+
account_id = credentials['X-Server-Management-Url'].match(/.*\/([\d]+)$/)[1]
|
149
|
+
|
150
|
+
@uri = URI.parse(@rackspace_endpoint || US_ENDPOINT)
|
151
|
+
@uri.path = "#{@uri.path}/#{account_id}"
|
152
|
+
end
|
153
|
+
|
154
|
+
def authenticate_v1(options)
|
155
|
+
credentials = Fog::Rackspace.authenticate(options, @connection_options)
|
156
|
+
setup_endpoint credentials
|
157
|
+
@auth_token = credentials['X-Auth-Token']
|
158
|
+
end
|
159
|
+
|
160
|
+
def authenticate
|
161
|
+
options = {
|
162
|
+
:rackspace_api_key => @rackspace_api_key,
|
163
|
+
:rackspace_username => @rackspace_username,
|
164
|
+
:rackspace_auth_url => @rackspace_auth_url
|
165
|
+
}
|
166
|
+
|
167
|
+
super(options)
|
168
|
+
end
|
136
169
|
end
|
137
170
|
end
|
138
171
|
end
|