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
@@ -13,6 +13,10 @@ module Fog
|
|
13
13
|
|
14
14
|
# Remove metadatum from server
|
15
15
|
# @return [Boolean] return true if metadatum is deleting
|
16
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
17
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
18
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
19
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
16
20
|
def destroy
|
17
21
|
requires :identity
|
18
22
|
connection.delete_metadata_item(collection_name, parent.id, key)
|
@@ -21,6 +25,10 @@ module Fog
|
|
21
25
|
|
22
26
|
# Save metadatum on server
|
23
27
|
# @return [Boolean] return true if metadatum is saving
|
28
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
29
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
30
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
31
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
24
32
|
def save
|
25
33
|
requires :identity, :value
|
26
34
|
connection.set_metadata_item(collection_name, parent.id, key, value)
|
@@ -180,6 +180,10 @@ module Fog
|
|
180
180
|
# * requires attributes: service:, :name, :image_id, and :flavor_id
|
181
181
|
# * optional attributes :disk_config, :metadata, :personality
|
182
182
|
# @return [Boolean] returns true if server is being created
|
183
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
184
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
185
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
186
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
183
187
|
# @note You should use servers.create to create servers instead calling this method directly
|
184
188
|
# @see Servers#create
|
185
189
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/CreateServers.html
|
@@ -207,6 +211,10 @@ module Fog
|
|
207
211
|
# This will update :name, :accessIPv4, and :accessIPv6 attributes.
|
208
212
|
# @note If you edit the server name, the server host name does not change. Also, server names are not guaranteed to be unique.
|
209
213
|
# @return true if update has started updating
|
214
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
215
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
216
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
217
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
210
218
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ServerUpdate.html
|
211
219
|
#
|
212
220
|
# * State Transition
|
@@ -226,11 +234,15 @@ module Fog
|
|
226
234
|
|
227
235
|
# Destroy the server
|
228
236
|
# @return [Boolean] returns true if server has started deleting
|
237
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
238
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
239
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
240
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
229
241
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Delete_Server-d1e2883.html
|
230
242
|
#
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
243
|
+
# * Status Transition:
|
244
|
+
# * ACTIVE -> DELETED
|
245
|
+
# * ERROR -> DELETED
|
234
246
|
def destroy
|
235
247
|
requires :identity
|
236
248
|
service.delete_server(identity)
|
@@ -239,6 +251,10 @@ module Fog
|
|
239
251
|
|
240
252
|
# Server flavor
|
241
253
|
# @return [Fog::Compute::RackspaceV2::Flavor] server flavor
|
254
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
255
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
256
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
257
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
242
258
|
def flavor
|
243
259
|
requires :flavor_id
|
244
260
|
@flavor ||= service.flavors.get(flavor_id)
|
@@ -246,6 +262,10 @@ module Fog
|
|
246
262
|
|
247
263
|
# Server image
|
248
264
|
# @return [Fog::Compute::RackspaceV2::Image] server image
|
265
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
266
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
267
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
268
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
249
269
|
def image
|
250
270
|
requires :image_id
|
251
271
|
@image ||= service.images.get(image_id)
|
@@ -256,11 +276,15 @@ module Fog
|
|
256
276
|
# @param options [Hash]:
|
257
277
|
# @option options [Hash<String, String>] metadata hash of containing metadata key value pairs.
|
258
278
|
# @return [Fog::ComputeRackspaceV2::Image] image being created
|
279
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
280
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
281
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
282
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
259
283
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Create_Image-d1e4655.html
|
260
284
|
#
|
261
|
-
#
|
262
|
-
#
|
263
|
-
#
|
285
|
+
# * State Transition:
|
286
|
+
# * SAVING -> ACTIVE
|
287
|
+
# * SAVING -> ERROR (on error)
|
264
288
|
def create_image(name, options = {})
|
265
289
|
requires :identity
|
266
290
|
response = service.create_image(identity, name, options)
|
@@ -274,6 +298,10 @@ module Fog
|
|
274
298
|
|
275
299
|
# Attached Cloud Block Volumes
|
276
300
|
# @return [Fog::Compute::RackspaceV2::Attachments] attached Cloud Block Volumes
|
301
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
302
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
303
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
304
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
277
305
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/List_Volume_Attachments.html
|
278
306
|
def attachments
|
279
307
|
@attachments ||= begin
|
@@ -288,6 +316,10 @@ module Fog
|
|
288
316
|
# @param [Fog::Rackspace::BlockStorage::Volume, String] volume object or the volume id of volume to mount
|
289
317
|
# @param [String] device name of the device /dev/xvd[a-p] (optional)
|
290
318
|
# @return [Fog::Compute::RackspaceV2::Attachment] resulting attachment object
|
319
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
320
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
321
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
322
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
291
323
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Attach_Volume_to_Server.html
|
292
324
|
def attach_volume(volume, device=nil)
|
293
325
|
requires :identity
|
@@ -311,17 +343,22 @@ module Fog
|
|
311
343
|
# @param [String] ready_state By default state is ACTIVE
|
312
344
|
# @param [Array,String] error_states By default state is ERROR
|
313
345
|
# @return [Boolean] returns true if server is in a ready state
|
314
|
-
# @raise [
|
346
|
+
# @raise [Fog::Compute::RackspaceV2::InvalidServerStateException] if server state is an error state
|
315
347
|
def ready?(ready_state = ACTIVE, error_states=[ERROR])
|
316
348
|
if error_states
|
317
349
|
error_states = Array(error_states)
|
318
|
-
raise
|
350
|
+
raise InvalidServerStateException.new(ready_state, state) if error_states.include?(state)
|
319
351
|
end
|
320
352
|
state == ready_state
|
321
353
|
end
|
322
354
|
|
323
355
|
# Reboot server
|
324
356
|
# @param [String<SOFT, HARD>] type 'SOFT' will do a soft reboot. 'HARD' will do a hard reboot.
|
357
|
+
# @return [Boolean] returns true if server is being rebooted
|
358
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
359
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
360
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
361
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
325
362
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Reboot_Server-d1e3371.html
|
326
363
|
#
|
327
364
|
# * State transition:
|
@@ -338,6 +375,10 @@ module Fog
|
|
338
375
|
# Rebuild removes all data on the server and replaces it with the specified image. The id and all IP addresses remain the same.
|
339
376
|
# @param [String] image_id image to use for rebuild
|
340
377
|
# @return [Boolean] returns true if rebuild is in process
|
378
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
379
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
380
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
381
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
341
382
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Rebuild_Server-d1e3538.html
|
342
383
|
#
|
343
384
|
# * Status Transition:
|
@@ -351,12 +392,16 @@ module Fog
|
|
351
392
|
end
|
352
393
|
|
353
394
|
# Resize existing server to a different flavor, in essence, scaling the server up or down. The original server is saved for a period of time to allow rollback if there is a problem. All resizes should be tested and explicitly confirmed, at which time the original server is removed. All resizes are automatically confirmed after 24 hours if they are not confirmed or reverted.
|
354
|
-
# @param [String]
|
395
|
+
# @param [String] flavor_id to resize
|
355
396
|
# @return [Boolean] returns true if resize is in process
|
397
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
398
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
399
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
400
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
356
401
|
# @note All resizes are automatically confirmed after 24 hours if you do not explicitly confirm or revert the resize.
|
357
402
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Resize_Server-d1e3707.html
|
358
403
|
# @see #confirm_resize
|
359
|
-
# @see #revert_resize
|
404
|
+
# @see #revert_resize
|
360
405
|
#
|
361
406
|
# * Status Transition:
|
362
407
|
# * ACTIVE -> QUEUE_RESIZE -> PREP_RESIZE -> VERIFY_RESIZE
|
@@ -369,13 +414,18 @@ module Fog
|
|
369
414
|
end
|
370
415
|
|
371
416
|
# Confirms server resize operation
|
417
|
+
# @return [Boolean] returns true if resize has been confirmed
|
418
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
419
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
420
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
421
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
372
422
|
# @note All resizes are automatically confirmed after 24 hours if you do not explicitly confirm or revert the resize.
|
373
423
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Confirm_Resized_Server-d1e3868.html
|
374
424
|
# @see #resize
|
375
425
|
#
|
376
426
|
# * Status Transition:
|
377
427
|
# * VERIFY_RESIZE -> ACTIVE
|
378
|
-
|
428
|
+
# * VERIFY_RESIZE -> ERROR (on error)å
|
379
429
|
def confirm_resize
|
380
430
|
requires :identity
|
381
431
|
service.confirm_resize_server(identity)
|
@@ -383,9 +433,14 @@ module Fog
|
|
383
433
|
end
|
384
434
|
|
385
435
|
# Reverts server resize operation
|
386
|
-
# @
|
436
|
+
# @return [Boolean] returns true if resize is being reverted
|
437
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
438
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
439
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
440
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
441
|
+
# @note All resizes are automatically confirmed after 24 hours if you do not explicitly confirm or revert the resize.
|
387
442
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Revert_Resized_Server-d1e4024.html
|
388
|
-
# @see #resize
|
443
|
+
# @see #resize
|
389
444
|
#
|
390
445
|
# * Status Transition:
|
391
446
|
# * VERIFY_RESIZE -> ACTIVE
|
@@ -399,6 +454,10 @@ module Fog
|
|
399
454
|
# Change admin password
|
400
455
|
# @param [String] password The administrator password.
|
401
456
|
# @return [Boolean] returns true if operation was scheduled
|
457
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
458
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
459
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
460
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
402
461
|
# @note Though Rackspace does not enforce complexity requirements for the password, the operating system might. If the password is not complex enough, the server might enter an ERROR state.
|
403
462
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Change_Password-d1e3234.html
|
404
463
|
#
|
@@ -10,7 +10,11 @@ module Fog
|
|
10
10
|
model Fog::Compute::RackspaceV2::Server
|
11
11
|
|
12
12
|
# Returns list of servers
|
13
|
-
# @return [
|
13
|
+
# @return [Fog::Compute::RackspaceV2::Servers] Retrieves a list servers.
|
14
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
15
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
16
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
17
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
14
18
|
# @note Fog's current implementation only returns 1000 servers
|
15
19
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/List_Servers-d1e2078.html
|
16
20
|
def all
|
@@ -19,6 +23,11 @@ module Fog
|
|
19
23
|
end
|
20
24
|
|
21
25
|
# Creates a new server and populates ssh keys
|
26
|
+
# @return [Fog::Compute::RackspaceV2::Server]
|
27
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
28
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
29
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
30
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
22
31
|
# @note This method is incompatible with Cloud Servers utlizing RackConnect. RackConnect users
|
23
32
|
# should use server personalization to install keys. Please see Server#personality for more information.
|
24
33
|
# @example
|
@@ -27,7 +36,8 @@ module Fog
|
|
27
36
|
# :image_id => service.images.find {|img| img.name =~ /Ubuntu/}.id,
|
28
37
|
# :public_key_path => '~/.ssh/fog_rsa.pub',
|
29
38
|
# :private_key_path => '~/.ssh/fog_rsa'
|
30
|
-
#
|
39
|
+
#
|
40
|
+
# @raise [Fog::Compute::RackspaceV2::InvalidServerStateException] if server state is an error state
|
31
41
|
def bootstrap(new_attributes = {})
|
32
42
|
server = create(new_attributes)
|
33
43
|
server.wait_for(1500) { ready? && !public_ip_address.empty? }
|
@@ -38,6 +48,10 @@ module Fog
|
|
38
48
|
# Retrieves server
|
39
49
|
# @param [String] server_id for server to be returned
|
40
50
|
# @return [Fog::Compute::RackspaceV2:Server]
|
51
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
52
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
53
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
54
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
41
55
|
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Get_Server_Details-d1e2623.html
|
42
56
|
def get(server_id)
|
43
57
|
data = service.get_server(server_id).body['server']
|
@@ -8,21 +8,17 @@ module Fog
|
|
8
8
|
|
9
9
|
model Fog::DNS::Rackspace::Zone
|
10
10
|
|
11
|
+
# List all domains. Return by default a maximum of 100 items
|
12
|
+
# @param [Hash] options Options to pass to the underlying API call
|
13
|
+
# @option options [String] :name search for domains containing the given substring
|
14
|
+
# @option options [Integer] :limit number of records to return
|
15
|
+
# @option options [Integer] :offset starting offset of records to return
|
11
16
|
def all(options={})
|
12
17
|
clear
|
13
18
|
data = service.list_domains(options).body['domains']
|
14
19
|
load(data)
|
15
20
|
end
|
16
21
|
|
17
|
-
# Returns all domains containing the given substring. Still limited
|
18
|
-
# by the 100-domain pagination limit. Returns an empty array if
|
19
|
-
# no matches.
|
20
|
-
def find(substring)
|
21
|
-
clear
|
22
|
-
data = service.list_domains(:name => substring).body['domains']
|
23
|
-
load(data)
|
24
|
-
end
|
25
|
-
|
26
22
|
alias :each_zone_this_page :each
|
27
23
|
def each
|
28
24
|
if !block_given?
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Rackspace
|
5
|
+
class Identity
|
6
|
+
class ServiceCatalog < Fog::Model
|
7
|
+
attr_reader :catalog
|
8
|
+
|
9
|
+
def initialize(attributes)
|
10
|
+
@service = attributes.delete(:service)
|
11
|
+
@catalog = {}
|
12
|
+
end
|
13
|
+
|
14
|
+
def services
|
15
|
+
catalog.keys
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_endpoints(service_type)
|
19
|
+
service_type = service_type.is_a?(String) ? service_type.to_sym : service_type
|
20
|
+
catalog[service_type]
|
21
|
+
end
|
22
|
+
|
23
|
+
def display_service_regions(service_type)
|
24
|
+
endpoints = get_endpoints(service_type)
|
25
|
+
endpoints.collect { |k,v| ":#{k}" }.join(", ")
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_endpoint(service_type, region=nil)
|
29
|
+
endpoint = get_endpoints(service_type)
|
30
|
+
raise "Unable to locate endpoint for service #{service_type}" unless endpoint
|
31
|
+
|
32
|
+
return endpoint if endpoint.is_a?(String) #There is only one endpoint for service
|
33
|
+
|
34
|
+
unless region
|
35
|
+
raise "There are multiple endpoints avaliable for #{service_type}. Please specify one of the following regions: #{display_service_regions(service_type)}."
|
36
|
+
end
|
37
|
+
region = region.is_a?(String) ? region.to_sym : region
|
38
|
+
endpoint = get_endpoints(service_type)[region]
|
39
|
+
raise "Unknown region :#{region} for service #{service_type}. Please use one of the following regions: #{display_service_regions(service_type)}" unless endpoint
|
40
|
+
endpoint
|
41
|
+
end
|
42
|
+
|
43
|
+
def reload
|
44
|
+
@service.authenticate
|
45
|
+
@catalog = @service.service_catalog.catalog
|
46
|
+
self
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.from_response(service, hash)
|
50
|
+
service_catalog = ServiceCatalog.new :service => service
|
51
|
+
services = hash["access"]["serviceCatalog"]
|
52
|
+
services.each do |serv|
|
53
|
+
name = serv["name"].to_sym
|
54
|
+
service_catalog.send(:add_endpoints, name, serv)
|
55
|
+
end
|
56
|
+
service_catalog
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def add_endpoints(service_name, hash)
|
62
|
+
endpoints = hash["endpoints"]
|
63
|
+
if endpoints.size == 1
|
64
|
+
catalog[service_name] = endpoints[0]["publicURL"].freeze
|
65
|
+
else
|
66
|
+
catalog[service_name] = endpoints_from_array(endpoints)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def endpoints_from_array(endpoints)
|
71
|
+
hash = {}
|
72
|
+
endpoints.each do |endpoint|
|
73
|
+
region = endpoint["region"].downcase.to_sym
|
74
|
+
url = endpoint["publicURL"].freeze
|
75
|
+
hash[region] = url
|
76
|
+
end
|
77
|
+
hash
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -4,16 +4,42 @@ module Fog
|
|
4
4
|
module Storage
|
5
5
|
class Rackspace
|
6
6
|
class Account < Fog::Model
|
7
|
+
# @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/View_Account_Info-d1e11995.html
|
8
|
+
|
9
|
+
# @!attribute [rw] meta_temp_url_key
|
10
|
+
# @return [String] The temporary URL key used to generate temporary access to files
|
11
|
+
# @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Create_TempURL-d1a444.html
|
7
12
|
attribute :meta_temp_url_key, :aliases => 'X-Account-Meta-Temp-Url-Key'
|
13
|
+
|
14
|
+
# @!attribute [r] container_count
|
15
|
+
# @return [Integer] The number of containers in account
|
8
16
|
attribute :container_count, :aliases => 'X-Account-Container-Count', :type => :integer
|
17
|
+
|
18
|
+
# @!attribute [r] bytes_used
|
19
|
+
# @return [Integer] The total number of bytes used by the account
|
9
20
|
attribute :bytes_used, :aliases => 'X-Account-Bytes-Used', :type => :integer
|
21
|
+
|
22
|
+
# @!attribute [r] object_count
|
23
|
+
# @return [Integer] The total number of objects in the account
|
10
24
|
attribute :object_count, :aliases => 'X-Account-Object-Count', :type => :integer
|
11
25
|
|
26
|
+
# Saves account settings (meta_temp_url_key)
|
27
|
+
# @return [Boolean] returns true if successfully updated
|
28
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
29
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
30
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
31
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
12
32
|
def save
|
13
33
|
service.post_set_meta_temp_url_key meta_temp_url_key
|
14
34
|
true
|
15
35
|
end
|
16
36
|
|
37
|
+
# Reload account with latest data from Cloud Files
|
38
|
+
# @return [Fog::Storage::Rackspace::Account] returns itself
|
39
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
40
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
41
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
42
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
17
43
|
def reload
|
18
44
|
response = service.head_containers
|
19
45
|
merge_attributes response.headers
|
@@ -9,15 +9,35 @@ module Fog
|
|
9
9
|
|
10
10
|
model Fog::Storage::Rackspace::Directory
|
11
11
|
|
12
|
+
# Returns list of directories
|
13
|
+
# @return [Fog::Storage::Rackspace::Directories] Retrieves a list directories.
|
14
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
15
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
16
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
17
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
18
|
+
# @note Fog's current implementation only returns 10,000 directories
|
19
|
+
# @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/View_List_of_Containers-d1e1100.html
|
12
20
|
def all
|
13
21
|
data = service.get_containers.body
|
14
22
|
load(data)
|
15
23
|
end
|
16
24
|
|
17
|
-
#
|
25
|
+
# Retrieves directory
|
26
|
+
# @param [String] key of directory
|
27
|
+
# @param options [Hash]:
|
28
|
+
# @option options [String] cdn_cname CDN CNAME used when calling Directory#public_url
|
29
|
+
# @return [Fog::Storage::Rackspace::Directory]
|
30
|
+
# @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
|
31
|
+
# @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
|
32
|
+
# @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
|
33
|
+
# @raise [Fog::Rackspace::Errors::ServiceError]
|
34
|
+
# @example
|
35
|
+
# directory = fog.directories.get('video', :cdn_cname => 'http://cdn.lunenburg.org')
|
36
|
+
# files = directory.files
|
37
|
+
# files.first.public_url
|
18
38
|
#
|
19
|
-
#
|
20
|
-
#
|
39
|
+
# @see Directory#public_url
|
40
|
+
# @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/View-Container_Info-d1e1285.html
|
21
41
|
def get(key, options = {})
|
22
42
|
data = service.get_container(key, options)
|
23
43
|
directory = new(:key => key, :cdn_cname => options[:cdn_cname])
|