fog 1.17.0 → 1.18.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +19 -1
- data/changelog.txt +408 -0
- data/fog.gemspec +3 -3
- data/fogkeytest1.pem +27 -0
- data/lib/fog/aws/compute.rb +0 -1
- data/lib/fog/aws/data_pipeline.rb +0 -1
- data/lib/fog/aws/models/auto_scaling/group.rb +1 -1
- data/lib/fog/aws/models/compute/route_table.rb +1 -1
- data/lib/fog/aws/models/compute/server.rb +1 -1
- data/lib/fog/aws/parsers/compute/describe_internet_gateways.rb +1 -1
- data/lib/fog/aws/requests/compute/create_internet_gateway.rb +5 -4
- data/lib/fog/aws/requests/compute/create_tags.rb +2 -0
- data/lib/fog/aws/requests/compute/create_volume.rb +1 -1
- data/lib/fog/aws/requests/compute/delete_internet_gateway.rb +1 -1
- data/lib/fog/aws/requests/compute/describe_internet_gateways.rb +1 -1
- data/lib/fog/aws/requests/compute/run_instances.rb +1 -1
- data/lib/fog/bin/hp.rb +17 -0
- data/lib/fog/compute.rb +11 -0
- data/lib/fog/ecloud/compute.rb +8 -3
- data/lib/fog/ecloud/models/compute/admin_organization.rb +4 -4
- data/lib/fog/ecloud/models/compute/catalog_item.rb +1 -1
- data/lib/fog/ecloud/models/compute/compute_pool.rb +8 -8
- data/lib/fog/ecloud/models/compute/environment.rb +15 -15
- data/lib/fog/ecloud/models/compute/firewall_acl.rb +1 -1
- data/lib/fog/ecloud/models/compute/internet_service.rb +1 -1
- data/lib/fog/ecloud/models/compute/internet_services.rb +1 -1
- data/lib/fog/ecloud/models/compute/location.rb +1 -1
- data/lib/fog/ecloud/models/compute/monitor.rb +1 -1
- data/lib/fog/ecloud/models/compute/network.rb +1 -1
- data/lib/fog/ecloud/models/compute/node.rb +1 -1
- data/lib/fog/ecloud/models/compute/nodes.rb +1 -1
- data/lib/fog/ecloud/models/compute/organization.rb +10 -10
- data/lib/fog/ecloud/models/compute/row.rb +1 -1
- data/lib/fog/ecloud/models/compute/rows.rb +1 -1
- data/lib/fog/ecloud/models/compute/server.rb +9 -9
- data/lib/fog/ecloud/models/compute/templates.rb +3 -1
- data/lib/fog/ecloud/models/compute/user.rb +2 -2
- data/lib/fog/ecloud/models/compute/virtual_machine_assigned_ip.rb +1 -1
- data/lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb +1 -1
- data/lib/fog/google/models/compute/disk.rb +5 -5
- data/lib/fog/google/models/compute/disks.rb +9 -2
- data/lib/fog/hp.rb +108 -19
- data/lib/fog/hp/CHANGELOG.hp +33 -0
- data/lib/fog/hp/block_storage.rb +5 -3
- data/lib/fog/hp/block_storage_v2.rb +164 -0
- data/lib/fog/hp/cdn.rb +3 -2
- data/lib/fog/hp/compute.rb +5 -4
- data/lib/fog/hp/compute_v2.rb +312 -0
- data/lib/fog/hp/dns.rb +135 -0
- data/lib/fog/hp/lb.rb +170 -0
- data/lib/fog/hp/models/block_storage_v2/snapshot.rb +76 -0
- data/lib/fog/hp/models/block_storage_v2/snapshots.rb +43 -0
- data/lib/fog/hp/models/block_storage_v2/volume.rb +139 -0
- data/lib/fog/hp/models/block_storage_v2/volume_backup.rb +58 -0
- data/lib/fog/hp/models/block_storage_v2/volume_backups.rb +42 -0
- data/lib/fog/hp/models/block_storage_v2/volumes.rb +42 -0
- data/lib/fog/hp/models/compute/image.rb +1 -1
- data/lib/fog/hp/models/compute/server.rb +41 -20
- data/lib/fog/hp/models/compute_v2/address.rb +70 -0
- data/lib/fog/hp/models/compute_v2/addresses.rb +29 -0
- data/lib/fog/hp/models/compute_v2/availability_zone.rb +22 -0
- data/lib/fog/hp/models/compute_v2/availability_zones.rb +29 -0
- data/lib/fog/hp/models/compute_v2/flavor.rb +22 -0
- data/lib/fog/hp/models/compute_v2/flavors.rb +42 -0
- data/lib/fog/hp/models/compute_v2/image.rb +87 -0
- data/lib/fog/hp/models/compute_v2/images.rb +43 -0
- data/lib/fog/hp/models/compute_v2/key_pair.rb +54 -0
- data/lib/fog/hp/models/compute_v2/key_pairs.rb +31 -0
- data/lib/fog/hp/models/compute_v2/meta.rb +29 -0
- data/lib/fog/hp/models/compute_v2/meta_parent.rb +33 -0
- data/lib/fog/hp/models/compute_v2/metadata.rb +79 -0
- data/lib/fog/hp/models/compute_v2/server.rb +339 -0
- data/lib/fog/hp/models/compute_v2/servers.rb +56 -0
- data/lib/fog/hp/models/compute_v2/volume_attachment.rb +42 -0
- data/lib/fog/hp/models/compute_v2/volume_attachments.rb +30 -0
- data/lib/fog/hp/models/dns/domain.rb +55 -0
- data/lib/fog/hp/models/dns/domains.rb +28 -0
- data/lib/fog/hp/models/dns/record.rb +59 -0
- data/lib/fog/hp/models/dns/records.rb +32 -0
- data/lib/fog/hp/models/lb/algorithm.rb +24 -0
- data/lib/fog/hp/models/lb/algorithms.rb +26 -0
- data/lib/fog/hp/models/lb/load_balancer.rb +83 -0
- data/lib/fog/hp/models/lb/load_balancers.rb +26 -0
- data/lib/fog/hp/models/lb/node.rb +53 -0
- data/lib/fog/hp/models/lb/nodes.rb +30 -0
- data/lib/fog/hp/models/lb/protocol.rb +25 -0
- data/lib/fog/hp/models/lb/protocols.rb +26 -0
- data/lib/fog/hp/models/lb/virtual_ip.rb +34 -0
- data/lib/fog/hp/models/lb/virtual_ips.rb +33 -0
- data/lib/fog/hp/models/network/floating_ip.rb +45 -0
- data/lib/fog/hp/models/network/floating_ips.rb +36 -0
- data/lib/fog/hp/models/network/network.rb +56 -0
- data/lib/fog/hp/models/network/networks.rb +36 -0
- data/lib/fog/hp/models/network/port.rb +54 -0
- data/lib/fog/hp/models/network/ports.rb +36 -0
- data/lib/fog/hp/models/network/router.rb +66 -0
- data/lib/fog/hp/models/network/routers.rb +36 -0
- data/lib/fog/hp/models/network/security_group.rb +30 -0
- data/lib/fog/hp/models/network/security_group_rule.rb +35 -0
- data/lib/fog/hp/models/network/security_group_rules.rb +36 -0
- data/lib/fog/hp/models/network/security_groups.rb +36 -0
- data/lib/fog/hp/models/network/subnet.rb +49 -0
- data/lib/fog/hp/models/network/subnets.rb +36 -0
- data/lib/fog/hp/models/storage/directories.rb +1 -1
- data/lib/fog/hp/models/storage/directory.rb +41 -8
- data/lib/fog/hp/models/storage/meta.rb +29 -0
- data/lib/fog/hp/models/storage/meta_parent.rb +23 -0
- data/lib/fog/hp/models/storage/metadata.rb +82 -0
- data/lib/fog/hp/network.rb +198 -0
- data/lib/fog/hp/requests/block_storage_v2/create_snapshot.rb +76 -0
- data/lib/fog/hp/requests/block_storage_v2/create_volume.rb +90 -0
- data/lib/fog/hp/requests/block_storage_v2/create_volume_backup.rb +83 -0
- data/lib/fog/hp/requests/block_storage_v2/delete_snapshot.rb +38 -0
- data/lib/fog/hp/requests/block_storage_v2/delete_volume.rb +38 -0
- data/lib/fog/hp/requests/block_storage_v2/delete_volume_backup.rb +38 -0
- data/lib/fog/hp/requests/block_storage_v2/get_snapshot_details.rb +54 -0
- data/lib/fog/hp/requests/block_storage_v2/get_volume_backup_details.rb +55 -0
- data/lib/fog/hp/requests/block_storage_v2/get_volume_details.rb +58 -0
- data/lib/fog/hp/requests/block_storage_v2/list_snapshots.rb +57 -0
- data/lib/fog/hp/requests/block_storage_v2/list_snapshots_detail.rb +54 -0
- data/lib/fog/hp/requests/block_storage_v2/list_volume_backups.rb +52 -0
- data/lib/fog/hp/requests/block_storage_v2/list_volume_backups_detail.rb +58 -0
- data/lib/fog/hp/requests/block_storage_v2/list_volumes.rb +61 -0
- data/lib/fog/hp/requests/block_storage_v2/list_volumes_detail.rb +59 -0
- data/lib/fog/hp/requests/block_storage_v2/restore_volume_backup.rb +97 -0
- data/lib/fog/hp/requests/block_storage_v2/update_snapshot.rb +69 -0
- data/lib/fog/hp/requests/block_storage_v2/update_volume.rb +70 -0
- data/lib/fog/hp/requests/compute/get_console_output.rb +0 -2
- data/lib/fog/hp/requests/compute/get_vnc_console.rb +45 -0
- data/lib/fog/hp/requests/compute_v2/add_security_group.rb +40 -0
- data/lib/fog/hp/requests/compute_v2/allocate_address.rb +53 -0
- data/lib/fog/hp/requests/compute_v2/associate_address.rb +46 -0
- data/lib/fog/hp/requests/compute_v2/attach_volume.rb +80 -0
- data/lib/fog/hp/requests/compute_v2/create_image.rb +63 -0
- data/lib/fog/hp/requests/compute_v2/create_key_pair.rb +73 -0
- data/lib/fog/hp/requests/compute_v2/create_persistent_server.rb +183 -0
- data/lib/fog/hp/requests/compute_v2/create_server.rb +168 -0
- data/lib/fog/hp/requests/compute_v2/delete_image.rb +44 -0
- data/lib/fog/hp/requests/compute_v2/delete_key_pair.rb +38 -0
- data/lib/fog/hp/requests/compute_v2/delete_meta.rb +55 -0
- data/lib/fog/hp/requests/compute_v2/delete_server.rb +43 -0
- data/lib/fog/hp/requests/compute_v2/detach_volume.rb +47 -0
- data/lib/fog/hp/requests/compute_v2/disassociate_address.rb +39 -0
- data/lib/fog/hp/requests/compute_v2/get_address.rb +48 -0
- data/lib/fog/hp/requests/compute_v2/get_console_output.rb +41 -0
- data/lib/fog/hp/requests/compute_v2/get_flavor_details.rb +57 -0
- data/lib/fog/hp/requests/compute_v2/get_image_details.rb +55 -0
- data/lib/fog/hp/requests/compute_v2/get_key_pair.rb +44 -0
- data/lib/fog/hp/requests/compute_v2/get_meta.rb +57 -0
- data/lib/fog/hp/requests/compute_v2/get_server_details.rb +72 -0
- data/lib/fog/hp/requests/compute_v2/get_server_volume_details.rb +47 -0
- data/lib/fog/hp/requests/compute_v2/get_vnc_console.rb +45 -0
- data/lib/fog/hp/requests/compute_v2/get_windows_password.rb +43 -0
- data/lib/fog/hp/requests/compute_v2/list_addresses.rb +44 -0
- data/lib/fog/hp/requests/compute_v2/list_availability_zones.rb +47 -0
- data/lib/fog/hp/requests/compute_v2/list_flavors.rb +53 -0
- data/lib/fog/hp/requests/compute_v2/list_flavors_detail.rb +53 -0
- data/lib/fog/hp/requests/compute_v2/list_images.rb +52 -0
- data/lib/fog/hp/requests/compute_v2/list_images_detail.rb +66 -0
- data/lib/fog/hp/requests/compute_v2/list_key_pairs.rb +42 -0
- data/lib/fog/hp/requests/compute_v2/list_limits.rb +62 -0
- data/lib/fog/hp/requests/compute_v2/list_metadata.rb +56 -0
- data/lib/fog/hp/requests/compute_v2/list_server_addresses.rb +42 -0
- data/lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb +46 -0
- data/lib/fog/hp/requests/compute_v2/list_server_volumes.rb +49 -0
- data/lib/fog/hp/requests/compute_v2/list_servers.rb +53 -0
- data/lib/fog/hp/requests/compute_v2/list_servers_detail.rb +80 -0
- data/lib/fog/hp/requests/compute_v2/reboot_server.rb +34 -0
- data/lib/fog/hp/requests/compute_v2/rebuild_server.rb +82 -0
- data/lib/fog/hp/requests/compute_v2/release_address.rb +38 -0
- data/lib/fog/hp/requests/compute_v2/remove_security_group.rb +37 -0
- data/lib/fog/hp/requests/compute_v2/server_action.rb +25 -0
- data/lib/fog/hp/requests/compute_v2/set_metadata.rb +60 -0
- data/lib/fog/hp/requests/compute_v2/update_meta.rb +61 -0
- data/lib/fog/hp/requests/compute_v2/update_metadata.rb +60 -0
- data/lib/fog/hp/requests/compute_v2/update_server.rb +73 -0
- data/lib/fog/hp/requests/dns/create_domain.rb +66 -0
- data/lib/fog/hp/requests/dns/create_record.rb +79 -0
- data/lib/fog/hp/requests/dns/delete_domain.rb +37 -0
- data/lib/fog/hp/requests/dns/delete_record.rb +36 -0
- data/lib/fog/hp/requests/dns/get_domain.rb +43 -0
- data/lib/fog/hp/requests/dns/get_record.rb +47 -0
- data/lib/fog/hp/requests/dns/get_servers_hosting_domain.rb +62 -0
- data/lib/fog/hp/requests/dns/list_domains.rb +38 -0
- data/lib/fog/hp/requests/dns/list_records_in_a_domain.rb +55 -0
- data/lib/fog/hp/requests/dns/update_domain.rb +62 -0
- data/lib/fog/hp/requests/dns/update_record.rb +70 -0
- data/lib/fog/hp/requests/lb/create_load_balancer.rb +110 -0
- data/lib/fog/hp/requests/lb/create_load_balancer_node.rb +72 -0
- data/lib/fog/hp/requests/lb/delete_load_balancer.rb +36 -0
- data/lib/fog/hp/requests/lb/delete_load_balancer_node.rb +47 -0
- data/lib/fog/hp/requests/lb/get_load_balancer.rb +60 -0
- data/lib/fog/hp/requests/lb/get_load_balancer_node.rb +54 -0
- data/lib/fog/hp/requests/lb/list_algorithms.rb +32 -0
- data/lib/fog/hp/requests/lb/list_limits.rb +40 -0
- data/lib/fog/hp/requests/lb/list_load_balancer_nodes.rb +41 -0
- data/lib/fog/hp/requests/lb/list_load_balancer_virtual_ips.rb +44 -0
- data/lib/fog/hp/requests/lb/list_load_balancers.rb +41 -0
- data/lib/fog/hp/requests/lb/list_protocols.rb +34 -0
- data/lib/fog/hp/requests/lb/list_versions.rb +27 -0
- data/lib/fog/hp/requests/lb/update_load_balancer.rb +47 -0
- data/lib/fog/hp/requests/lb/update_load_balancer_node.rb +59 -0
- data/lib/fog/hp/requests/network/add_router_interface.rb +75 -0
- data/lib/fog/hp/requests/network/associate_floating_ip.rb +71 -0
- data/lib/fog/hp/requests/network/create_floating_ip.rb +69 -0
- data/lib/fog/hp/requests/network/create_network.rb +68 -0
- data/lib/fog/hp/requests/network/create_port.rb +92 -0
- data/lib/fog/hp/requests/network/create_router.rb +64 -0
- data/lib/fog/hp/requests/network/create_security_group.rb +100 -0
- data/lib/fog/hp/requests/network/create_security_group_rule.rb +83 -0
- data/lib/fog/hp/requests/network/create_subnet.rb +97 -0
- data/lib/fog/hp/requests/network/delete_floating_ip.rb +34 -0
- data/lib/fog/hp/requests/network/delete_network.rb +34 -0
- data/lib/fog/hp/requests/network/delete_port.rb +34 -0
- data/lib/fog/hp/requests/network/delete_router.rb +34 -0
- data/lib/fog/hp/requests/network/delete_security_group.rb +36 -0
- data/lib/fog/hp/requests/network/delete_security_group_rule.rb +36 -0
- data/lib/fog/hp/requests/network/delete_subnet.rb +34 -0
- data/lib/fog/hp/requests/network/disassociate_floating_ip.rb +71 -0
- data/lib/fog/hp/requests/network/get_floating_ip.rb +47 -0
- data/lib/fog/hp/requests/network/get_network.rb +49 -0
- data/lib/fog/hp/requests/network/get_port.rb +53 -0
- data/lib/fog/hp/requests/network/get_router.rb +46 -0
- data/lib/fog/hp/requests/network/get_security_group.rb +56 -0
- data/lib/fog/hp/requests/network/get_security_group_rule.rb +51 -0
- data/lib/fog/hp/requests/network/get_subnet.rb +52 -0
- data/lib/fog/hp/requests/network/list_floating_ips.rb +46 -0
- data/lib/fog/hp/requests/network/list_networks.rb +48 -0
- data/lib/fog/hp/requests/network/list_ports.rb +52 -0
- data/lib/fog/hp/requests/network/list_routers.rb +45 -0
- data/lib/fog/hp/requests/network/list_security_group_rules.rb +52 -0
- data/lib/fog/hp/requests/network/list_security_groups.rb +57 -0
- data/lib/fog/hp/requests/network/list_subnets.rb +51 -0
- data/lib/fog/hp/requests/network/remove_router_interface.rb +67 -0
- data/lib/fog/hp/requests/network/update_network.rb +62 -0
- data/lib/fog/hp/requests/network/update_port.rb +75 -0
- data/lib/fog/hp/requests/network/update_router.rb +62 -0
- data/lib/fog/hp/requests/network/update_subnet.rb +72 -0
- data/lib/fog/hp/requests/storage/post_container.rb +38 -0
- data/lib/fog/hp/requests/storage/post_object.rb +56 -0
- data/lib/fog/hp/simple_http_instrumentor.rb +59 -0
- data/lib/fog/hp/storage.rb +6 -6
- data/lib/fog/internet_archive/models/storage/file.rb +1 -1
- data/lib/fog/internet_archive/requests/storage/head_object.rb +2 -2
- data/lib/fog/openstack/identity.rb +1 -1
- data/lib/fog/openstack/models/storage/file.rb +1 -1
- data/lib/fog/rackspace.rb +4 -1
- data/lib/fog/rackspace/docs/compute_v2.md +2 -2
- data/lib/fog/rackspace/docs/storage.md +1 -1
- data/lib/fog/rackspace/examples/compute_v2/create_image.rb +1 -1
- data/lib/fog/rackspace/examples/compute_v2/delete_image.rb +1 -1
- data/lib/fog/rackspace/examples/compute_v2/delete_server.rb +1 -1
- data/lib/fog/rackspace/examples/compute_v2/detach_volume.rb +2 -2
- data/lib/fog/rackspace/examples/compute_v2/resize_server.rb +1 -1
- data/lib/fog/rackspace/examples/compute_v2/server_attachments.rb +1 -1
- data/lib/fog/rackspace/examples/storage/create_cdn_directory.rb +1 -1
- data/lib/fog/rackspace/examples/storage/delete_directory.rb +1 -1
- data/lib/fog/rackspace/examples/storage/delete_file.rb +1 -1
- data/lib/fog/rackspace/examples/storage/download_file.rb +1 -1
- data/lib/fog/rackspace/models/compute_v2/images.rb +1 -1
- data/lib/fog/rackspace/models/compute_v2/metadata.rb +2 -2
- data/lib/fog/rackspace/models/compute_v2/server.rb +2 -2
- data/lib/fog/rackspace/models/compute_v2/servers.rb +1 -1
- data/lib/fog/rackspace/models/storage/file.rb +19 -0
- data/lib/fog/rackspace/models/storage/files.rb +25 -0
- data/lib/fog/rackspace/monitoring.rb +20 -1
- data/lib/fog/rackspace/requests/compute_v2/delete_image.rb +1 -1
- data/lib/fog/rackspace/requests/compute_v2/list_metadata.rb +1 -1
- data/lib/fog/rackspace/requests/compute_v2/list_servers.rb +1 -1
- data/lib/fog/rackspace/requests/compute_v2/resize_server.rb +1 -1
- data/lib/fog/rackspace/requests/compute_v2/set_metadata.rb +1 -1
- data/lib/fog/rackspace/requests/compute_v2/set_metadata_item.rb +1 -1
- data/lib/fog/rackspace/requests/compute_v2/update_metadata.rb +1 -1
- data/lib/fog/rackspace/requests/monitoring/get_monitoring_zone.rb +15 -0
- data/lib/fog/rackspace/requests/monitoring/list_monitoring_zones.rb +15 -0
- data/lib/fog/rackspace/requests/storage/get_object_http_url.rb +30 -0
- data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +2 -1
- data/lib/fog/rackspace/storage.rb +1 -0
- data/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb +10 -8
- data/lib/fog/vcloud_director/requests/compute/get_edge_gateway.rb +2 -0
- data/lib/fog/vcloud_director/requests/compute/get_task.rb +10 -1
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/compute.rb +1 -0
- data/lib/fog/vsphere/models/compute/server.rb +2 -2
- data/lib/fog/vsphere/models/compute/volume.rb +59 -4
- data/lib/fog/vsphere/models/compute/volumes.rb +22 -7
- data/lib/fog/vsphere/requests/compute/create_vm.rb +9 -3
- data/lib/fog/vsphere/requests/compute/list_vm_volumes.rb +3 -1
- data/lib/fog/vsphere/requests/compute/modify_vm_volume.rb +26 -0
- data/lib/tasks/changelog_task.rb +2 -0
- data/tests/aws/requests/compute/internet_gateway_tests.rb +5 -0
- data/tests/compute/helper.rb +6 -4
- data/tests/ecloud/compute/models/server_tests.rb +34 -41
- data/tests/hp/block_storage_tests.rb +47 -0
- data/tests/hp/cdn_tests.rb +23 -0
- data/tests/hp/compute_tests.rb +22 -0
- data/tests/hp/models/block_storage_v2/snapshot_tests.rb +22 -0
- data/tests/hp/models/block_storage_v2/snapshots_tests.rb +10 -0
- data/tests/hp/models/block_storage_v2/volume_backup_tests.rb +22 -0
- data/tests/hp/models/block_storage_v2/volume_backups_tests.rb +9 -0
- data/tests/hp/models/block_storage_v2/volume_tests.rb +22 -0
- data/tests/hp/models/block_storage_v2/volumes_tests.rb +5 -0
- data/tests/hp/models/compute_v2/address_tests.rb +23 -0
- data/tests/hp/models/compute_v2/addresses_tests.rb +7 -0
- data/tests/hp/models/compute_v2/availability_zone_tests.rb +13 -0
- data/tests/hp/models/compute_v2/availability_zones_tests.rb +13 -0
- data/tests/hp/models/compute_v2/key_pair_tests.rb +29 -0
- data/tests/hp/models/compute_v2/key_pairs_tests.rb +7 -0
- data/tests/hp/models/compute_v2/metadata_image_tests.rb +60 -0
- data/tests/hp/models/compute_v2/metadata_server_tests.rb +56 -0
- data/tests/hp/models/compute_v2/server_tests.rb +45 -0
- data/tests/hp/models/compute_v2/servers_tests.rb +9 -0
- data/tests/hp/models/compute_v2/volume_attachment_tests.rb +40 -0
- data/tests/hp/models/compute_v2/volume_attachments_tests.rb +17 -0
- data/tests/hp/models/dns/domain_tests.rb +25 -0
- data/tests/hp/models/dns/domains_tests.rb +14 -0
- data/tests/hp/models/dns/record_tests.rb +29 -0
- data/tests/hp/models/dns/records_tests.rb +9 -0
- data/tests/hp/models/lb/algorithms_tests.rb +15 -0
- data/tests/hp/models/lb/load_balancer_node_tests.rb +9 -0
- data/tests/hp/models/lb/load_balancer_nodes_tests.rb +27 -0
- data/tests/hp/models/lb/load_balancer_tests.rb +6 -0
- data/tests/hp/models/lb/load_balancer_virtual_ips_tests.rb +22 -0
- data/tests/hp/models/lb/load_balancers_tests.rb +22 -0
- data/tests/hp/models/lb/protocols_tests.rb +15 -0
- data/tests/hp/models/network/floating_ip_tests.rb +37 -0
- data/tests/hp/models/network/floating_ips_tests.rb +8 -0
- data/tests/hp/models/network/network_tests.rb +25 -0
- data/tests/hp/models/network/networks_tests.rb +15 -0
- data/tests/hp/models/network/port_tests.rb +30 -0
- data/tests/hp/models/network/ports_tests.rb +21 -0
- data/tests/hp/models/network/router_tests.rb +55 -0
- data/tests/hp/models/network/routers_tests.rb +19 -0
- data/tests/hp/models/network/security_group_rule_tests.rb +25 -0
- data/tests/hp/models/network/security_group_rules_tests.rb +23 -0
- data/tests/hp/models/network/security_group_tests.rb +20 -0
- data/tests/hp/models/network/security_groups_tests.rb +20 -0
- data/tests/hp/models/network/subnet_tests.rb +30 -0
- data/tests/hp/models/network/subnets_tests.rb +22 -0
- data/tests/hp/models/storage/directory_tests.rb +70 -0
- data/tests/hp/requests/block_storage_v2/snapshot_tests.rb +69 -0
- data/tests/hp/requests/block_storage_v2/volume_backup_tests.rb +117 -0
- data/tests/hp/requests/block_storage_v2/volume_tests.rb +106 -0
- data/tests/hp/requests/compute_v2/address_tests.rb +80 -0
- data/tests/hp/requests/compute_v2/availability_zone_tests.rb +19 -0
- data/tests/hp/requests/compute_v2/flavor_tests.rb +45 -0
- data/tests/hp/requests/compute_v2/image_tests.rb +86 -0
- data/tests/hp/requests/compute_v2/key_pair_tests.rb +66 -0
- data/tests/hp/requests/compute_v2/metadata_tests.rb +101 -0
- data/tests/hp/requests/compute_v2/persistent_server_tests.rb +67 -0
- data/tests/hp/requests/compute_v2/server_address_tests.rb +46 -0
- data/tests/hp/requests/compute_v2/server_security_group_tests.rb +43 -0
- data/tests/hp/requests/compute_v2/server_tests.rb +113 -0
- data/tests/hp/requests/compute_v2/server_volume_tests.rb +85 -0
- data/tests/hp/requests/dns/domain_tests.rb +72 -0
- data/tests/hp/requests/dns/records_tests.rb +65 -0
- data/tests/hp/requests/lb/algorithms_tests.rb +15 -0
- data/tests/hp/requests/lb/limits_tests.rb +18 -0
- data/tests/hp/requests/lb/load_balancer_nodes_tests.rb +47 -0
- data/tests/hp/requests/lb/load_balancer_tests.rb +56 -0
- data/tests/hp/requests/lb/protocols_tests.rb +15 -0
- data/tests/hp/requests/lb/versions_tests.rb +17 -0
- data/tests/hp/requests/lb/virtual_ips_tests.rb +34 -0
- data/tests/hp/requests/network/floating_ip_tests.rb +70 -0
- data/tests/hp/requests/network/network_tests.rb +57 -0
- data/tests/hp/requests/network/port_tests.rb +71 -0
- data/tests/hp/requests/network/router_tests.rb +108 -0
- data/tests/hp/requests/network/security_group_rule_tests.rb +58 -0
- data/tests/hp/requests/network/security_group_tests.rb +48 -0
- data/tests/hp/requests/network/subnet_tests.rb +71 -0
- data/tests/hp/requests/storage/container_tests.rb +9 -1
- data/tests/hp/requests/storage/object_tests.rb +15 -1
- data/tests/hp/storage_tests.rb +25 -0
- data/tests/rackspace/cdn_tests.rb +1 -1
- data/tests/rackspace/models/compute_v2/metadata_tests.rb +1 -1
- data/tests/rackspace/models/identity/service_catalog_tests.rb +1 -1
- data/tests/rackspace/models/storage/file_tests.rb +19 -6
- data/tests/rackspace/models/storage/files_tests.rb +44 -0
- data/tests/rackspace/requests/monitoring/helper.rb +64 -0
- data/tests/rackspace/requests/monitoring/list_tests.rb +14 -2
- data/tests/rackspace/requests/storage/large_object_tests.rb +8 -6
- data/tests/rackspace/requests/storage/object_tests.rb +11 -0
- data/tests/rackspace/storage_tests.rb +4 -4
- data/tests/vcloud_director/requests/compute/edge_gateway_tests.rb +48 -44
- data/tests/vcloud_director/requests/compute/network_tests.rb +2 -0
- metadata +356 -5
data/lib/fog/hp/dns.rb
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
require 'fog/hp'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module HP
|
5
|
+
class DNS < Fog::Service
|
6
|
+
|
7
|
+
requires :hp_access_key, :hp_secret_key, :hp_tenant_id, :hp_avl_zone
|
8
|
+
recognizes :hp_auth_uri, :credentials, :hp_service_type
|
9
|
+
recognizes :persistent, :connection_options
|
10
|
+
recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
|
11
|
+
|
12
|
+
secrets :hp_secret_key
|
13
|
+
|
14
|
+
model_path 'fog/hp/models/dns'
|
15
|
+
model :domain
|
16
|
+
collection :domains
|
17
|
+
model :record
|
18
|
+
collection :records
|
19
|
+
|
20
|
+
request_path 'fog/hp/requests/dns'
|
21
|
+
request :create_domain
|
22
|
+
request :create_record
|
23
|
+
request :delete_domain
|
24
|
+
request :delete_record
|
25
|
+
request :get_domain
|
26
|
+
request :get_record
|
27
|
+
request :get_servers_hosting_domain
|
28
|
+
request :list_domains
|
29
|
+
request :list_records_in_a_domain
|
30
|
+
request :update_domain
|
31
|
+
request :update_record
|
32
|
+
|
33
|
+
class Mock
|
34
|
+
|
35
|
+
def self.data
|
36
|
+
@data ||= Hash.new do |hash, key|
|
37
|
+
hash[key] = {
|
38
|
+
:domains => {},
|
39
|
+
:records => {}
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.reset
|
45
|
+
@data = nil
|
46
|
+
end
|
47
|
+
|
48
|
+
def initialize(options={})
|
49
|
+
@hp_access_key = options[:hp_access_key]
|
50
|
+
end
|
51
|
+
|
52
|
+
def data
|
53
|
+
self.class.data[@hp_access_key]
|
54
|
+
end
|
55
|
+
|
56
|
+
def reset_data
|
57
|
+
self.class.data.delete(@hp_access_key)
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
class Real
|
63
|
+
attr_reader :credentials
|
64
|
+
|
65
|
+
def initialize(options={})
|
66
|
+
@hp_access_key = options[:hp_access_key]
|
67
|
+
@hp_secret_key = options[:hp_secret_key]
|
68
|
+
@hp_auth_uri = options[:hp_auth_uri]
|
69
|
+
@connection_options = options[:connection_options] || {}
|
70
|
+
### Set an option to use the style of authentication desired; :v1 or :v2 (default)
|
71
|
+
auth_version = options[:hp_auth_version] || :v2
|
72
|
+
### Pass the service name for object storage to the authentication call
|
73
|
+
options[:hp_service_type] ||= "DNS"
|
74
|
+
@hp_tenant_id = options[:hp_tenant_id]
|
75
|
+
@hp_avl_zone = options[:hp_avl_zone]
|
76
|
+
|
77
|
+
### Make the authentication call
|
78
|
+
if (auth_version == :v2)
|
79
|
+
# Call the control services authentication
|
80
|
+
credentials = Fog::HP.authenticate_v2(options, @connection_options)
|
81
|
+
# the CS service catalog returns the block storage endpoint
|
82
|
+
@hp_block_uri = credentials[:endpoint_url]
|
83
|
+
@credentials = credentials
|
84
|
+
else
|
85
|
+
# Call the legacy v1.0/v1.1 authentication
|
86
|
+
credentials = Fog::HP.authenticate_v1(options, @connection_options)
|
87
|
+
# the user sends in the block storage endpoint
|
88
|
+
@hp_block_uri = options[:hp_auth_uri]
|
89
|
+
end
|
90
|
+
|
91
|
+
@auth_token = credentials[:auth_token]
|
92
|
+
@persistent = options[:persistent] || false
|
93
|
+
|
94
|
+
uri = URI.parse(@hp_block_uri)
|
95
|
+
@host = uri.host
|
96
|
+
@path = uri.path
|
97
|
+
@port = uri.port
|
98
|
+
@scheme = uri.scheme
|
99
|
+
|
100
|
+
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
101
|
+
end
|
102
|
+
|
103
|
+
def reload
|
104
|
+
@connection.reset
|
105
|
+
end
|
106
|
+
|
107
|
+
def request(params, parse_json = true, &block)
|
108
|
+
begin
|
109
|
+
response = @connection.request(params.merge!({
|
110
|
+
:headers => {
|
111
|
+
'Content-Type' => 'application/json',
|
112
|
+
'Accept' => 'application/json',
|
113
|
+
'X-Auth-Token' => @auth_token
|
114
|
+
}.merge!(params[:headers] || {}),
|
115
|
+
:path => "#{@path}/#{params[:path]}",
|
116
|
+
}), &block)
|
117
|
+
rescue Excon::Errors::HTTPStatusError => error
|
118
|
+
raise case error
|
119
|
+
when Excon::Errors::NotFound
|
120
|
+
Fog::HP::DNS::NotFound.slurp(error)
|
121
|
+
else
|
122
|
+
error
|
123
|
+
end
|
124
|
+
end
|
125
|
+
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
126
|
+
response.body = Fog::JSON.decode(response.body)
|
127
|
+
end
|
128
|
+
response
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
data/lib/fog/hp/lb.rb
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
require 'fog/hp'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module HP
|
5
|
+
class LB < Fog::Service
|
6
|
+
|
7
|
+
requires :hp_access_key, :hp_secret_key, :hp_tenant_id, :hp_avl_zone
|
8
|
+
recognizes :hp_auth_uri, :credentials, :hp_service_type
|
9
|
+
recognizes :persistent, :connection_options
|
10
|
+
recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
|
11
|
+
|
12
|
+
secrets :hp_secret_key
|
13
|
+
|
14
|
+
model_path 'fog/hp/models/lb'
|
15
|
+
model :algorithm
|
16
|
+
collection :algorithms
|
17
|
+
model :load_balancer
|
18
|
+
collection :load_balancers
|
19
|
+
model :node
|
20
|
+
collection :nodes
|
21
|
+
model :protocol
|
22
|
+
collection :protocols
|
23
|
+
model :virtual_ip
|
24
|
+
collection :virtual_ips
|
25
|
+
|
26
|
+
request_path 'fog/hp/requests/lb'
|
27
|
+
request :create_load_balancer
|
28
|
+
request :create_load_balancer_node
|
29
|
+
request :delete_load_balancer
|
30
|
+
request :delete_load_balancer_node
|
31
|
+
request :get_load_balancer
|
32
|
+
request :get_load_balancer_node
|
33
|
+
request :list_algorithms
|
34
|
+
request :list_limits
|
35
|
+
request :list_load_balancer_nodes
|
36
|
+
request :list_load_balancer_virtual_ips
|
37
|
+
request :list_load_balancers
|
38
|
+
request :list_protocols
|
39
|
+
request :list_versions
|
40
|
+
request :update_load_balancer
|
41
|
+
request :update_load_balancer_node
|
42
|
+
|
43
|
+
class Mock
|
44
|
+
|
45
|
+
|
46
|
+
def self.data
|
47
|
+
@data ||= Hash.new do |hash, key|
|
48
|
+
hash[key] = {
|
49
|
+
:versions => {
|
50
|
+
"v1.1" => { "id" => "v1.1",
|
51
|
+
"links" => [{"href" => "http://api-docs.hpcloud.com", "rel" => "self"}],
|
52
|
+
"status" => "CURRENT",
|
53
|
+
"updated" => "2012-12-18T18:30:02.25Z"
|
54
|
+
}
|
55
|
+
},
|
56
|
+
:limits => {
|
57
|
+
"absolute" => {
|
58
|
+
"values" => {
|
59
|
+
"maxLoadBalancerNameLength" => 128,
|
60
|
+
"maxLoadBalancers" => 20,
|
61
|
+
"maxNodesPerLoadBalancer" => 5,
|
62
|
+
"maxVIPsPerLoadBalancer" => 1
|
63
|
+
}
|
64
|
+
}
|
65
|
+
},
|
66
|
+
:lbs => {},
|
67
|
+
:protocols => {
|
68
|
+
"HTTP" => { "name" => "HTTP", "port" => 80 },
|
69
|
+
"TCP" => { "name" => "TCP", "port" => 443 }
|
70
|
+
},
|
71
|
+
:algorithms => {
|
72
|
+
"ROUND_ROBIN" => { "name" => "ROUND_ROBIN" },
|
73
|
+
"LEAST_CONNECTIONS" => { "name" => "LEAST_CONNECTIONS"}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.reset
|
80
|
+
@data = nil
|
81
|
+
end
|
82
|
+
|
83
|
+
def initialize(options={})
|
84
|
+
@hp_access_key = options[:hp_access_key]
|
85
|
+
end
|
86
|
+
|
87
|
+
def data
|
88
|
+
self.class.data[@hp_access_key]
|
89
|
+
end
|
90
|
+
|
91
|
+
def reset_data
|
92
|
+
self.class.data.delete(@hp_access_key)
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
class Real
|
98
|
+
attr_reader :credentials
|
99
|
+
|
100
|
+
|
101
|
+
def initialize(options={})
|
102
|
+
@hp_access_key = options[:hp_access_key]
|
103
|
+
@hp_secret_key = options[:hp_secret_key]
|
104
|
+
@hp_auth_uri = options[:hp_auth_uri]
|
105
|
+
@connection_options = options[:connection_options] || {}
|
106
|
+
### Set an option to use the style of authentication desired; :v1 or :v2 (default)
|
107
|
+
auth_version = options[:hp_auth_version] || :v2
|
108
|
+
### Pass the service name for object storage to the authentication call
|
109
|
+
options[:hp_service_type] ||= "Load Balancer"
|
110
|
+
@hp_tenant_id = options[:hp_tenant_id]
|
111
|
+
@hp_avl_zone = options[:hp_avl_zone]
|
112
|
+
|
113
|
+
### Make the authentication call
|
114
|
+
if (auth_version == :v2)
|
115
|
+
# Call the control services authentication
|
116
|
+
credentials = Fog::HP.authenticate_v2(options, @connection_options)
|
117
|
+
# the CS service catalog returns the block storage endpoint
|
118
|
+
@hp_block_uri = credentials[:endpoint_url]
|
119
|
+
else
|
120
|
+
# Call the legacy v1.0/v1.1 authentication
|
121
|
+
credentials = Fog::HP.authenticate_v1(options, @connection_options)
|
122
|
+
# the user sends in the block storage endpoint
|
123
|
+
@hp_block_uri = options[:hp_auth_uri]
|
124
|
+
end
|
125
|
+
|
126
|
+
@auth_token = credentials[:auth_token]
|
127
|
+
@persistent = options[:persistent] || false
|
128
|
+
|
129
|
+
uri = URI.parse(@hp_block_uri)
|
130
|
+
@host = uri.host
|
131
|
+
@path = uri.path
|
132
|
+
@port = uri.port
|
133
|
+
@scheme = uri.scheme
|
134
|
+
|
135
|
+
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
136
|
+
end
|
137
|
+
|
138
|
+
def reload
|
139
|
+
@connection.reset
|
140
|
+
end
|
141
|
+
|
142
|
+
def request(params, parse_json = true, &block)
|
143
|
+
begin
|
144
|
+
response = @connection.request(params.merge!({
|
145
|
+
:headers => {
|
146
|
+
'Content-Type' => 'application/json',
|
147
|
+
'Accept' => 'application/json',
|
148
|
+
'X-Auth-Token' => @auth_token
|
149
|
+
}.merge!(params[:headers] || {}),
|
150
|
+
:path => "#{@path}/#{params[:path]}",
|
151
|
+
}), &block)
|
152
|
+
rescue Excon::Errors::HTTPStatusError => error
|
153
|
+
raise case error
|
154
|
+
when Excon::Errors::NotFound
|
155
|
+
Fog::HP::LB::NotFound.slurp(error)
|
156
|
+
else
|
157
|
+
error
|
158
|
+
end
|
159
|
+
end
|
160
|
+
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
161
|
+
response.body = Fog::JSON.decode(response.body)
|
162
|
+
end
|
163
|
+
response
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module HP
|
5
|
+
class BlockStorageV2
|
6
|
+
|
7
|
+
class Snapshot < Fog::Model
|
8
|
+
|
9
|
+
identity :id
|
10
|
+
|
11
|
+
attribute :name, :aliases => 'display_name'
|
12
|
+
attribute :description, :aliases => 'display_description'
|
13
|
+
attribute :size
|
14
|
+
attribute :status
|
15
|
+
attribute :created_at
|
16
|
+
attribute :volume_id
|
17
|
+
attribute :metadata
|
18
|
+
|
19
|
+
def initialize(attributes = {})
|
20
|
+
# assign these attributes first to prevent race condition with persisted?
|
21
|
+
self.force = attributes.delete(:force) # force snapshotting of attached volumes
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
def destroy
|
26
|
+
requires :id
|
27
|
+
service.delete_snapshot(id)
|
28
|
+
true
|
29
|
+
end
|
30
|
+
|
31
|
+
def force=(new_force)
|
32
|
+
@force = new_force
|
33
|
+
end
|
34
|
+
|
35
|
+
def ready?
|
36
|
+
self.status == 'available'
|
37
|
+
end
|
38
|
+
|
39
|
+
def save
|
40
|
+
identity ? update : create
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def create
|
46
|
+
requires :volume_id
|
47
|
+
options = {
|
48
|
+
'display_name' => name,
|
49
|
+
'display_description' => description,
|
50
|
+
'force' => @force,
|
51
|
+
'metadata' => metadata
|
52
|
+
}
|
53
|
+
options = options.reject {|_, value| value.nil?}
|
54
|
+
data = service.create_snapshot(volume_id, options)
|
55
|
+
merge_attributes(data.body['snapshot'])
|
56
|
+
true
|
57
|
+
end
|
58
|
+
|
59
|
+
def update
|
60
|
+
requires :id
|
61
|
+
options = {
|
62
|
+
'display_name' => name,
|
63
|
+
'display_description' => description,
|
64
|
+
'metadata' => metadata
|
65
|
+
}
|
66
|
+
options = options.reject {|_, value| value.nil?}
|
67
|
+
data = service.update_snapshot(id, options)
|
68
|
+
merge_attributes(data.body['snapshot'])
|
69
|
+
true
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/hp/models/block_storage_v2/snapshot'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module HP
|
6
|
+
class BlockStorageV2
|
7
|
+
|
8
|
+
class Snapshots < Fog::Collection
|
9
|
+
|
10
|
+
attribute :filters
|
11
|
+
|
12
|
+
model Fog::HP::BlockStorageV2::Snapshot
|
13
|
+
|
14
|
+
def initialize(attributes)
|
15
|
+
self.filters ||= {}
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def all(filters = filters)
|
20
|
+
details = filters.delete(:details)
|
21
|
+
self.filters = filters
|
22
|
+
non_aliased_filters = Fog::HP.convert_aliased_attributes_to_original(self.model, filters)
|
23
|
+
if details
|
24
|
+
data = service.list_snapshots_detail(non_aliased_filters).body['snapshots']
|
25
|
+
else
|
26
|
+
data = service.list_snapshots(non_aliased_filters).body['snapshots']
|
27
|
+
end
|
28
|
+
load(data)
|
29
|
+
end
|
30
|
+
|
31
|
+
def get(snapshot_id)
|
32
|
+
if snapshot = service.get_snapshot_details(snapshot_id).body['snapshot']
|
33
|
+
new(snapshot)
|
34
|
+
end
|
35
|
+
rescue Fog::HP::BlockStorageV2::NotFound
|
36
|
+
nil
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module HP
|
5
|
+
class BlockStorageV2
|
6
|
+
|
7
|
+
class Volume < Fog::Model
|
8
|
+
|
9
|
+
identity :id
|
10
|
+
|
11
|
+
attribute :name, :aliases => 'display_name'
|
12
|
+
attribute :description, :aliases => 'display_description'
|
13
|
+
attribute :size
|
14
|
+
attribute :status
|
15
|
+
attribute :type, :aliases => 'volume_type'
|
16
|
+
attribute :created_at
|
17
|
+
attribute :availability_zone
|
18
|
+
attribute :snapshot_id
|
19
|
+
attribute :source_volid
|
20
|
+
attribute :attachments
|
21
|
+
attribute :metadata
|
22
|
+
attribute :bootable
|
23
|
+
attribute :image_metadata, :aliases => 'volume_image_metadata'
|
24
|
+
|
25
|
+
def initialize(attributes = {})
|
26
|
+
# assign these attributes first to prevent race condition with new_record?
|
27
|
+
self.image_id = attributes.delete(:image_id)
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
# a volume can be attached to only one server at a time
|
32
|
+
def device
|
33
|
+
attachments[0]['device'] if has_attachments?
|
34
|
+
end
|
35
|
+
|
36
|
+
# a volume can be attached to only one server at a time
|
37
|
+
def server_id
|
38
|
+
attachments[0]['server_id'] if has_attachments?
|
39
|
+
end
|
40
|
+
|
41
|
+
# used for creating bootable volumes
|
42
|
+
def image_id=(new_image_id)
|
43
|
+
@image_id = new_image_id
|
44
|
+
end
|
45
|
+
|
46
|
+
def image_id
|
47
|
+
@image_id = image_metadata['image_id'] if image_metadata
|
48
|
+
end
|
49
|
+
|
50
|
+
# a volume can be attached to only one server at a time
|
51
|
+
def has_attachments?
|
52
|
+
!(attachments.nil? || attachments.empty? || attachments[0].empty?)
|
53
|
+
end
|
54
|
+
|
55
|
+
def in_use?
|
56
|
+
self.status == 'in-use'
|
57
|
+
end
|
58
|
+
alias :attached? :in_use?
|
59
|
+
|
60
|
+
def backing_up?
|
61
|
+
self.status == 'backing-up'
|
62
|
+
end
|
63
|
+
|
64
|
+
def restoring?
|
65
|
+
self.status == 'restoring-backup'
|
66
|
+
end
|
67
|
+
|
68
|
+
def ready?
|
69
|
+
self.status == 'available'
|
70
|
+
end
|
71
|
+
|
72
|
+
# volume can be attached to only one server at a time
|
73
|
+
def attach(new_server_id, device)
|
74
|
+
requires :id
|
75
|
+
unless in_use?
|
76
|
+
data = service.compute.attach_volume(new_server_id, id, device)
|
77
|
+
merge_attributes(:attachments => attachments << data.body['volumeAttachment'])
|
78
|
+
true
|
79
|
+
else
|
80
|
+
false
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def detach
|
85
|
+
requires :id
|
86
|
+
if has_attachments?
|
87
|
+
service.compute.detach_volume(self.server_id, id)
|
88
|
+
end
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
def destroy
|
93
|
+
requires :id
|
94
|
+
service.delete_volume(id)
|
95
|
+
true
|
96
|
+
end
|
97
|
+
|
98
|
+
def save
|
99
|
+
identity ? update : create
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
103
|
+
|
104
|
+
def create
|
105
|
+
options = {
|
106
|
+
'display_name' => name,
|
107
|
+
'display_description' => description,
|
108
|
+
'size' => size,
|
109
|
+
'metadata' => metadata,
|
110
|
+
'snapshot_id' => snapshot_id,
|
111
|
+
'imageRef' => @image_id,
|
112
|
+
'availability_zone' => availability_zone,
|
113
|
+
'source_volid' => source_volid,
|
114
|
+
'volume_type' => type # this parameter is currently ignored
|
115
|
+
}
|
116
|
+
options = options.reject {|_, value| value.nil?}
|
117
|
+
data = service.create_volume(options)
|
118
|
+
merge_attributes(data.body['volume'])
|
119
|
+
true
|
120
|
+
end
|
121
|
+
|
122
|
+
def update
|
123
|
+
requires :id
|
124
|
+
options = {
|
125
|
+
'display_name' => name,
|
126
|
+
'display_description' => description,
|
127
|
+
'metadata' => metadata
|
128
|
+
}
|
129
|
+
options = options.reject {|_, value| value.nil?}
|
130
|
+
data = service.update_volume(id, options)
|
131
|
+
merge_attributes(data.body['volume'])
|
132
|
+
true
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|