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
@@ -0,0 +1,417 @@
|
|
1
|
+
#Cloud Block Storage (BlockStorage)
|
2
|
+
|
3
|
+
This document explains how to get started using Cloud Block Storage with Fog. It assumes you have read the [Getting Started with Fog and the Rackspace Open Cloud](getting_started.md) document.
|
4
|
+
|
5
|
+
## Starting irb console
|
6
|
+
Start by executing the following command:
|
7
|
+
|
8
|
+
irb
|
9
|
+
|
10
|
+
Once `irb` has launched you need to require the Fog library.
|
11
|
+
|
12
|
+
If using Ruby 1.8.x execute:
|
13
|
+
|
14
|
+
require 'rubygems'
|
15
|
+
require 'fog'
|
16
|
+
|
17
|
+
If using Ruby 1.9.x execute:
|
18
|
+
|
19
|
+
require 'fog'
|
20
|
+
|
21
|
+
## Create Service
|
22
|
+
|
23
|
+
Next, create a connection to Cloud Block Storage:
|
24
|
+
|
25
|
+
Using a US-based account:
|
26
|
+
|
27
|
+
service = Fog::Rackspace::BlockStorage.new({
|
28
|
+
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
|
29
|
+
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
|
30
|
+
:rackspace_region => :ord, # Defaults to :dfw
|
31
|
+
:connection_options => {} # Optional
|
32
|
+
})
|
33
|
+
|
34
|
+
Using a UK-based account:
|
35
|
+
|
36
|
+
service = Fog::Rackspace::BlockStorage.new({
|
37
|
+
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
|
38
|
+
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
|
39
|
+
:rackspace_auth_url => Fog::Rackspace::UK_AUTH_ENDPOINT,
|
40
|
+
:rackspace_region => :lon,
|
41
|
+
:connection_options => {} # Optional
|
42
|
+
})
|
43
|
+
|
44
|
+
To learn more about obtaining cloud credentials refer to the [Getting Started with Fog and the Rackspace Open Cloud](getting_started.md) document.
|
45
|
+
|
46
|
+
By default `Fog::Rackspace::BlockStorage` will authenticate against the US authentication endpoint and connect to the DFW region. You can specify alternative authentication endpoints using the key `:rackspace_auth_url`. Please refer to [Alternate Authentication Endpoints](http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/content/Endpoints-d1e180.html) for a list of alternative Rackspace authentication endpoints.
|
47
|
+
|
48
|
+
Alternative regions are specified using the key `:rackspace_region `. A list of regions available for Cloud Block Storage can be found by executing the following:
|
49
|
+
|
50
|
+
identity_service = Fog::Identity({
|
51
|
+
:provider => 'Rackspace', # Rackspace Fog provider
|
52
|
+
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
|
53
|
+
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
|
54
|
+
:rackspace_auth_url => Fog::Rackspace::UK_AUTH_ENDPOINT # Not specified for US Cloud
|
55
|
+
})
|
56
|
+
|
57
|
+
identity_service.service_catalog.display_service_regions :cloudBlockStorage
|
58
|
+
|
59
|
+
Rackspace Private Cloud installations can skip specifying a region and directly specify their custom service endpoints using the key `:rackspace_block_storage_url`.
|
60
|
+
|
61
|
+
**Note**: A`Fog::Rackspace::BlockStorage` instance is needed for the desired region.
|
62
|
+
|
63
|
+
### Optional Connection Parameters
|
64
|
+
|
65
|
+
Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using the `:connection_options` parameter.
|
66
|
+
|
67
|
+
<table>
|
68
|
+
<tr>
|
69
|
+
<th>Key</th>
|
70
|
+
<th>Description</th>
|
71
|
+
</tr>
|
72
|
+
<tr>
|
73
|
+
<td>:connect_timeout</td>
|
74
|
+
<td>Connection timeout (default: 60 seconds)</td>
|
75
|
+
</tr>
|
76
|
+
<tr>
|
77
|
+
<td>:read_timeout</td>
|
78
|
+
<td>Read timeout for connection (default: 60 seconds)</td> </tr>
|
79
|
+
<tr>
|
80
|
+
<td>:write_timeout</td>
|
81
|
+
<td>Write timeout for connection (default: 60 seconds)</td>
|
82
|
+
</tr>
|
83
|
+
<tr>
|
84
|
+
<td>:proxy</td>
|
85
|
+
<td>Proxy for HTTP and HTTPS connections</td>
|
86
|
+
</tr>
|
87
|
+
<tr>
|
88
|
+
<td>:ssl_ca_path</td>
|
89
|
+
<td>Path to SSL certificate authorities</td>
|
90
|
+
</tr>
|
91
|
+
<tr>
|
92
|
+
<td>:ssl_ca_file</td>
|
93
|
+
<td>SSL certificate authority file</td>
|
94
|
+
</tr>
|
95
|
+
<tr>
|
96
|
+
<td>:ssl_verify_peer</td>
|
97
|
+
<td>SSL verify peer (default: true)</td>
|
98
|
+
</tr>
|
99
|
+
</table>
|
100
|
+
|
101
|
+
|
102
|
+
## Fog Abstractions
|
103
|
+
|
104
|
+
Fog provides both a **model** and **request** abstraction. The request abstraction provides the most efficient interface and the model abstraction wraps the request abstraction to provide a convenient `ActiveModel` like interface.
|
105
|
+
|
106
|
+
### Request Layer
|
107
|
+
|
108
|
+
The request abstraction maps directly to the [Cloud Block Storage API](http://docs.rackspace.com/cbs/api/v1.0/cbs-devguide/content/overview.html). It provides the most efficient interface to the Rackspace Open Cloud.
|
109
|
+
|
110
|
+
To see a list of requests supported by the service:
|
111
|
+
|
112
|
+
service.requests
|
113
|
+
|
114
|
+
This returns:
|
115
|
+
|
116
|
+
:create_volume, :delete_volume, :get_volume, :list_volumes, :get_volume_type, :list_volume_types, :create_snapshot, :delete_snapshot, :get_snapshot, :list_snapshots
|
117
|
+
|
118
|
+
|
119
|
+
#### Example Request
|
120
|
+
|
121
|
+
To request a list of volume types:
|
122
|
+
|
123
|
+
response = service.list_volume_types
|
124
|
+
|
125
|
+
This returns in the following `Excon::Response`:
|
126
|
+
|
127
|
+
<Excon::Response:0x10a708fb8 @remote_ip="72.32.164.210", @body="{\"volume_types\": [{\"extra_specs\": {}, \"name\": \"SATA\", \"id\": 1}, {\"extra_specs\": {}, \"name\": \"SSD\", \"id\": 2}]}", @status=200, @headers={"Date"=>"Mon, 18 Mar 2013 20:26:03 GMT", "Content-Length"=>"109", "Content-Type"=>"application/json", "X-Compute-Request-Id"=>"req-9c2093d4-8a41-4d8b-a069-114470d1a0dd"}, @data={:status=>200, :headers=>{"Date"=>"Mon, 18 Mar 2013 20:26:03 GMT", "Content-Length"=>"109", "Content-Type"=>"application/json", "X-Compute-Request-Id"=>"req-9c2093d4-8a41-4d8b-a069-114470d1a0dd"}, :remote_ip=>"72.32.164.210", :body=>{"volume_types"=>[{"name"=>"SATA", "id"=>1, "extra_specs"=>{}}, {"name"=>"SSD", "id"=>2, "extra_specs"=>{}}]}}>
|
128
|
+
|
129
|
+
To view the status of the response:
|
130
|
+
|
131
|
+
response.status
|
132
|
+
|
133
|
+
**Note**: Fog is aware of valid HTTP response statuses for each request type. If an unexpected HTTP response status occurs, Fog will raise an exception.
|
134
|
+
|
135
|
+
To view response body:
|
136
|
+
|
137
|
+
response.body
|
138
|
+
|
139
|
+
This will return:
|
140
|
+
|
141
|
+
{"volume_types"=>[{"name"=>"SATA", "id"=>1, "extra_specs"=>{}}, {"name"=>"SSD", "id"=>2, "extra_specs"=>{}}]}
|
142
|
+
|
143
|
+
|
144
|
+
To learn more about Cloud Block Storage request methods refer to [rdoc](http://rubydoc.info/gems/fog/Fog/Rackspace/BlockStorage/Real). To learn more about Excon refer to [Excon GitHub repo](https://github.com/geemus/excon).
|
145
|
+
|
146
|
+
### Model Layer
|
147
|
+
|
148
|
+
Fog models behave in a manner similar to `ActiveModel`. Models will generally respond to `create`, `save`, `persisted?`, `destroy`, `reload` and `attributes` methods. Additionally, fog will automatically create attribute accessors.
|
149
|
+
|
150
|
+
Here is a summary of common model methods:
|
151
|
+
|
152
|
+
<table>
|
153
|
+
<tr>
|
154
|
+
<th>Method</th>
|
155
|
+
<th>Description</th>
|
156
|
+
</tr>
|
157
|
+
<tr>
|
158
|
+
<td>create</td>
|
159
|
+
<td>
|
160
|
+
Accepts hash of attributes and creates object.<br>
|
161
|
+
Note: creation is a non-blocking call and you will be required to wait for a valid state before using resulting object.
|
162
|
+
</td>
|
163
|
+
</tr>
|
164
|
+
<tr>
|
165
|
+
<td>save</td>
|
166
|
+
<td>Saves object.<br>
|
167
|
+
Note: not all objects support updating object.</td>
|
168
|
+
</tr>
|
169
|
+
<tr>
|
170
|
+
<td>persisted?</td>
|
171
|
+
<td>Returns true if the object has been persisted.</td>
|
172
|
+
</tr>
|
173
|
+
<tr>
|
174
|
+
<td>destroy</td>
|
175
|
+
<td>
|
176
|
+
Destroys object.<br>
|
177
|
+
Note: this is a non-blocking call and object deletion might not be instantaneous.
|
178
|
+
</td>
|
179
|
+
<tr>
|
180
|
+
<td>reload</td>
|
181
|
+
<td>Updates object with latest state from service.</td>
|
182
|
+
<tr>
|
183
|
+
<td>ready?</td>
|
184
|
+
<td>Returns true if object is in a ready state and able to perform actions. This method will raise an exception if object is in an error state.</td>
|
185
|
+
</tr>
|
186
|
+
<tr>
|
187
|
+
<td>attributes</td>
|
188
|
+
<td>Returns a hash containing the list of model attributes and values.</td>
|
189
|
+
</tr>
|
190
|
+
<td>identity</td>
|
191
|
+
<td>
|
192
|
+
Returns the identity of the object.<br>
|
193
|
+
Note: This might not always be equal to object.id.
|
194
|
+
</td>
|
195
|
+
</tr>
|
196
|
+
<tr>
|
197
|
+
<td>wait_for</td>
|
198
|
+
<td>This method periodically reloads model and then yields to specified block until block returns true or a timeout occurs.</td>
|
199
|
+
</tr>
|
200
|
+
</table>
|
201
|
+
|
202
|
+
The remainder of this document details the model abstraction.
|
203
|
+
|
204
|
+
|
205
|
+
## List Volume Types
|
206
|
+
|
207
|
+
To retrieve a list of volume types:
|
208
|
+
|
209
|
+
service.volume_types
|
210
|
+
|
211
|
+
This returns a collection of `Fog::Rackspace::BlockStorage::VolumeType` models:
|
212
|
+
|
213
|
+
<Fog::Rackspace::BlockStorage::VolumeTypes
|
214
|
+
[
|
215
|
+
<Fog::Rackspace::BlockStorage::VolumeType
|
216
|
+
id=1,
|
217
|
+
name="SATA",
|
218
|
+
extra_specs={}
|
219
|
+
>,
|
220
|
+
<Fog::Rackspace::BlockStorage::VolumeType
|
221
|
+
id=2,
|
222
|
+
name="SSD",
|
223
|
+
extra_specs={}
|
224
|
+
>
|
225
|
+
]
|
226
|
+
>
|
227
|
+
|
228
|
+
## List Volumes
|
229
|
+
|
230
|
+
To retrieve a list of volumes:
|
231
|
+
|
232
|
+
service.volumes
|
233
|
+
|
234
|
+
This returns a collection of `Fog::Rackspace::BlockStorage::Volume` models:
|
235
|
+
|
236
|
+
<Fog::Rackspace::BlockStorage::Volumes
|
237
|
+
[
|
238
|
+
<Fog::Rackspace::BlockStorage::Volume
|
239
|
+
id="a53a532f-546c-4da3-8c2d-b26be1046630",
|
240
|
+
created_at="2013-03-19T14:19:16.000000",
|
241
|
+
state="available",
|
242
|
+
display_name="fog-ssd",
|
243
|
+
display_description=nil,
|
244
|
+
size=100,
|
245
|
+
attachments=[],
|
246
|
+
volume_type="SSD",
|
247
|
+
availability_zone="nova"
|
248
|
+
>,
|
249
|
+
<Fog::Rackspace::BlockStorage::Volume
|
250
|
+
id="e2359473-9933-483f-90df-deb4a9fb25ae",
|
251
|
+
created_at="2013-03-19T14:16:45.000000",
|
252
|
+
state="available",
|
253
|
+
display_name="fog-example",
|
254
|
+
display_description=nil,
|
255
|
+
size=100,
|
256
|
+
attachments=[],
|
257
|
+
volume_type="SATA",
|
258
|
+
availability_zone="nova"
|
259
|
+
>
|
260
|
+
]
|
261
|
+
>
|
262
|
+
|
263
|
+
## Get Volume
|
264
|
+
|
265
|
+
To retrieve an individual volume:
|
266
|
+
|
267
|
+
service.volume.get "fog-example"
|
268
|
+
|
269
|
+
This returns a `Fog::Rackspace::BlockStorage::Volume`:
|
270
|
+
|
271
|
+
<Fog::Rackspace::BlockStorage::Volume
|
272
|
+
id="e2359473-9933-483f-90df-deb4a9fb25ae",
|
273
|
+
created_at="2013-03-19T14:16:45.000000",
|
274
|
+
state="available",
|
275
|
+
display_name="fog-example",
|
276
|
+
display_description=nil,
|
277
|
+
size=100,
|
278
|
+
attachments=[],
|
279
|
+
volume_type="SATA",
|
280
|
+
availability_zone="nova"
|
281
|
+
>
|
282
|
+
|
283
|
+
## Create Volume
|
284
|
+
|
285
|
+
To create a volume:
|
286
|
+
|
287
|
+
volume = service.volumes.create(:size => 100, :display_name => 'fog-ssd', :volume_type => 'SSD')
|
288
|
+
|
289
|
+
This will return a `Fog::Rackspace::BlockStorage::Volume`:
|
290
|
+
|
291
|
+
<Fog::Rackspace::BlockStorage::Volume
|
292
|
+
id="a53a532f-546c-4da3-8c2d-b26be1046630",
|
293
|
+
created_at="2013-03-19T14:19:16.000000",
|
294
|
+
state="available",
|
295
|
+
display_name="fog-ssd",
|
296
|
+
display_description=nil,
|
297
|
+
size=100,
|
298
|
+
attachments=[],
|
299
|
+
volume_type="SSD",
|
300
|
+
availability_zone="nova"
|
301
|
+
>
|
302
|
+
|
303
|
+
**Note**: The `:size` parameter is the only required parameter and is in gigabytes. Volumes must be a minimum of 100 GB.
|
304
|
+
|
305
|
+
### Additional Parameters
|
306
|
+
|
307
|
+
The `create` method also supports the following key values:
|
308
|
+
|
309
|
+
<table>
|
310
|
+
<tr>
|
311
|
+
<th>Key</th>
|
312
|
+
<th>Description</th>
|
313
|
+
</tr>
|
314
|
+
<tr>
|
315
|
+
<td>:display_name</td>
|
316
|
+
<td>The name of the volume.</td>
|
317
|
+
</tr>
|
318
|
+
<tr>
|
319
|
+
<td>:display_description</td>
|
320
|
+
<td>A description of the volume.</td>
|
321
|
+
</tr>
|
322
|
+
<tr>
|
323
|
+
<td>:snapshot_id</td>
|
324
|
+
<td>The optional snapshot from which to create a volume.</td>
|
325
|
+
</tr>
|
326
|
+
<tr>
|
327
|
+
<td>:volume_type</td>
|
328
|
+
<td>The type of volume to create. Refer to <a href="#list-volume-types">List Volume Types</a> section for valid types. SATA is the default volume type.</td>
|
329
|
+
</tr>
|
330
|
+
</table>
|
331
|
+
|
332
|
+
## Attach Volume
|
333
|
+
|
334
|
+
Please refer to the [Attach Volume](compute_v2.md#attach-volume) section in the [Next Generation Cloud Servers™ (compute_v2)](compute_v2.md) documentation.
|
335
|
+
|
336
|
+
## Detach Volume
|
337
|
+
|
338
|
+
Please refer to the [Detach Volume](compute_v2.md#detach-volume) section in the [Next Generation Cloud Servers™ (compute_v2)](compute_v2.md) documentation.
|
339
|
+
|
340
|
+
|
341
|
+
## Delete Volume
|
342
|
+
|
343
|
+
To delete a volume:
|
344
|
+
|
345
|
+
volume.destroy
|
346
|
+
|
347
|
+
**Note**: You cannot delete a volume until all of its dependent snapshots have been deleted.
|
348
|
+
|
349
|
+
## List Snapshots
|
350
|
+
|
351
|
+
To retrieve a list of snapshots:
|
352
|
+
|
353
|
+
service.snapshots
|
354
|
+
|
355
|
+
To retrieve a list of snapshots for a given volume:
|
356
|
+
|
357
|
+
volume.snapshots
|
358
|
+
|
359
|
+
## Create Snapshot
|
360
|
+
|
361
|
+
A snapshot is a point-in-time copy of a volume. Each subsequent snapshot will be the difference between the previous snapshot and the current volume.
|
362
|
+
|
363
|
+
To create a snapshot of a given volume:
|
364
|
+
|
365
|
+
volume.create_snapshot :display_name => 'initial-snapshot'
|
366
|
+
|
367
|
+
**Note**: All writes to the volume should be flushed before creating the snapshot, either by unmounting any file systems on the volume or by detaching the volume.
|
368
|
+
|
369
|
+
### Additional Parameters
|
370
|
+
|
371
|
+
The `create_snapshot` method also supports the following key values:
|
372
|
+
|
373
|
+
<table>
|
374
|
+
<tr>
|
375
|
+
<th>Key</th>
|
376
|
+
<th>Description</th>
|
377
|
+
</tr>
|
378
|
+
<tr>
|
379
|
+
<td>:display_name</td>
|
380
|
+
<td>The name of the snapshot.</td>
|
381
|
+
</tr>
|
382
|
+
<tr>
|
383
|
+
<td>:display_description</td>
|
384
|
+
<td>A description of the snapshot.</td>
|
385
|
+
</tr>
|
386
|
+
<tr>
|
387
|
+
<td>:force</td>
|
388
|
+
<td>If set to true, snapshot will be taken even if volume is still mounted.</td>
|
389
|
+
</tr>
|
390
|
+
</table>
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
## Delete Snapshot
|
395
|
+
|
396
|
+
To delete a snapshot:
|
397
|
+
|
398
|
+
snapshot.destroy
|
399
|
+
|
400
|
+
## Examples
|
401
|
+
|
402
|
+
Example code using Cloud Block Storage can be found [here](https://github.com/fog/fog/tree/master/lib/fog/rackspace/examples).
|
403
|
+
|
404
|
+
## Additional Resources
|
405
|
+
|
406
|
+
* [fog.io](http://fog.io/)
|
407
|
+
* [Fog rdoc](http://rubydoc.info/gems/fog/)
|
408
|
+
* [Fog Github repo](https://github.com/fog/fog)
|
409
|
+
* [Fog Github Issues](https://github.com/fog/fog/issues)
|
410
|
+
* [Excon Github repo](https://github.com/geemus/excon)
|
411
|
+
* [Cloud Block Storage API](http://docs.rackspace.com/cbs/api/v1.0/cbs-devguide/content/index.html)
|
412
|
+
|
413
|
+
## Support and Feedback
|
414
|
+
|
415
|
+
Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues).
|
416
|
+
|
417
|
+
For general feedback and support requests, send an email to: <sdk-support@rackspace.com>.
|
@@ -1,9 +1,11 @@
|
|
1
1
|
#Next Generation Cloud Servers™ (compute_v2)
|
2
2
|
|
3
|
-
This document explains how to get started using Next
|
3
|
+
This document explains how to get started using Next Generation Cloud Servers with Fog. It assumes you have read the [Getting Started with Fog and the Rackspace Open Cloud](getting_started.md) document.
|
4
4
|
|
5
|
+
**Note**: Fog also provides an interface to First Gen Cloud Servers™ (compute). The compute interface is deprecated and should only be used if you need to interact with our first generation cloud. Fog determines the appropriate interface based on the `:version` parameter. See [Create Service](#create-service) section for more information.
|
5
6
|
|
6
7
|
## Starting irb console
|
8
|
+
|
7
9
|
Start by executing the following command:
|
8
10
|
|
9
11
|
irb
|
@@ -20,44 +22,54 @@ If using Ruby 1.9.x execute:
|
|
20
22
|
require 'fog'
|
21
23
|
|
22
24
|
## Create Service
|
23
|
-
|
25
|
+
|
26
|
+
Next, create a connection to the Next Gen Cloud Servers:
|
27
|
+
|
28
|
+
Using a US-based account:
|
24
29
|
|
25
30
|
service = Fog::Compute.new({
|
26
31
|
:provider => 'Rackspace', # Rackspace Fog provider
|
27
32
|
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
|
28
33
|
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
|
29
|
-
|
30
|
-
|
31
|
-
|
34
|
+
:version => :v2, # Use Next Gen Cloud Servers
|
35
|
+
:rackspace_region => :ord, # Defaults to :dfw
|
36
|
+
:connection_options => {} # Optional
|
32
37
|
})
|
33
38
|
|
34
|
-
|
39
|
+
Using a UK-based account:
|
35
40
|
|
36
|
-
|
41
|
+
service = Fog::Compute.new({
|
42
|
+
:provider => 'Rackspace', # Rackspace Fog provider
|
43
|
+
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
|
44
|
+
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
|
45
|
+
:version => :v2, # Use Next Gen Cloud Servers
|
46
|
+
:rackspace_auth_url => Fog::Rackspace::UK_AUTH_ENDPOINT,
|
47
|
+
:rackspace_region => :lon,
|
48
|
+
:connection_options => {} # Optional
|
49
|
+
})
|
37
50
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
</table>
|
51
|
+
To learn more about obtaining cloud credentials refer to the [Getting Started with Fog and the Rackspace Open Cloud](getting_started.md) document.
|
52
|
+
|
53
|
+
By default `Fog::Compute` will authenticate against the US authentication endpoint and connect to the DFW region. You can specify alternative authentication endpoints using the key `:rackspace_auth_url`. Please refer to [Alternate Authentication Endpoints](http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/content/Endpoints-d1e180.html) for a list of alternative Rackspace authentication endpoints.
|
54
|
+
|
55
|
+
Alternative regions are specified using the key `:rackspace_region `. A list of regions available for Cloud Servers can be found by executing the following:
|
56
|
+
|
57
|
+
identity_service = Fog::Identity({
|
58
|
+
:provider => 'Rackspace', # Rackspace Fog provider
|
59
|
+
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
|
60
|
+
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
|
61
|
+
:rackspace_auth_url => Fog::Rackspace::UK_AUTH_ENDPOINT # Not specified for US Cloud
|
62
|
+
})
|
63
|
+
|
64
|
+
identity_service.service_catalog.display_service_regions :cloudServersOpenStack
|
65
|
+
|
66
|
+
Rackspace Private Cloud installations can skip specifying a region and directly specify their custom service endpoints using the key `:rackspace_compute_url`.
|
55
67
|
|
56
|
-
**Note**:
|
68
|
+
**Note**: A`Fog::Compute` instance is needed for the desired region.
|
57
69
|
|
58
70
|
### Optional Connection Parameters
|
59
71
|
|
60
|
-
Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using
|
72
|
+
Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using the `:connection_options` parameter.
|
61
73
|
|
62
74
|
<table>
|
63
75
|
<tr>
|
@@ -95,10 +107,12 @@ Fog supports passing additional connection parameters to its underlying HTTP lib
|
|
95
107
|
|
96
108
|
|
97
109
|
## Fog Abstractions
|
110
|
+
|
98
111
|
Fog provides both a **model** and **request** abstraction. The request abstraction provides the most efficient interface and the model abstraction wraps the request abstraction to provide a convenient `ActiveModel` like interface.
|
99
112
|
|
100
113
|
### Request Layer
|
101
|
-
|
114
|
+
|
115
|
+
The request abstraction maps directly to the [Next Gen Cloud Servers API](http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_preface.html). It provides the most efficient interface to the Rackspace Open Cloud.
|
102
116
|
|
103
117
|
To see a list of requests supported by the service:
|
104
118
|
|
@@ -106,7 +120,7 @@ To see a list of requests supported by the service:
|
|
106
120
|
|
107
121
|
This returns:
|
108
122
|
|
109
|
-
:list_servers, :get_server, :create_server, :update_server, :delete_server, :change_server_password, :reboot_server, :rebuild_server, :resize_server, :confirm_resize_server, :revert_resize_server, :list_images, :get_image, :list_flavors, :get_flavor, :attach_volume, :get_attachment, :list_attachments, :delete_attachment
|
123
|
+
:list_servers, :get_server, :create_server, :update_server, :delete_server, :change_server_password, :reboot_server, :rebuild_server, :resize_server, :confirm_resize_server, :revert_resize_server, :list_images, :get_image, :list_flavors, :get_flavor, :attach_volume, :get_attachment, :list_attachments, :delete_attachment
|
110
124
|
|
111
125
|
|
112
126
|
#### Example Request
|
@@ -123,20 +137,21 @@ To view the status of the response:
|
|
123
137
|
|
124
138
|
response.status
|
125
139
|
|
126
|
-
**Note**:
|
140
|
+
**Note**: Fog is aware of valid HTTP response statuses for each request type. If an unexpected HTTP response status occurs, Fog will raise an exception.
|
127
141
|
|
128
142
|
To view response body:
|
129
143
|
|
130
|
-
|
144
|
+
response.body
|
131
145
|
|
132
146
|
This will return:
|
133
147
|
|
134
148
|
{"flavors"=>[{"id"=>"2", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/2", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/2", "rel"=>"bookmark"}], "name"=>"512MB Standard Instance"}, {"id"=>"3", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/3", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/3", "rel"=>"bookmark"}], "name"=>"1GB Standard Instance"}, {"id"=>"4", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/4", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/4", "rel"=>"bookmark"}], "name"=>"2GB Standard Instance"}, {"id"=>"5", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/5", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/5", "rel"=>"bookmark"}], "name"=>"4GB Standard Instance"}, {"id"=>"6", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/6", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/6", "rel"=>"bookmark"}], "name"=>"8GB Standard Instance"}, {"id"=>"7", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/7", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/7", "rel"=>"bookmark"}], "name"=>"15GB Standard Instance"}, {"id"=>"8", "links"=>[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/flavors/8", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/flavors/8", "rel"=>"bookmark"}], "name"=>"30GB Standard Instance"}]}
|
135
149
|
|
136
150
|
|
137
|
-
To learn more about Compute request methods refer to [rdoc](http://rubydoc.info/gems/fog/Fog/Compute/Rackspace/Real
|
151
|
+
To learn more about Compute request methods refer to [rdoc](http://rubydoc.info/gems/fog/Fog/Compute/Rackspace/Real). To learn more about Excon refer to [Excon GitHub repo](https://github.com/geemus/excon).
|
138
152
|
|
139
153
|
### Model Layer
|
154
|
+
|
140
155
|
Fog models behave in a manner similar to `ActiveModel`. Models will generally respond to `create`, `save`, `persisted?`, `destroy`, `reload` and `attributes` methods. Additionally, fog will automatically create attribute accessors.
|
141
156
|
|
142
157
|
Here is a summary of common model methods:
|
@@ -150,7 +165,7 @@ Here is a summary of common model methods:
|
|
150
165
|
<td>create</td>
|
151
166
|
<td>
|
152
167
|
Accepts hash of attributes and creates object.<br>
|
153
|
-
Note: creation is a non
|
168
|
+
Note: creation is a non-blocking call and you will be required to wait for a valid state before using resulting object.
|
154
169
|
</td>
|
155
170
|
</tr>
|
156
171
|
<tr>
|
@@ -166,7 +181,7 @@ Here is a summary of common model methods:
|
|
166
181
|
<td>destroy</td>
|
167
182
|
<td>
|
168
183
|
Destroys object.<br>
|
169
|
-
Note: this is a non
|
184
|
+
Note: this is a non-blocking call and object deletion might not be instantaneous.
|
170
185
|
</td>
|
171
186
|
<tr>
|
172
187
|
<td>reload</td>
|
@@ -235,7 +250,7 @@ This returns a collection of `Fog::Compute::RackspaceV2::Image` models:
|
|
235
250
|
>,
|
236
251
|
…
|
237
252
|
|
238
|
-
**Note**:
|
253
|
+
**Note**: In order to speed up access `service.images` does not retrieve all attribute values. To retrieve additional details you will either need to `reload` each individual image or use the request abstraction.
|
239
254
|
|
240
255
|
## Get Image
|
241
256
|
|
@@ -261,8 +276,7 @@ This returns an `Fog::Compute::RackspaceV2::Image` instance:
|
|
261
276
|
links=[{"href"=>"https://ord.servers.api.rackspacecloud.com/v2/772045/images/8a3a9f96-b997-46fd-b7a8-a9e740796ffd", "rel"=>"self"}, {"href"=>"https://ord.servers.api.rackspacecloud.com/772045/images/8a3a9f96-b997-46fd-b7a8-a9e740796ffd", "rel"=>"bookmark"}, {"href"=>"https://ord.images.api.rackspacecloud.com/772045/images/8a3a9f96-b997-46fd-b7a8-a9e740796ffd", "type"=>"application/vnd.openstack.image", "rel"=>"alternate"}]
|
262
277
|
>
|
263
278
|
|
264
|
-
**Note**:
|
265
|
-
|
279
|
+
**Note**: This request populates all Image attributes.
|
266
280
|
|
267
281
|
## List Flavors
|
268
282
|
|
@@ -292,7 +306,7 @@ This returns a collection of `Fog::Compute::RackspaceV2::Flavor` models:
|
|
292
306
|
>,
|
293
307
|
…
|
294
308
|
|
295
|
-
**Note**:
|
309
|
+
**Note**: In order to speed up access `service.flavors` does not retrieve all attribute values. To retrieve additional details you will either need to `reload` each individual flavor or use the request abstraction.
|
296
310
|
|
297
311
|
|
298
312
|
## Get Flavor
|
@@ -312,7 +326,7 @@ This returns a `Fog::Compute::RackspaceV2::Flavor` instance:
|
|
312
326
|
links=[{"href"=>"https://dfw.servers.api.rackspacecloud.com/v2/772045/flavors/2", "rel"=>"self"}, {"href"=>"https://dfw.servers.api.rackspacecloud.com/772045/flavors/2", "rel"=>"bookmark"}]
|
313
327
|
>
|
314
328
|
|
315
|
-
**Note**:
|
329
|
+
**Note**: This request populates all Flavor attributes.
|
316
330
|
|
317
331
|
|
318
332
|
## List Servers
|
@@ -383,12 +397,16 @@ This returns a `Fog::Compute::RackspaceV2::Server` instance:
|
|
383
397
|
|
384
398
|
## Create Server
|
385
399
|
|
400
|
+
If you are interested in creating a server utilizing ssh key authenication, you are recommended to use [bootstrap](#bootstrap) method.
|
401
|
+
|
386
402
|
To create a server:
|
387
403
|
|
388
404
|
flavor = service.flavors.first
|
389
405
|
image = service.images.first
|
390
406
|
server = service.servers.create(:name => 'fog-doc', :flavor_id => flavor.id, :image_id => image.id)
|
391
407
|
|
408
|
+
**Note**: The `:name`, `:flavor_id`, and `image_id` attributes are required for server creation.
|
409
|
+
|
392
410
|
This will return a `Fog::Compute::RackspaceV2::Server` instance:
|
393
411
|
|
394
412
|
<Fog::Compute::RackspaceV2::Server
|
@@ -413,7 +431,7 @@ This will return a `Fog::Compute::RackspaceV2::Server` instance:
|
|
413
431
|
image_id="3afe97b2-26dc-49c5-a2cc-a2fc8d80c001"
|
414
432
|
>
|
415
433
|
|
416
|
-
Notice that your server contains several `nil` attributes. To see the latest status, reload the instance
|
434
|
+
Notice that your server contains several `nil` attributes. To see the latest status, reload the instance as follows:
|
417
435
|
|
418
436
|
server.reload
|
419
437
|
|
@@ -447,9 +465,10 @@ Fog can wait for the server to become ready as follows:
|
|
447
465
|
|
448
466
|
server.wait_for { ready? }
|
449
467
|
|
450
|
-
**Note**:
|
468
|
+
**Note**: The `Fog::Compute::RackspaceV2::Server` instance returned from the create method contains a `password` attribute. The `password` attribute will NOT be present in subsequent retrievals either through `service.servers` or `server.servers.get my_server_id`.
|
451
469
|
|
452
470
|
### Additional Parameters
|
471
|
+
|
453
472
|
The `create` method also supports the following key values:
|
454
473
|
|
455
474
|
<table>
|
@@ -467,13 +486,48 @@ The `create` method also supports the following key values:
|
|
467
486
|
</tr>
|
468
487
|
<tr>
|
469
488
|
<td>:personality</td>
|
470
|
-
<td>
|
489
|
+
<td>Array of files to be injected onto the server. Please refer to the Fog <a href="http://rubydoc.info/github/fog/fog/Fog/Compute/RackspaceV2/Servers:bootstrap">bootstrap </a> API documentation for further information.</td>
|
471
490
|
</tr>
|
472
|
-
</table>
|
491
|
+
</table>
|
492
|
+
|
493
|
+
## Bootstrap
|
494
|
+
|
495
|
+
In addition to the `create` method, Fog provides a `bootstrap` method which creates a server and then performs the following actions via ssh:
|
496
|
+
|
497
|
+
1. Create `ROOT_USER/.ssh/authorized_keys` file using the ssh key specified in `:public_key_path`.
|
498
|
+
2. Lock password for root user using `passwd -l root`.
|
499
|
+
3. Create `ROOT_USER/attributes.json` file with the contents of `server.attributes`.
|
500
|
+
4. Create `ROOT_USER/metadata.json` file with the contents of `server.metadata`.
|
501
|
+
|
502
|
+
**Note**: Unlike the `create` method, `bootstrap` is blocking method call. If non-blocking behavior is desired, developers should use the `:personality` parameter on the `create` method.
|
503
|
+
|
504
|
+
The following example demonstrates bootstraping a server:
|
505
|
+
|
506
|
+
service.servers.bootstrap :name => 'bootstrap-server',
|
507
|
+
:flavor_id => service.flavors.first.id,
|
508
|
+
:image_id => service.images.find {|img| img.name =~ /Ubuntu/}.id,
|
509
|
+
:public_key_path => '~/.ssh/fog_rsa.pub',
|
510
|
+
:private_key_path => '~/.ssh/fog_rsa'
|
511
|
+
|
512
|
+
**Note**: The `:name`, `:flavor_id`, `:image_id`, `:public_key_path`, `:private_key_path` are required for the `bootstrap` method.
|
513
|
+
|
514
|
+
The `bootstrap` method uses the same additional parameters as the `create` method. Refer to the [Additional Parameters](#additional-parameters) section for more information.
|
515
|
+
|
516
|
+
## SSH
|
517
|
+
|
518
|
+
Once a server has been created and set up for ssh key authentication, fog can execute remote commands as follows:
|
519
|
+
|
520
|
+
result = server.ssh ['pwd']
|
473
521
|
|
522
|
+
This will return the following:
|
523
|
+
|
524
|
+
[#<Fog::SSH::Result:0x1108241d0 @stderr="", @status=0, @stdout="/root\r\n", @command="pwd">]
|
525
|
+
|
526
|
+
**Note**: SSH key authentication can be set up using `bootstrap` method or by using the `:personality` attribute on the `:create` method. See [Bootstrap](#bootstrap) or [Create Server](#create-server) for more information.
|
527
|
+
|
474
528
|
## Update Server
|
475
529
|
|
476
|
-
Next Gen Cloud Servers
|
530
|
+
Next Gen Cloud Servers support updating the following attributes `name`, `access_ipv4_address`, and `access_ipv6_address`.
|
477
531
|
|
478
532
|
To update these attributes:
|
479
533
|
|
@@ -484,16 +538,18 @@ To update these attributes:
|
|
484
538
|
|
485
539
|
Additional information about server access addresses can be found [here](http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Server_Primary_Addresses-d1e2558.html).
|
486
540
|
|
487
|
-
**Note**:
|
541
|
+
**Note**: Updating the server name does not change the host name. Names are not guaranteed to be unique.
|
488
542
|
|
489
543
|
## Delete Server
|
544
|
+
|
490
545
|
To delete a server:
|
491
546
|
|
492
547
|
server.destroy
|
493
548
|
|
494
|
-
**Note**:
|
549
|
+
**Note**: The server is not immediately destroyed, but it does occur shortly there after.
|
495
550
|
|
496
551
|
## Metadata
|
552
|
+
|
497
553
|
You can access metadata as an attribute on both `Fog::Compute::RackspaceV2::Server` and `Fog::Compute::RackspaceV2::Metadata::Image`. You can specify metadata during creation of a server or an image. Please refer to [Create Server](#create-server) or [Create Image](#create-image) sections for more information.
|
498
554
|
|
499
555
|
This example demonstrates how to iterate through a server's metadata:
|
@@ -546,31 +602,31 @@ Additionally, the `rebuild` method will take a second parameter containing a has
|
|
546
602
|
<th>Description</th>
|
547
603
|
</tr>
|
548
604
|
<tr>
|
549
|
-
<td
|
605
|
+
<td>:name</td>
|
550
606
|
<td>Name of Server</td>
|
551
607
|
</tr>
|
552
608
|
<tr>
|
553
|
-
<td
|
609
|
+
<td>:flavorRef</td>
|
554
610
|
<td>Flavor id</td>
|
555
611
|
</tr>
|
556
612
|
<tr>
|
557
|
-
<td
|
613
|
+
<td>:accessIPv4</td>
|
558
614
|
<td>IPv4 access address</td>
|
559
615
|
</tr>
|
560
616
|
<tr>
|
561
|
-
<td
|
617
|
+
<td>:accessIPv6</td>
|
562
618
|
<td>IPv6 access address</td>
|
563
619
|
</tr>
|
564
620
|
<tr>
|
565
|
-
<td
|
621
|
+
<td>:metadata</td>
|
566
622
|
<td>Hash containing server metadata</td>
|
567
623
|
</tr>
|
568
624
|
<tr>
|
569
|
-
<td
|
625
|
+
<td>:personality</td>
|
570
626
|
<td>File path and contents. Refer to Next Gen Server API documentation - <a href="http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Server_Personality-d1e2543.html">Server Personality</a>. </td>
|
571
627
|
</tr>
|
572
628
|
<tr>
|
573
|
-
<td
|
629
|
+
<td>:disk_config</td>
|
574
630
|
<td>The disk configuration value (AUTO or MANUAL). Refer to Next Gen Server API documentation - <a href="http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_extensions.html#diskconfig_attribute">Disk Configuration Extension</a>.</td>
|
575
631
|
</tr>
|
576
632
|
</table>
|
@@ -595,7 +651,7 @@ In this case, `wait_for` is waiting for the server to become `VERIFY_READY` and
|
|
595
651
|
|
596
652
|
Once a server enters the `VERIFY_RESIZE` we will need to call `confirm_resize` to confirm the server was properly resized or `revert_resize` to rollback to the old size/flavor.
|
597
653
|
|
598
|
-
**Note:**
|
654
|
+
**Note:** A server will automatically confirm resize after 24 hours.
|
599
655
|
|
600
656
|
To confirm resize:
|
601
657
|
|
@@ -646,17 +702,20 @@ To detach a volume:
|
|
646
702
|
server.attachments.first.detach
|
647
703
|
|
648
704
|
## Examples
|
649
|
-
|
705
|
+
|
706
|
+
Example code using Next Gen Cloud Servers can be found [here](https://github.com/fog/fog/tree/master/lib/fog/rackspace/examples).
|
650
707
|
|
651
708
|
## Additional Resources
|
709
|
+
|
652
710
|
* [fog.io](http://fog.io/)
|
653
711
|
* [Fog rdoc](http://rubydoc.info/gems/fog/)
|
654
712
|
* [Fog Github repo](https://github.com/fog/fog)
|
655
713
|
* [Fog Github Issues](https://github.com/fog/fog/issues)
|
656
714
|
* [Excon Github repo](https://github.com/geemus/excon)
|
657
|
-
* [Next Gen Cloud Servers
|
715
|
+
* [Next Gen Cloud Servers API](http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_preface.html)
|
658
716
|
|
659
717
|
## Support and Feedback
|
718
|
+
|
660
719
|
Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues).
|
661
720
|
|
662
721
|
For general feedback and support requests, send an email to: <sdk-support@rackspace.com>.
|