fog 1.18.0 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +6 -0
- data/CONTRIBUTING.md +22 -0
- data/LICENSE.md +20 -0
- data/README.md +41 -60
- data/Rakefile +2 -0
- data/changelog.txt +262 -0
- data/fog.gemspec +3 -3
- data/lib/fog/aws.rb +9 -7
- data/lib/fog/aws/cloud_watch.rb +0 -1
- data/lib/fog/aws/compute.rb +2 -0
- data/lib/fog/aws/dns.rb +2 -1
- data/lib/fog/aws/elb.rb +2 -0
- data/lib/fog/aws/models/auto_scaling/configuration.rb +4 -0
- data/lib/fog/aws/models/compute/address.rb +6 -5
- data/lib/fog/aws/models/compute/flavors.rb +10 -0
- data/lib/fog/aws/models/compute/spot_request.rb +1 -1
- data/lib/fog/aws/models/compute/subnet.rb +4 -0
- data/lib/fog/aws/models/compute/vpc.rb +5 -0
- data/lib/fog/aws/models/dns/records.rb +1 -3
- data/lib/fog/aws/models/elb/load_balancer.rb +10 -0
- data/lib/fog/aws/models/glacier/vault.rb +1 -1
- data/lib/fog/aws/models/rds/server.rb +5 -2
- data/lib/fog/aws/models/rds/subnet_group.rb +15 -1
- data/lib/fog/aws/models/storage/file.rb +2 -2
- data/lib/fog/aws/parsers/auto_scaling/describe_launch_configurations.rb +6 -0
- data/lib/fog/aws/parsers/compute/assign_private_ip_addresses.rb +25 -0
- data/lib/fog/aws/parsers/compute/describe_addresses.rb +1 -1
- data/lib/fog/aws/parsers/elb/describe_load_balancer_attributes.rb +40 -0
- data/lib/fog/aws/parsers/rds/delete_db_subnet_group.rb +35 -0
- data/lib/fog/aws/rds.rb +3 -3
- data/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +2 -0
- data/lib/fog/aws/requests/auto_scaling/describe_notification_configurations.rb +1 -1
- data/lib/fog/aws/requests/compute/assign_private_ip_addresses.rb +60 -0
- data/lib/fog/aws/requests/compute/create_route.rb +1 -1
- data/lib/fog/aws/requests/compute/describe_images.rb +1 -1
- data/lib/fog/aws/requests/compute/describe_subnets.rb +8 -0
- data/lib/fog/aws/requests/compute/describe_vpcs.rb +8 -0
- data/lib/fog/aws/requests/compute/modify_vpc_attribute.rb +59 -0
- data/lib/fog/aws/requests/dns/change_resource_record_sets.rb +26 -9
- data/lib/fog/aws/requests/dns/create_hosted_zone.rb +12 -3
- data/lib/fog/aws/requests/dns/delete_hosted_zone.rb +33 -0
- data/lib/fog/aws/requests/dns/get_change.rb +26 -0
- data/lib/fog/aws/requests/dns/get_hosted_zone.rb +1 -1
- data/lib/fog/aws/requests/dns/list_hosted_zones.rb +3 -8
- data/lib/fog/aws/requests/dns/list_resource_record_sets.rb +68 -0
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +1 -0
- data/lib/fog/aws/requests/elb/describe_load_balancer_attributes.rb +54 -0
- data/lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb +59 -0
- data/lib/fog/aws/requests/rds/create_db_instance.rb +7 -1
- data/lib/fog/aws/requests/rds/create_db_subnet_group.rb +7 -1
- data/lib/fog/aws/requests/rds/delete_db_subnet_group.rb +42 -0
- data/lib/fog/aws/requests/storage/delete_multiple_objects.rb +6 -4
- data/lib/fog/aws/requests/storage/put_bucket.rb +4 -1
- data/lib/fog/aws/sqs.rb +2 -4
- data/lib/fog/aws/storage.rb +14 -1
- data/lib/fog/bluebox/compute.rb +1 -1
- data/lib/fog/brightbox/compute.rb +7 -9
- data/lib/fog/brightbox/compute/image_selector.rb +1 -1
- data/lib/fog/brightbox/compute/shared.rb +8 -10
- data/lib/fog/brightbox/models/compute/api_client.rb +1 -1
- data/lib/fog/brightbox/models/compute/application.rb +1 -4
- data/lib/fog/brightbox/models/compute/cloud_ip.rb +8 -5
- data/lib/fog/brightbox/models/compute/collaboration.rb +0 -2
- data/lib/fog/brightbox/models/compute/collaborations.rb +1 -1
- data/lib/fog/brightbox/models/compute/firewall_policy.rb +2 -4
- data/lib/fog/brightbox/models/compute/firewall_rule.rb +1 -1
- data/lib/fog/brightbox/models/compute/image.rb +1 -3
- data/lib/fog/brightbox/models/compute/load_balancer.rb +11 -8
- data/lib/fog/brightbox/models/compute/server.rb +28 -20
- data/lib/fog/brightbox/models/compute/server_group.rb +9 -11
- data/lib/fog/brightbox/models/compute/zone.rb +1 -1
- data/lib/fog/brightbox/oauth2.rb +3 -3
- data/lib/fog/brightbox/requests/compute/update_server.rb +1 -1
- data/lib/fog/cloudstack.rb +1 -1
- data/lib/fog/compute.rb +2 -2
- data/lib/fog/core.rb +1 -1
- data/lib/fog/core/connection.rb +1 -2
- data/lib/fog/core/errors.rb +3 -3
- data/lib/fog/core/hmac.rb +3 -3
- data/lib/fog/core/mock.rb +9 -2
- data/lib/fog/core/scp.rb +1 -1
- data/lib/fog/core/wait_for.rb +1 -1
- data/lib/fog/core/{timeout.rb → wait_for_defaults.rb} +10 -0
- data/lib/fog/digitalocean/models/compute/server.rb +4 -0
- data/lib/fog/digitalocean/requests/compute/create_server.rb +2 -0
- data/lib/fog/dnsimple/dns.rb +1 -1
- data/lib/fog/dreamhost/dns.rb +2 -4
- data/lib/fog/ecloud/compute.rb +1 -1
- data/lib/fog/ecloud/models/compute/environments.rb +5 -3
- data/lib/fog/google/compute.rb +105 -68
- data/lib/fog/google/examples/create.rb +1 -0
- data/lib/fog/google/models/compute/disk.rb +7 -1
- data/lib/fog/google/models/compute/operation.rb +42 -0
- data/lib/fog/google/models/compute/operations.rb +26 -0
- data/lib/fog/google/models/compute/server.rb +18 -2
- data/lib/fog/google/models/compute/servers.rb +2 -1
- data/lib/fog/google/models/compute/zones.rb +1 -1
- data/lib/fog/google/models/storage/file.rb +1 -1
- data/lib/fog/google/models/storage/files.rb +1 -1
- data/lib/fog/google/requests/compute/delete_disk.rb +22 -2
- data/lib/fog/google/requests/compute/delete_global_operation.rb +29 -0
- data/lib/fog/google/requests/compute/delete_server.rb +13 -9
- data/lib/fog/google/requests/compute/delete_zone_operation.rb +33 -0
- data/lib/fog/google/requests/compute/get_disk.rb +26 -2
- data/lib/fog/google/requests/compute/{delete_operation.rb → get_global_operation.rb} +5 -6
- data/lib/fog/google/requests/compute/get_image.rb +3 -3
- data/lib/fog/google/requests/compute/get_server.rb +1 -0
- data/lib/fog/google/requests/compute/get_zone_operation.rb +58 -0
- data/lib/fog/google/requests/compute/insert_disk.rb +43 -3
- data/lib/fog/google/requests/compute/insert_firewall.rb +2 -1
- data/lib/fog/google/requests/compute/insert_image.rb +2 -2
- data/lib/fog/google/requests/compute/insert_server.rb +64 -35
- data/lib/fog/google/requests/compute/list_disks.rb +8 -2
- data/lib/fog/google/requests/compute/list_images.rb +2 -2
- data/lib/fog/google/requests/compute/list_machine_types.rb +2 -2
- data/lib/fog/google/requests/compute/list_servers.rb +2 -2
- data/lib/fog/google/requests/compute/list_zone_operations.rb +2 -1
- data/lib/fog/google/requests/compute/list_zones.rb +1 -1
- data/lib/fog/google/requests/storage/copy_object.rb +1 -1
- data/lib/fog/hp.rb +1 -1
- data/lib/fog/hp/README.md +57 -0
- data/lib/fog/hp/articles/auth_caching.md +23 -0
- data/lib/fog/hp/docs/connect.md +152 -0
- data/lib/fog/hp/docs/install.md +133 -0
- data/lib/fog/hp/examples/block_storage.md +296 -0
- data/lib/fog/hp/examples/block_storage_v2.md +446 -0
- data/lib/fog/hp/examples/cdn.md +54 -0
- data/lib/fog/hp/examples/compute.md +794 -0
- data/lib/fog/hp/examples/compute_v2.md +848 -0
- data/lib/fog/hp/examples/getting_started_examples.md +30 -0
- data/lib/fog/hp/examples/networking.md +472 -0
- data/lib/fog/hp/examples/object_storage.md +387 -0
- data/lib/fog/json.rb +6 -3
- data/lib/fog/local/models/storage/directories.rb +8 -4
- data/lib/fog/openstack/compute.rb +3 -0
- data/lib/fog/openstack/examples/compute/basics.rb +74 -0
- data/lib/fog/openstack/identity.rb +2 -3
- data/lib/fog/openstack/image.rb +1 -4
- data/lib/fog/openstack/metering.rb +1 -4
- data/lib/fog/openstack/models/compute/host.rb +5 -1
- data/lib/fog/openstack/models/compute/security_group.rb +18 -4
- data/lib/fog/openstack/models/compute/security_group_rule.rb +32 -0
- data/lib/fog/openstack/models/compute/security_group_rules.rb +22 -0
- data/lib/fog/openstack/models/volume/volume_type.rb +20 -0
- data/lib/fog/openstack/models/volume/volume_types.rb +26 -0
- data/lib/fog/openstack/network.rb +34 -6
- data/lib/fog/openstack/requests/compute/add_flavor_access.rb +1 -1
- data/lib/fog/openstack/requests/compute/allocate_address.rb +1 -1
- data/lib/fog/openstack/requests/compute/attach_volume.rb +1 -1
- data/lib/fog/openstack/requests/compute/boot_from_snapshot.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_flavor.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_key_pair.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_security_group.rb +4 -4
- data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +2 -2
- data/lib/fog/openstack/requests/compute/create_server.rb +12 -5
- data/lib/fog/openstack/requests/compute/create_volume.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_volume_snapshot.rb +1 -1
- data/lib/fog/openstack/requests/compute/delete_security_group.rb +1 -1
- data/lib/fog/openstack/requests/compute/delete_security_group_rule.rb +2 -0
- data/lib/fog/openstack/requests/compute/get_security_group.rb +14 -24
- data/lib/fog/openstack/requests/compute/get_security_group_rule.rb +38 -0
- data/lib/fog/openstack/requests/compute/list_hosts.rb +3 -3
- data/lib/fog/openstack/requests/compute/list_tenants.rb +1 -1
- data/lib/fog/openstack/requests/compute/remove_flavor_access.rb +1 -1
- data/lib/fog/openstack/requests/compute/update_quota.rb +1 -1
- data/lib/fog/openstack/requests/identity/create_ec2_credential.rb +1 -1
- data/lib/fog/openstack/requests/identity/create_role.rb +1 -1
- data/lib/fog/openstack/requests/identity/create_user.rb +1 -1
- data/lib/fog/openstack/requests/identity/update_user.rb +1 -1
- data/lib/fog/openstack/requests/image/update_image_members.rb +1 -1
- data/lib/fog/openstack/requests/orchestration/create_stack.rb +2 -2
- data/lib/fog/openstack/requests/orchestration/update_stack.rb +1 -1
- data/lib/fog/openstack/requests/storage/get_object_http_url.rb +13 -0
- data/lib/fog/openstack/requests/storage/get_object_https_url.rb +0 -14
- data/lib/fog/openstack/requests/volume/create_volume.rb +1 -1
- data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +1 -1
- data/lib/fog/openstack/requests/volume/get_volume_type_details.rb +32 -0
- data/lib/fog/openstack/requests/volume/list_volume_types.rb +41 -0
- data/lib/fog/openstack/storage.rb +2 -0
- data/lib/fog/openstack/volume.rb +9 -5
- data/lib/fog/rackspace/compute.rb +1 -4
- data/lib/fog/rackspace/compute_v2.rb +1 -0
- data/lib/fog/rackspace/docs/auto_scale.md +9 -9
- data/lib/fog/rackspace/docs/getting_started.md +1 -0
- data/lib/fog/rackspace/docs/queues.md +312 -0
- data/lib/fog/rackspace/examples/queues/claim_messages.rb +60 -0
- data/lib/fog/rackspace/examples/queues/create_queue.rb +45 -0
- data/lib/fog/rackspace/examples/queues/delete_message.rb +72 -0
- data/lib/fog/rackspace/examples/queues/delete_queue.rb +53 -0
- data/lib/fog/rackspace/examples/queues/list_messages.rb +64 -0
- data/lib/fog/rackspace/examples/queues/post_message.rb +59 -0
- data/lib/fog/rackspace/models/compute_v2/key_pairs.rb +1 -1
- data/lib/fog/rackspace/models/compute_v2/server.rb +9 -3
- data/lib/fog/rackspace/models/compute_v2/servers.rb +2 -2
- data/lib/fog/rackspace/models/identity/service_catalog.rb +44 -59
- data/lib/fog/rackspace/models/queues/claim.rb +41 -1
- data/lib/fog/rackspace/models/queues/claims.rb +25 -0
- data/lib/fog/rackspace/models/queues/message.rb +43 -5
- data/lib/fog/rackspace/models/queues/messages.rb +37 -0
- data/lib/fog/rackspace/models/queues/queue.rb +66 -3
- data/lib/fog/rackspace/models/queues/queues.rb +15 -0
- data/lib/fog/rackspace/models/storage/file.rb +8 -1
- data/lib/fog/rackspace/requests/compute_v2/delete_keypair.rb +1 -1
- data/lib/fog/rackspace/requests/compute_v2/get_keypair.rb +1 -1
- data/lib/fog/rackspace/requests/queues/create_claim.rb +15 -0
- data/lib/fog/rackspace/requests/queues/create_message.rb +15 -0
- data/lib/fog/rackspace/requests/queues/create_queue.rb +11 -0
- data/lib/fog/rackspace/requests/queues/delete_claim.rb +12 -0
- data/lib/fog/rackspace/requests/queues/delete_message.rb +14 -0
- data/lib/fog/rackspace/requests/queues/delete_queue.rb +10 -0
- data/lib/fog/rackspace/requests/queues/get_claim.rb +11 -0
- data/lib/fog/rackspace/requests/queues/get_message.rb +12 -0
- data/lib/fog/rackspace/requests/queues/get_queue.rb +10 -0
- data/lib/fog/rackspace/requests/queues/get_queue_stats.rb +10 -0
- data/lib/fog/rackspace/requests/queues/list_messages.rb +26 -0
- data/lib/fog/rackspace/requests/queues/list_queues.rb +17 -2
- data/lib/fog/rackspace/requests/queues/update_claim.rb +7 -0
- data/lib/fog/rackspace/service.rb +6 -2
- data/lib/fog/rackspace/storage.rb +1 -4
- data/lib/fog/riakcs.rb +2 -2
- data/lib/fog/riakcs/provisioning.rb +1 -3
- data/lib/fog/riakcs/requests/provisioning/create_user.rb +2 -2
- data/lib/fog/riakcs/requests/provisioning/get_user.rb +1 -1
- data/lib/fog/riakcs/requests/provisioning/list_users.rb +1 -1
- data/lib/fog/riakcs/requests/usage/get_usage.rb +1 -1
- data/lib/fog/riakcs/usage.rb +0 -2
- data/lib/fog/vcloud_director/README.md +2 -0
- data/lib/fog/vcloud_director/compute.rb +79 -8
- data/lib/fog/vcloud_director/generators/compute/org_vdc_network.rb +91 -0
- data/lib/fog/vcloud_director/generators/compute/vapp.rb +30 -0
- data/lib/fog/vcloud_director/generators/compute/vm.rb +33 -0
- data/lib/fog/vcloud_director/models/compute/medias.rb +1 -1
- data/lib/fog/vcloud_director/models/compute/vm_customization.rb +2 -0
- data/lib/fog/vcloud_director/parsers/compute/vm_customization.rb +2 -0
- data/lib/fog/vcloud_director/requests/compute/delete_network.rb +64 -0
- data/lib/fog/vcloud_director/requests/compute/get_execute_query.rb +433 -333
- data/lib/fog/vcloud_director/requests/compute/get_vapp_metadata.rb +3 -1
- data/lib/fog/vcloud_director/requests/compute/post_attach_disk.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/post_configure_edge_gateway_services.rb +20 -2
- data/lib/fog/vcloud_director/requests/compute/post_create_org_vdc_network.rb +176 -0
- data/lib/fog/vcloud_director/requests/compute/post_detach_disk.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/post_eject_cd_rom.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/post_insert_cd_rom.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/put_guest_customization_section_vapp.rb +1 -0
- data/lib/fog/vcloud_director/requests/compute/put_vapp_name_and_description.rb +37 -0
- data/lib/fog/vcloud_director/requests/compute/put_vm.rb +39 -0
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/compute.rb +3 -0
- data/lib/fog/vsphere/models/compute/datastore.rb +1 -0
- data/lib/fog/vsphere/models/compute/interface.rb +50 -2
- data/lib/fog/vsphere/models/compute/interfaces.rb +25 -10
- data/lib/fog/vsphere/models/compute/scsicontroller.rb +19 -0
- data/lib/fog/vsphere/models/compute/server.rb +27 -8
- data/lib/fog/vsphere/requests/compute/create_vm.rb +34 -8
- data/lib/fog/vsphere/requests/compute/get_vm_first_scsi_controller.rb +26 -0
- data/lib/fog/vsphere/requests/compute/list_datastores.rb +9 -8
- data/lib/fog/vsphere/requests/compute/modify_vm_interface.rb +9 -6
- data/lib/fog/vsphere/requests/compute/set_vm_customvalue.rb +19 -0
- data/lib/fog/xenserver.rb +2 -1
- data/lib/fog/xenserver/compute.rb +37 -1
- data/lib/fog/xenserver/models/compute/blob.rb +22 -0
- data/lib/fog/xenserver/models/compute/blobs.rb +25 -0
- data/lib/fog/xenserver/models/compute/bond.rb +23 -0
- data/lib/fog/xenserver/models/compute/bonds.rb +25 -0
- data/lib/fog/xenserver/models/compute/console.rb +3 -1
- data/lib/fog/xenserver/models/compute/crash_dump.rb +19 -0
- data/lib/fog/xenserver/models/compute/crash_dumps.rb +25 -0
- data/lib/fog/xenserver/models/compute/dr_task.rb +17 -0
- data/lib/fog/xenserver/models/compute/dr_tasks.rb +25 -0
- data/lib/fog/xenserver/models/compute/gpu_group.rb +22 -0
- data/lib/fog/xenserver/models/compute/gpu_groups.rb +25 -0
- data/lib/fog/xenserver/models/compute/guest_metrics.rb +2 -1
- data/lib/fog/xenserver/models/compute/host.rb +41 -8
- data/lib/fog/xenserver/models/compute/host_cpu.rb +2 -1
- data/lib/fog/xenserver/models/compute/host_crash_dump.rb +20 -0
- data/lib/fog/xenserver/models/compute/host_crash_dumps.rb +25 -0
- data/lib/fog/xenserver/models/compute/host_metrics.rb +1 -1
- data/lib/fog/xenserver/models/compute/host_patch.rb +25 -0
- data/lib/fog/xenserver/models/compute/host_patchs.rb +25 -0
- data/lib/fog/xenserver/models/compute/network.rb +7 -6
- data/lib/fog/xenserver/models/compute/pbd.rb +3 -1
- data/lib/fog/xenserver/models/compute/pci.rb +22 -0
- data/lib/fog/xenserver/models/compute/pcis.rb +25 -0
- data/lib/fog/xenserver/models/compute/pgpu.rb +20 -0
- data/lib/fog/xenserver/models/compute/pgpus.rb +25 -0
- data/lib/fog/xenserver/models/compute/pif.rb +19 -8
- data/lib/fog/xenserver/models/compute/pif_metrics.rb +28 -0
- data/lib/fog/xenserver/models/compute/pifs_metrics.rb +25 -0
- data/lib/fog/xenserver/models/compute/pool.rb +18 -1
- data/lib/fog/xenserver/models/compute/pool_patch.rb +24 -0
- data/lib/fog/xenserver/models/compute/pool_patchs.rb +25 -0
- data/lib/fog/xenserver/models/compute/role.rb +19 -0
- data/lib/fog/xenserver/models/compute/roles.rb +25 -0
- data/lib/fog/xenserver/models/compute/server.rb +59 -26
- data/lib/fog/xenserver/models/compute/server_appliance.rb +21 -0
- data/lib/fog/xenserver/models/compute/server_appliances.rb +25 -0
- data/lib/fog/xenserver/models/compute/storage_manager.rb +28 -0
- data/lib/fog/xenserver/models/compute/storage_managers.rb +25 -0
- data/lib/fog/xenserver/models/compute/storage_repository.rb +4 -1
- data/lib/fog/xenserver/models/compute/tunnel.rb +20 -0
- data/lib/fog/xenserver/models/compute/tunnels.rb +25 -0
- data/lib/fog/xenserver/models/compute/vbd.rb +3 -2
- data/lib/fog/xenserver/models/compute/vbd_metrics.rb +1 -1
- data/lib/fog/xenserver/models/compute/vdi.rb +4 -1
- data/lib/fog/xenserver/models/compute/vif.rb +11 -2
- data/lib/fog/xenserver/models/compute/vlan.rb +2 -1
- data/lib/fog/xenserver/models/compute/vmpp.rb +35 -0
- data/lib/fog/xenserver/models/compute/vmpps.rb +25 -0
- data/lib/fog/xenserver/models/compute/vtpm.rb +18 -0
- data/lib/fog/xenserver/models/compute/vtpms.rb +25 -0
- data/lib/fog/xenserver/requests/compute/reboot_server.rb +1 -1
- data/lib/tasks/changelog_task.rb +0 -1
- data/tests/aws/models/dns/record_tests.rb +1 -2
- data/tests/aws/models/dns/records_tests.rb +2 -7
- data/tests/aws/models/dns/zone_tests.rb +1 -1
- data/tests/aws/models/dns/zones_tests.rb +1 -1
- data/tests/aws/models/elb/model_tests.rb +10 -0
- data/tests/aws/models/storage/file_tests.rb +4 -0
- data/tests/aws/requests/compute/assign_private_ip_tests.rb +52 -0
- data/tests/aws/requests/compute/vpc_tests.rb +17 -1
- data/tests/aws/requests/dns/dns_tests.rb +1 -26
- data/tests/aws/requests/elb/load_balancer_tests.rb +6 -0
- data/tests/aws/requests/rds/{subnet_groups_test.rb → subnet_groups_tests.rb} +4 -0
- data/tests/aws/requests/storage/bucket_tests.rb +17 -0
- data/tests/aws/requests/storage/delete_multiple_objects_tests.rb +12 -0
- data/tests/brightbox/compute/schema.rb +0 -13
- data/tests/brightbox/models/compute/server_tests.rb +7 -9
- data/tests/brightbox/requests/compute/interface_tests.rb +7 -19
- data/tests/digitalocean/models/compute/server_tests.rb +4 -3
- data/tests/google/models/compute/disk_tests.rb +5 -0
- data/tests/google/models/compute/disks_tests.rb +5 -0
- data/tests/google/models/compute/server_tests.rb +5 -1
- data/tests/google/models/compute/servers_tests.rb +5 -0
- data/tests/google/requests/compute/disk_tests.rb +2 -1
- data/tests/google/requests/compute/firewall_tests.rb +1 -0
- data/tests/google/requests/compute/image_tests.rb +3 -0
- data/tests/google/requests/compute/network_tests.rb +1 -0
- data/tests/google/requests/compute/operation_tests.rb +1 -0
- data/tests/google/requests/compute/server_tests.rb +2 -3
- data/tests/google/requests/compute/zone_tests.rb +1 -6
- data/tests/helpers/collection_helper.rb +10 -2
- data/tests/helpers/mock_helper.rb +4 -5
- data/tests/local/models/directories_tests.rb +17 -0
- data/tests/openstack/models/compute/security_group_tests.rb +54 -0
- data/tests/openstack/requests/compute/security_group_tests.rb +22 -20
- data/tests/openstack/requests/network/network_tests.rb +8 -8
- data/tests/rackspace/compute_tests.rb +0 -5
- data/tests/rackspace/helper.rb +9 -4
- data/tests/rackspace/models/compute_v2/server_tests.rb +29 -1
- data/tests/rackspace/models/identity/service_catalog_tests.rb +87 -39
- data/tests/rackspace/models/queues/message_tests.rb +16 -0
- data/tests/rackspace/models/storage/file_tests.rb +29 -0
- data/tests/rackspace/requests/compute_v2/address_tests.rb +3 -1
- data/tests/rackspace/requests/compute_v2/metadata_tests.rb +4 -2
- data/tests/rackspace/requests/compute_v2/server_tests.rb +3 -6
- data/tests/vcloud_director/models/compute/media_tests.rb +18 -5
- data/tests/vcloud_director/models/compute/vapp_tests.rb +3 -1
- data/tests/vcloud_director/models/compute/vms_tests.rb +2 -1
- data/tests/vcloud_director/requests/compute/edge_gateway_tests.rb +19 -10
- data/tests/vcloud_director/requests/compute/network_tests.rb +64 -3
- data/tests/vcloud_director/requests/compute/query_tests.rb +67 -2
- data/tests/vsphere/requests/compute/set_vm_customvalue_tests.rb +21 -0
- metadata +112 -11
- data/fogkeytest1.pem +0 -27
- data/lib/fog/hp/README_HP.rdoc +0 -61
@@ -0,0 +1,152 @@
|
|
1
|
+
# Connecting to HP Cloud Services using Ruby Fog Bindings
|
2
|
+
|
3
|
+
The HP Cloud uses OpenStack as the platform and you can connect and set up your HP Cloud using Ruby Fog. To begin, connect using the following instructions:
|
4
|
+
|
5
|
+
* [Initial Connection](#initial-connection)
|
6
|
+
* [Availability Zones](#availability-zones)
|
7
|
+
* [Optional Parameters](#optional-parameters)
|
8
|
+
|
9
|
+
## Initial Connection
|
10
|
+
|
11
|
+
To connect to the HP Cloud, follow these steps:
|
12
|
+
|
13
|
+
1. Enter IRB
|
14
|
+
|
15
|
+
irb
|
16
|
+
|
17
|
+
2. Require the Fog library and Rubygems:
|
18
|
+
|
19
|
+
require 'rubygems'
|
20
|
+
require 'fog'
|
21
|
+
|
22
|
+
**Note**: If the `require 'rubygems'` command returns a value of `false`, enter IRB with the following command:
|
23
|
+
|
24
|
+
irb -r 'rubygems'
|
25
|
+
|
26
|
+
3. Establish a connection to the desired HP Cloud service
|
27
|
+
|
28
|
+
conn = Fog::<SERVICE-NAME>.new(
|
29
|
+
:provider => "HP",
|
30
|
+
:hp_access_key => "<your_ACCESS_KEY>",
|
31
|
+
:hp_secret_key => "<your_SECRET_KEY>",
|
32
|
+
:hp_auth_uri => "<IDENTITY_ENDPOINT_URL>",
|
33
|
+
:hp_tenant_id => "<your_TENANT_ID>",
|
34
|
+
:hp_avl_zone => "<your_AVAILABILITY_ZONE>",
|
35
|
+
<other optional parameters>
|
36
|
+
)
|
37
|
+
|
38
|
+
Where `SERVICE-NAME` can be [Compute](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/compute.md), [Storage](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/object_storage.md), [CDN](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/cdn.md) or other services. Please surf on over to the [Block Storage](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/block-storage.md) for the details on how to connect to that service.
|
39
|
+
|
40
|
+
**Note**: You must use the `:hp_access_key` parameter rather than the now-deprecated `:hp_account_id` parameter you might have used in previous versions of the HP Cloud Services Extensions to Ruby Fog.
|
41
|
+
|
42
|
+
You can find the values the access key, secret key, and other values by clicking the [`API Keys`](https://console.hpcloud.com/account/api_keys) button in the [Console Dashboard](https://console.hpcloud.com/dashboard).
|
43
|
+
|
44
|
+
|
45
|
+
## Availability Zones
|
46
|
+
|
47
|
+
You cannot specify an availability zone if you have not activated it. To activate an availability zone, go to the [Management Console dashboard](https://console.hpcloud.com/) and click the `**Activate`** button. You are required to set an availability zone to establish a connection; there is no default availability zone value.
|
48
|
+
|
49
|
+
The current usable availability zones for the compute service:
|
50
|
+
|
51
|
+
* `az-1.region-a.geo-1`
|
52
|
+
* `az-2.region-a.geo-1`
|
53
|
+
* `az-3.region-a.geo-1`
|
54
|
+
|
55
|
+
The current usable availability zones for the storage service:
|
56
|
+
|
57
|
+
* `region-a.geo-1`
|
58
|
+
* `region-b.geo-1`
|
59
|
+
|
60
|
+
The current usable availability zones for the CDN:
|
61
|
+
|
62
|
+
* `region-a.geo-1`
|
63
|
+
* `region-b.geo-1`
|
64
|
+
|
65
|
+
The current usable availability zones for the block storage service:
|
66
|
+
|
67
|
+
* `az-1.region-a.geo-1`
|
68
|
+
* `az-2.region-a.geo-1`
|
69
|
+
* `az-3.region-a.geo-1`
|
70
|
+
|
71
|
+
## Optional Parameters
|
72
|
+
|
73
|
+
This section describes the optional parameters that you can use when connecting to any of the HP Cloud services. The examples below show the Compute service, but these optional parameters work with all of the HP Cloud services.
|
74
|
+
|
75
|
+
The `user_agent` parameter allows you to specify a string to pass as a `user_agent` header for the connection. You can use this to track the caller of the operations. You can set the `user_agent` parameter as follows:
|
76
|
+
|
77
|
+
conn = Fog::Compute.new(
|
78
|
+
...
|
79
|
+
...
|
80
|
+
:user_agent => "MyApp/x.x.x")
|
81
|
+
|
82
|
+
This inserts a `user_agent` string such as `hpfog/x.x.x (MyApp/x.x.x)` into the header.
|
83
|
+
|
84
|
+
In addition to the `user_agent` parameter, there are several additional parameters you can set using the `connection_options` parameter. These options are provided by the Excon library and allow you to modify the underlying connection to a service. These options are [Instrumentation](#Instrumentation), [Timeouts](#Timeouts), [Proxy](#Proxy), and [HTTPS/SSL](#HTTPS).
|
85
|
+
|
86
|
+
### Instrumentation
|
87
|
+
|
88
|
+
Use this parameter for debugging purposes. When you use the default instrumentor `Excon::StandardInstrumentor`, all events are output to `stderr`. You can also designate your own instrumentor. You can set the default instrumentor as follows:
|
89
|
+
|
90
|
+
conn = Fog::Compute.new(
|
91
|
+
...
|
92
|
+
...
|
93
|
+
:connection_options => {:instrumentor => Excon::StandardInstrumentor})
|
94
|
+
|
95
|
+
For convenience of debugging HTTP requests, we have created a custom instrumentor `Excon::SimpleHttpInstrumentor`. This instrumentor shows the HTTP calls in afashion which is similar to a `curl` output. You can set the custom `SimpleHttpInstrumentor` as follows:
|
96
|
+
|
97
|
+
conn = Fog::Compute.new(
|
98
|
+
...
|
99
|
+
...
|
100
|
+
:connection_options => {:instrumentor => Excon::SimpleHttpInstrumentor, :instrumentor_name => 'SimpleHttp'})
|
101
|
+
|
102
|
+
### Timeouts
|
103
|
+
|
104
|
+
Use this parameter to set different timeout values. You can set the timeouts parameter as follows:
|
105
|
+
|
106
|
+
conn = Fog::Compute.new(
|
107
|
+
...
|
108
|
+
...
|
109
|
+
:connection_options => {
|
110
|
+
:connect_timeout => <time_in_secs>,
|
111
|
+
:read_timeout => <time_in_secs>,
|
112
|
+
:write_timeout => <time_in_secs>})
|
113
|
+
|
114
|
+
### Proxy
|
115
|
+
|
116
|
+
Use this parameter to specify a proxy URL for both HTTP and HTTPS connections. You can set the proxy parameter as follows:
|
117
|
+
|
118
|
+
conn = Fog::Compute.new(
|
119
|
+
...
|
120
|
+
...
|
121
|
+
:connection_options => {:proxy => 'http://myproxyurl:4444'})
|
122
|
+
|
123
|
+
### HTTPS/SSL
|
124
|
+
|
125
|
+
By default, peer certificates are verified when you use secure socket layer (SSL) for HTTPS. Sometimes this does not work due to configurations in different operating systems, causing connection errors. To help avoid this, you can set HTTPS/SSL parameters. To set the path to the certificates:
|
126
|
+
|
127
|
+
conn = Fog::Compute.new(
|
128
|
+
...
|
129
|
+
...
|
130
|
+
:connection_options => {:ssl_ca_path => "/path/to/certs"})
|
131
|
+
|
132
|
+
To set the path to a certificate file:
|
133
|
+
|
134
|
+
conn = Fog::Compute.new(
|
135
|
+
...
|
136
|
+
...
|
137
|
+
:connection_options => {:ssl_ca_file => "/path/to/certificate_file"})
|
138
|
+
|
139
|
+
To set turn off peer verification:
|
140
|
+
|
141
|
+
conn = Fog::Compute.new(
|
142
|
+
...
|
143
|
+
...
|
144
|
+
:connection_options => {:ssl_verify_peer => false})
|
145
|
+
|
146
|
+
**Note**: This makes your connection less secure.
|
147
|
+
|
148
|
+
For further information on these options, please see [the Excon documentation](http://github.com/geemus/excon).
|
149
|
+
|
150
|
+
|
151
|
+
---------
|
152
|
+
[Documentation Home](https://github.com/fog/fog/blob/master/lib/fog/hp/README.md) | [Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/getting_started_examples.md)
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# Installing Ruby Fog Bindings for HP Cloud Services
|
2
|
+
|
3
|
+
Before you can begin working with the Ruby Fog bindings, you have to install them (of course!). This page provides you with the installation information for the following operating systems:
|
4
|
+
|
5
|
+
* [Ubuntu Installation](#ubuntu-installation)
|
6
|
+
* [Mac OSX Installation](#mac-osx-installation)
|
7
|
+
* [CentOS Installation](#centos-installation)
|
8
|
+
* [Uninstalling](#uninstalling)
|
9
|
+
|
10
|
+
To install and use HP Cloud Ruby bindings for Fog, please install the [latest release](http://fog.io) of Fog.
|
11
|
+
|
12
|
+
|
13
|
+
## Ubuntu Installation
|
14
|
+
|
15
|
+
If you plan on using the Ruby Fog binding on Ubuntu, we recommend you use Ubuntu versions 12.04 or 12.10. The Ruby Fog bindings may work on other versions, but are not supported.
|
16
|
+
|
17
|
+
To install the Ruby Fog bindings on the Ubuntu operating system, follow these steps while logged in as the root user:
|
18
|
+
|
19
|
+
1. Install Ruby and Ruby-dev:
|
20
|
+
|
21
|
+
apt-get install ruby1.8 ruby-dev
|
22
|
+
|
23
|
+
2. Install RubyGems:
|
24
|
+
|
25
|
+
apt-get install rubygems
|
26
|
+
|
27
|
+
3. Install the dependent libraries:
|
28
|
+
|
29
|
+
apt-get install libxml2 libxml2-dev libxslt1-dev libxslt1.1 sgml-base xml-core
|
30
|
+
|
31
|
+
4. Install the RDoc Ruby source documenation generator package:
|
32
|
+
|
33
|
+
gem install rdoc
|
34
|
+
|
35
|
+
5. Install the Fog gem:
|
36
|
+
|
37
|
+
gem install fog
|
38
|
+
|
39
|
+
|
40
|
+
See the [Connecting to the Service](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/connect.md) page for details on how to connect.
|
41
|
+
|
42
|
+
## MacOS X Installation
|
43
|
+
|
44
|
+
Some Ruby packages require C/C++ compiler support. On the MacOS, if you haven't already installed XCode, we recommend that you install it to provide the needed C/C++ compiler for your system.
|
45
|
+
|
46
|
+
To install the Ruby Fog bindings on MacOS X, follow these steps while logged in as the root user:
|
47
|
+
|
48
|
+
1. Download and install Xcode. You can [download the most recent version of XCode through the Mac App Store](https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12). If you want to install an earlier version of Xcode, go to the [Apple Developer](https://developer.apple.com/downloads/index.action) site and search for "Xcode". In the results list, select the version of Xcode that you want and install it. (Note that you need to be signed up as an "Apple Developer" to access the download. Sign-up is free.)
|
49
|
+
|
50
|
+
2. To make your installation process easier we recommend that you install [Homebrew](http://wiki.github.com/mxcl/homebrew/installation). Follow the instructions on the Homebrew page to install the package. After you have downloaded Homebrew, the CLI command to install it is:
|
51
|
+
|
52
|
+
homebrew install - ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
|
53
|
+
|
54
|
+
3. Add the Homebrew path to your $PATH environment variable. You can either do this via the CLI command line:
|
55
|
+
|
56
|
+
export PATH=:/usr/local/sbin:$PATH
|
57
|
+
|
58
|
+
(The default Homebrew installation location is the `/usr/local/sbin` directory.) Or you can add the Homebrew path (`/usr/local/sbin`) to your $PATH environment variable in your local `.profile` file.
|
59
|
+
|
60
|
+
4. Install RVM on your system:
|
61
|
+
|
62
|
+
curl -L get.rvm.io | bash -s stable
|
63
|
+
|
64
|
+
**Note**: You can also install RVM using [Jewelry Box](https://unfiniti.com/software/mac/jewelrybox), a RVM graphical user interface (GUI) for Mac OSX.
|
65
|
+
|
66
|
+
5. Install the packages required by RVM; the following command lists the required packages:
|
67
|
+
|
68
|
+
source ~/.rvm/scripts/rvm
|
69
|
+
rvm requirements # install required packages
|
70
|
+
|
71
|
+
6. Install the required packages listed in Step 5:
|
72
|
+
|
73
|
+
brew install <packages>
|
74
|
+
|
75
|
+
Where `<packages>` are the packages that you need to install.
|
76
|
+
|
77
|
+
7. Install the `libksba` library:
|
78
|
+
|
79
|
+
brew install libksba
|
80
|
+
|
81
|
+
8. Install Ruby:
|
82
|
+
|
83
|
+
rvm user all
|
84
|
+
rvm install ruby-1.9.2 --with-gcc=clang
|
85
|
+
|
86
|
+
9. Use the Ruby version and make it the default:
|
87
|
+
|
88
|
+
rvm use 1.9.2 --default
|
89
|
+
|
90
|
+
10. Install the Fog gem:
|
91
|
+
|
92
|
+
gem install fog
|
93
|
+
|
94
|
+
|
95
|
+
See the [Connecting to the Service](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/connect.md) page for details on how to connect.
|
96
|
+
|
97
|
+
## CentOS Installation
|
98
|
+
|
99
|
+
If you plan on using the Ruby Fog binding on CentOS, we recommend you use CentOS versions 6.2 or 6.3. The Ruby Fog bindings may work on other versions, but are not supported.
|
100
|
+
|
101
|
+
To install the Ruby Fog bindings on CentOS, follow these steps while logged in as the root user:
|
102
|
+
|
103
|
+
1. Install Ruby and Ruby Dev:
|
104
|
+
|
105
|
+
yum install -y ruby ruby-devel
|
106
|
+
|
107
|
+
2. Install Rubygems:
|
108
|
+
|
109
|
+
yum install -y rubygems
|
110
|
+
|
111
|
+
3. Install the dependent libraries:
|
112
|
+
|
113
|
+
yum install -y gcc make libxml2 libxml2-devel libxslt libxslt-devel
|
114
|
+
|
115
|
+
4. Install RDoc Ruby source documentation generator package:
|
116
|
+
|
117
|
+
gem install rdoc
|
118
|
+
|
119
|
+
5. Install the Fog gem:
|
120
|
+
|
121
|
+
gem install fog
|
122
|
+
|
123
|
+
|
124
|
+
See the [Connecting to the Service](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/connect.md) page for details on how to connect.
|
125
|
+
|
126
|
+
## Uninstalling
|
127
|
+
|
128
|
+
Its recommended that you uninstall a previous version prior to upgrading. To uninstall, execute the followin command while logged in as the root user:
|
129
|
+
|
130
|
+
gem uninstall fog
|
131
|
+
|
132
|
+
---------
|
133
|
+
[Documentation Home](https://github.com/fog/fog/blob/master/lib/fog/hp/README.md) | [Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/getting_started_examples.md)
|
@@ -0,0 +1,296 @@
|
|
1
|
+
#Examples for working with HP Cloud Block Storage Service v12.12
|
2
|
+
|
3
|
+
HP Cloud block storage provides support for volumes and snapshots. A volume can store boot images, user data or both. They provide customers with persistent and flexible permanent storage. You can think of it as list of USB devices, that can be plugged in anywhere at will. Volumes can be attached to server instances and mounted.
|
4
|
+
|
5
|
+
Snapshots are saved volume images at specific moments in time. You can take a snapshot of a volume and then use that snapshot to create a new volume.
|
6
|
+
|
7
|
+
The block storage provider has two abstractions: a model layer and a request layer. Both layers are detailed below. The following code snippets can be executed from within a Ruby console (IRB):
|
8
|
+
|
9
|
+
irb
|
10
|
+
|
11
|
+
This page discusses the following tasks:
|
12
|
+
|
13
|
+
* [Connecting to the Service](#connecting-to-the-service)
|
14
|
+
|
15
|
+
**Model Layer Examples**
|
16
|
+
|
17
|
+
* [Model Volume Operations](#model-volume-operations)
|
18
|
+
* [Model Snapshot Operations](#model-snapshot-operations)
|
19
|
+
|
20
|
+
**Request Layer Examples**
|
21
|
+
|
22
|
+
* [Request Volume Operations](#request-volume-operations)
|
23
|
+
* [Request Snapshot Operations](#request-snapshot-operations)
|
24
|
+
|
25
|
+
## Connecting to the Service
|
26
|
+
|
27
|
+
To connect to the HP Cloud Block Storage Service, follow these steps:
|
28
|
+
|
29
|
+
1. Enter IRB
|
30
|
+
|
31
|
+
irb
|
32
|
+
|
33
|
+
2. Require the Fog library
|
34
|
+
|
35
|
+
require 'fog'
|
36
|
+
|
37
|
+
3. Establish a connection to the HP Cloud BlockStorage service
|
38
|
+
|
39
|
+
conn = Fog::HP::BlockStorage.new(
|
40
|
+
:hp_access_key => "<your_ACCESS_KEY>",
|
41
|
+
:hp_secret_key => "<your_SECRET_KEY>",
|
42
|
+
:hp_auth_uri => "<IDENTITY_ENDPOINT_URL>",
|
43
|
+
:hp_tenant_id => "<your_TENANT_ID>",
|
44
|
+
:hp_avl_zone => "<your_AVAILABILITY_ZONE>",
|
45
|
+
<other optional parameters>
|
46
|
+
)
|
47
|
+
|
48
|
+
**Note**: You must use the `:hp_access_key` parameter rather than the now-deprecated `:hp_account_id` parameter you might have used in previous Ruby Fog versions.
|
49
|
+
|
50
|
+
You can find the values the access key, secret key, and other values by clicking the [`API Keys`](https://console.hpcloud.com/account/api_keys) button in the [Console Dashboard](https://console.hpcloud.com/dashboard).
|
51
|
+
|
52
|
+
## Model Volume Operations
|
53
|
+
|
54
|
+
This section discusses the volume operations you can perform using the model abstraction.
|
55
|
+
|
56
|
+
1. List all available volumes for an account
|
57
|
+
|
58
|
+
volumes = conn.volumes
|
59
|
+
volumes.size # returns no. of volumes
|
60
|
+
# display volumes in a tabular format
|
61
|
+
volumes.table([:id, :name, :status, :created_at])
|
62
|
+
|
63
|
+
2. Obtain the details of a particular volume
|
64
|
+
|
65
|
+
volume = conn.volumes.get(volume_id)
|
66
|
+
volume.name # returns name of the volume
|
67
|
+
volume.created_at # returns the date the volume was created
|
68
|
+
volume.status # returns the state of the volume e.g. available, in-use
|
69
|
+
|
70
|
+
3. List all available bootable volumes for an account
|
71
|
+
|
72
|
+
bootable_volumes = conn.bootable_volumes
|
73
|
+
bootable_volumes.size # returns no. of bootable volumes
|
74
|
+
# display bootable volumes in a tabular format
|
75
|
+
bootable_volumes.table([:id, :name, :state, :created_at])
|
76
|
+
|
77
|
+
4. Obtain the details of a particular bootable volume
|
78
|
+
|
79
|
+
volume = conn.bootable_volumes.get(volume_id)
|
80
|
+
volume.name # returns name of the bootable volume
|
81
|
+
volume.created_at # returns the date the bootable volume was created
|
82
|
+
volume.status # returns the state of the bootable volume e.g. available, in-use
|
83
|
+
|
84
|
+
5. Create a new volume
|
85
|
+
|
86
|
+
new_volume = conn.volumes.create(
|
87
|
+
:name => "TestVolume",
|
88
|
+
:description => "My Test Volume",
|
89
|
+
:size => 1)
|
90
|
+
new_volume.id # returns the id of the volume
|
91
|
+
new_volume.name # => "TestVolume"
|
92
|
+
new_volume.status # returns the status of the volume e.g. creating, available
|
93
|
+
|
94
|
+
6. Create a new volume from an existing snapshot
|
95
|
+
|
96
|
+
new_volume = conn.volumes.create(
|
97
|
+
:name => "TestVolume",
|
98
|
+
:description => "My Test Volume",
|
99
|
+
:snapshot_id => 1,
|
100
|
+
:size => 1)
|
101
|
+
new_volume.id # returns the id of the volume
|
102
|
+
new_volume.snapshot_id # returns the snapshot_id of the volume
|
103
|
+
new_volume.name # => "TestVolume"
|
104
|
+
new_volume.status # returns the status of the volume e.g. creating, available
|
105
|
+
**Note**: The size of the volume you create from a snapshot is the same as that of the snapshot. The `:size` parameter has no effect in this case.
|
106
|
+
|
107
|
+
7. Create a new bootable volume from an suitable single-part image
|
108
|
+
|
109
|
+
new_volume = conn.bootable_volumes.create(
|
110
|
+
:name => "BootVolume",
|
111
|
+
:description => "My Boot Volume",
|
112
|
+
:image_id => 11111,
|
113
|
+
:size => 10)
|
114
|
+
new_volume.id # returns the id of the volume
|
115
|
+
**Note**: You can use a bootable volume to create a persistent server instance.
|
116
|
+
|
117
|
+
8. Attach an existing volume to an existing server
|
118
|
+
|
119
|
+
volume = conn.volumes.get(volume_id)
|
120
|
+
volume.attach(server_id, device)
|
121
|
+
# => true
|
122
|
+
**Note**: The device parameter is the mount point on the server instance to which the volume is attached (for example, `/dev/sdf`).
|
123
|
+
|
124
|
+
9. Detach an existing volume
|
125
|
+
|
126
|
+
volume = conn.volumes.get(volume_id)
|
127
|
+
volume.detach
|
128
|
+
# => true
|
129
|
+
|
130
|
+
10. Delete an existing volume
|
131
|
+
|
132
|
+
volume = conn.volumes.get(volume_id)
|
133
|
+
volume.destroy
|
134
|
+
# => true
|
135
|
+
|
136
|
+
## Model Snapshot Operations
|
137
|
+
|
138
|
+
This section discusses the snapshot operations you can perform using the model abstraction.
|
139
|
+
|
140
|
+
1. List all available snapshots for an account
|
141
|
+
|
142
|
+
snapshots = conn.snapshots
|
143
|
+
snapshots.size # returns no. of snapshots
|
144
|
+
# display snapshots in a tabular format
|
145
|
+
conn.snapshots.table([:id, :name, :state, :created_at])
|
146
|
+
|
147
|
+
2. Obtain the details of a particular snapshot
|
148
|
+
|
149
|
+
snapshot = conn.snapshots.get(snapshot_id)
|
150
|
+
snapshot.name # returns name of the volume
|
151
|
+
snapshot.created_at # returns the date the volume was created
|
152
|
+
snapshot.status # returns the state of the volume e.g. available
|
153
|
+
|
154
|
+
3. Create a new snapshot
|
155
|
+
|
156
|
+
new_snapshot = conn.snapshots.create(
|
157
|
+
:name => "TestVolume",
|
158
|
+
:description => "My Test Volume",
|
159
|
+
:volume_id => 1)
|
160
|
+
new_snapshot.id # returns the id of the volume
|
161
|
+
new_snapshot.name # => "TestVolume"
|
162
|
+
new_snapshot.volume_id # => 1
|
163
|
+
new_snapshot.status # returns the status of the volume e.g. creating, available
|
164
|
+
|
165
|
+
4. Delete an existing snapshot
|
166
|
+
|
167
|
+
snapshot = conn.snapshots.get(snapshot_id)
|
168
|
+
snapshot.destroy
|
169
|
+
# => true
|
170
|
+
|
171
|
+
## Request Volume Operations
|
172
|
+
|
173
|
+
This section discusses the volume operations you can perform using the request abstraction.
|
174
|
+
|
175
|
+
1. List all available volumes for an account
|
176
|
+
|
177
|
+
response = conn.list_volumes
|
178
|
+
response.body['volumes'] # returns an array of volume hashes
|
179
|
+
response.headers # returns the headers
|
180
|
+
response.body['volumes'][0]['displayName'] # returns the name of the volume
|
181
|
+
|
182
|
+
2. Obtain the details of a particular volume
|
183
|
+
|
184
|
+
response = conn.get_volume_details(volume_id)
|
185
|
+
volume = response.body['volume']
|
186
|
+
volume['displayName'] # returns the name of the volume
|
187
|
+
volume['size'] # returns the size of the volume
|
188
|
+
volume['status'] # returns the status of the volume e.g. available, in-use
|
189
|
+
|
190
|
+
3. List all available bootable volumes for an account
|
191
|
+
|
192
|
+
response = conn.list_bootable_volumes
|
193
|
+
response.body['volumes'] # returns an array of bootable volume hashes
|
194
|
+
response.headers # returns the headers
|
195
|
+
response.body['volumes'][0]['displayName'] # returns the name of the bootable volume
|
196
|
+
|
197
|
+
4. Obtain the details of a particular bootable volume
|
198
|
+
|
199
|
+
response = conn.get_bootable_volume_details(volume_id)
|
200
|
+
volume = response.body['volume']
|
201
|
+
volume['displayName'] # returns the name of the bootable volume
|
202
|
+
volume['size'] # returns the size of the bootable volume
|
203
|
+
volume['status'] # returns the status of the bootable volume e.g. available, in-use
|
204
|
+
|
205
|
+
5. Create a new volume
|
206
|
+
|
207
|
+
response = conn.create_volume("demo-vol", "demo-vol-desc", 1)
|
208
|
+
volume = response.body['volume']
|
209
|
+
volume['id'] # returns the id of the new volume
|
210
|
+
volume['displayName'] # => "demo-vol"
|
211
|
+
volume['size'] # => 1
|
212
|
+
volume['status'] # returns the status of the volume e.g. creating, available
|
213
|
+
|
214
|
+
6. Create a new volume from an existing snapshot
|
215
|
+
|
216
|
+
response = conn.create_volume("demo-vol", "demo-vol-desc", 1, {'snapshot_id' => 1})
|
217
|
+
volume = response.body['volume']
|
218
|
+
volume['id'] # returns the id of the new volume
|
219
|
+
volume['displayName'] # => "demo-vol"
|
220
|
+
volume['size'] # => 1
|
221
|
+
volume['snapshot_id'] # => 1
|
222
|
+
volume['status'] # returns the status of the volume e.g. creating, available
|
223
|
+
**Note**: The size of the volume you create from a snapshot is the same as that of the snapshot. The third parameter (the size) has no effect in this case.
|
224
|
+
|
225
|
+
7. Create a new bootable volume from an suitable single-part image
|
226
|
+
|
227
|
+
new_volume = conn.create_volume("TestBootVol",
|
228
|
+
"My Test Boot Volume",
|
229
|
+
10,
|
230
|
+
{"imageRef" => "1111111"}
|
231
|
+
)
|
232
|
+
new_volume.id # returns the id of the volume
|
233
|
+
**Note**: You can use a bootable volume to create a persistent server instance.
|
234
|
+
|
235
|
+
8. Attach an existing volume to an existing server
|
236
|
+
|
237
|
+
response = conn.compute.attach_volume(server_id, volume_id, device)
|
238
|
+
volume_attachment = response.body['volumeAttachment']
|
239
|
+
volume_attachment['id'] # returns the id of the volume
|
240
|
+
volume_attachment['volumeId'] # returns the id of the volume
|
241
|
+
**Note**: The device parameter is the mount point on the server instance to which the volume is attached (for example, `/dev/sdf`)
|
242
|
+
|
243
|
+
9. List volumes attached to a server
|
244
|
+
|
245
|
+
response = conn.compute.list_server_volumes(server_id)
|
246
|
+
volume_attachments = response.body['volumeAttachments']
|
247
|
+
volume_attachment[0]['id'] # returns the id of the volume
|
248
|
+
volume_attachment[0]['volumeId'] # returns the id of the volume
|
249
|
+
volume_attachment[0]['device'] # returns the device of the volume
|
250
|
+
|
251
|
+
10. Detach an existing volume
|
252
|
+
|
253
|
+
conn.detach_volume(server_id, volume_id)
|
254
|
+
|
255
|
+
11. Delete an existing volume
|
256
|
+
|
257
|
+
conn.delete_volume(volume_id)
|
258
|
+
|
259
|
+
## Request Snapshot Operations
|
260
|
+
|
261
|
+
This section discusses the snapshot operations you can perform using the request abstraction.
|
262
|
+
|
263
|
+
1. List all available snapshots for an account
|
264
|
+
|
265
|
+
response = conn.list_snapshots
|
266
|
+
response.body['snapshots'] # returns an array of snapshot hashes
|
267
|
+
response.headers # returns the headers
|
268
|
+
response.body['snapshots'][0]['displayName'] # returns the name of the snapshot
|
269
|
+
response.body['snapshots'][0]['size'] # returns the size of the snapshot
|
270
|
+
response.body['snapshots'][0]['volumeId'] # returns the volume id of the snapshot
|
271
|
+
|
272
|
+
2. Obtain the details of a particular snapshot
|
273
|
+
|
274
|
+
response = conn.get_snapshot_details(snapshot_id)
|
275
|
+
snapshot = response.body['snapshot']
|
276
|
+
snapshot['displayName'] # returns the name of the snapshot
|
277
|
+
snapshot['size'] # returns the size of the snapshot
|
278
|
+
snapshot['volumeId'] # returns the volume id of the snapshot
|
279
|
+
snapshot['status'] # returns the status of the snapshot e.g. available, in-use
|
280
|
+
|
281
|
+
3. Create a new snapshot
|
282
|
+
|
283
|
+
response = conn.create_snapshot("demo-snap", "demo-snap-desc", 1)
|
284
|
+
snapshot = response.body['snapshot']
|
285
|
+
snapshot['id'] # returns the id of the new volume
|
286
|
+
snapshot['displayName'] # => "demo-vol"
|
287
|
+
snapshot['size'] # => 1
|
288
|
+
snapshot['volumeId'] # returns the volume id of the snapshot
|
289
|
+
snapshot['status'] # returns the status of the snapshot e.g. creating, available
|
290
|
+
|
291
|
+
4. Delete an existing snapshot
|
292
|
+
|
293
|
+
conn.delete_snapshot(snapshot_id)
|
294
|
+
|
295
|
+
---------
|
296
|
+
[Documentation Home](https://github.com/fog/fog/blob/master/lib/fog/hp/README.md) | [Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/getting_started_examples.md)
|