fog 1.10.1 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +1 -0
- data/Gemfile +2 -0
- data/README.md +4 -3
- data/changelog.txt +207 -0
- data/fog.gemspec +4 -3
- data/lib/fog/aws.rb +0 -2
- data/lib/fog/aws/dynamodb.rb +1 -1
- data/lib/fog/aws/elasticache.rb +0 -2
- data/lib/fog/aws/iam.rb +1 -0
- data/lib/fog/aws/models/compute/volume.rb +1 -0
- data/lib/fog/aws/models/iam/user.rb +1 -0
- data/lib/fog/aws/models/storage/directories.rb +1 -1
- data/lib/fog/aws/models/storage/directory.rb +20 -17
- data/lib/fog/aws/models/storage/file.rb +4 -5
- data/lib/fog/aws/parsers/iam/get_user.rb +2 -0
- data/lib/fog/aws/parsers/iam/list_users.rb +2 -0
- data/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb +2 -2
- data/lib/fog/aws/requests/cdn/put_distribution_config.rb +3 -3
- data/lib/fog/aws/requests/cloud_formation/update_stack.rb +3 -3
- data/lib/fog/aws/requests/cloud_formation/validate_template.rb +5 -5
- data/lib/fog/aws/requests/iam/create_user.rb +5 -4
- data/lib/fog/aws/requests/iam/get_user.rb +5 -4
- data/lib/fog/aws/requests/iam/list_users.rb +5 -4
- data/lib/fog/aws/requests/rds/create_db_instance.rb +25 -25
- data/lib/fog/aws/requests/storage/abort_multipart_upload.rb +3 -3
- data/lib/fog/aws/requests/storage/complete_multipart_upload.rb +2 -2
- data/lib/fog/aws/requests/storage/copy_object.rb +2 -2
- data/lib/fog/aws/requests/storage/delete_bucket.rb +1 -1
- data/lib/fog/aws/requests/storage/delete_bucket_cors.rb +1 -1
- data/lib/fog/aws/requests/storage/delete_bucket_lifecycle.rb +1 -1
- data/lib/fog/aws/requests/storage/delete_bucket_policy.rb +1 -1
- data/lib/fog/aws/requests/storage/delete_bucket_website.rb +1 -1
- data/lib/fog/aws/requests/storage/delete_multiple_objects.rb +1 -1
- data/lib/fog/aws/requests/storage/delete_object.rb +1 -1
- data/lib/fog/aws/requests/storage/get_bucket.rb +1 -1
- data/lib/fog/aws/requests/storage/get_bucket_acl.rb +1 -1
- data/lib/fog/aws/requests/storage/get_bucket_cors.rb +1 -1
- data/lib/fog/aws/requests/storage/get_bucket_lifecycle.rb +1 -1
- data/lib/fog/aws/requests/storage/get_bucket_location.rb +1 -1
- data/lib/fog/aws/requests/storage/get_bucket_logging.rb +1 -1
- data/lib/fog/aws/requests/storage/get_bucket_object_versions.rb +1 -1
- data/lib/fog/aws/requests/storage/get_bucket_policy.rb +1 -1
- data/lib/fog/aws/requests/storage/get_bucket_versioning.rb +1 -1
- data/lib/fog/aws/requests/storage/get_bucket_website.rb +1 -1
- data/lib/fog/aws/requests/storage/get_object.rb +2 -2
- data/lib/fog/aws/requests/storage/get_object_acl.rb +2 -2
- data/lib/fog/aws/requests/storage/get_object_http_url.rb +1 -19
- data/lib/fog/aws/requests/storage/get_object_torrent.rb +2 -2
- data/lib/fog/aws/requests/storage/get_object_url.rb +5 -14
- data/lib/fog/aws/requests/storage/get_request_payment.rb +1 -1
- data/lib/fog/aws/requests/storage/head_object.rb +2 -2
- data/lib/fog/aws/requests/storage/initiate_multipart_upload.rb +2 -2
- data/lib/fog/aws/requests/storage/list_multipart_uploads.rb +7 -8
- data/lib/fog/aws/requests/storage/list_parts.rb +2 -2
- data/lib/fog/aws/requests/storage/put_bucket.rb +1 -1
- data/lib/fog/aws/requests/storage/put_bucket_acl.rb +1 -1
- data/lib/fog/aws/requests/storage/put_bucket_cors.rb +1 -1
- data/lib/fog/aws/requests/storage/put_bucket_lifecycle.rb +1 -1
- data/lib/fog/aws/requests/storage/put_bucket_logging.rb +1 -1
- data/lib/fog/aws/requests/storage/put_bucket_policy.rb +1 -1
- data/lib/fog/aws/requests/storage/put_bucket_versioning.rb +1 -1
- data/lib/fog/aws/requests/storage/put_bucket_website.rb +1 -1
- data/lib/fog/aws/requests/storage/put_object.rb +2 -2
- data/lib/fog/aws/requests/storage/put_object_acl.rb +8 -8
- data/lib/fog/aws/requests/storage/put_object_url.rb +5 -7
- data/lib/fog/aws/requests/storage/put_request_payment.rb +1 -1
- data/lib/fog/aws/requests/storage/upload_part.rb +2 -2
- data/lib/fog/aws/storage.rb +201 -97
- data/lib/fog/bin/google.rb +47 -1
- data/lib/fog/bluebox/models/compute/server.rb +3 -1
- data/lib/fog/brightbox/compute.rb +11 -26
- data/lib/fog/brightbox/compute/image_selector.rb +45 -0
- data/lib/fog/cloudstack/compute.rb +70 -2
- data/lib/fog/cloudstack/models/compute/disk_offering.rb +46 -0
- data/lib/fog/cloudstack/models/compute/disk_offerings.rb +27 -0
- data/lib/fog/cloudstack/models/compute/image.rb +1 -1
- data/lib/fog/cloudstack/models/compute/servers.rb +3 -2
- data/lib/fog/cloudstack/requests/compute/create_disk_offering.rb +51 -0
- data/lib/fog/cloudstack/requests/compute/delete_disk_offering.rb +31 -0
- data/lib/fog/cloudstack/requests/compute/delete_snapshot.rb +44 -2
- data/lib/fog/cloudstack/requests/compute/list_disk_offerings.rb +9 -0
- data/lib/fog/cloudstack/requests/compute/list_os_types.rb +9 -0
- data/lib/fog/cloudstack/requests/compute/list_snapshots.rb +21 -0
- data/lib/fog/core/errors.rb +3 -0
- data/lib/fog/core/json.rb +48 -7
- data/lib/fog/core/model.rb +11 -10
- data/lib/fog/core/service.rb +1 -1
- data/lib/fog/digitalocean/CHANGELOG.md +1 -1
- data/lib/fog/dreamhost/dns.rb +1 -3
- data/lib/fog/google.rb +1 -0
- data/lib/fog/google/compute.rb +131 -0
- data/lib/fog/google/models/compute/flavor.rb +24 -0
- data/lib/fog/google/models/compute/flavors.rb +28 -0
- data/lib/fog/google/models/compute/image.rb +19 -0
- data/lib/fog/google/models/compute/images.rb +28 -0
- data/lib/fog/google/models/compute/server.rb +80 -0
- data/lib/fog/google/models/compute/servers.rb +61 -0
- data/lib/fog/google/requests/compute/delete_disk.rb +31 -0
- data/lib/fog/google/requests/compute/delete_firewall.rb +30 -0
- data/lib/fog/google/requests/compute/delete_image.rb +30 -0
- data/lib/fog/google/requests/compute/delete_network.rb +30 -0
- data/lib/fog/google/requests/compute/delete_operation.rb +30 -0
- data/lib/fog/google/requests/compute/delete_server.rb +40 -0
- data/lib/fog/google/requests/compute/get_disk.rb +31 -0
- data/lib/fog/google/requests/compute/get_firewall.rb +30 -0
- data/lib/fog/google/requests/compute/get_image.rb +30 -0
- data/lib/fog/google/requests/compute/get_machine_type.rb +30 -0
- data/lib/fog/google/requests/compute/get_network.rb +30 -0
- data/lib/fog/google/requests/compute/get_server.rb +31 -0
- data/lib/fog/google/requests/compute/get_zone.rb +30 -0
- data/lib/fog/google/requests/compute/insert_disk.rb +35 -0
- data/lib/fog/google/requests/compute/insert_firewall.rb +37 -0
- data/lib/fog/google/requests/compute/insert_image.rb +38 -0
- data/lib/fog/google/requests/compute/insert_network.rb +34 -0
- data/lib/fog/google/requests/compute/insert_server.rb +49 -0
- data/lib/fog/google/requests/compute/list_disks.rb +30 -0
- data/lib/fog/google/requests/compute/list_firewalls.rb +29 -0
- data/lib/fog/google/requests/compute/list_global_operations.rb +28 -0
- data/lib/fog/google/requests/compute/list_images.rb +29 -0
- data/lib/fog/google/requests/compute/list_machine_types.rb +29 -0
- data/lib/fog/google/requests/compute/list_networks.rb +29 -0
- data/lib/fog/google/requests/compute/list_servers.rb +30 -0
- data/lib/fog/google/requests/compute/list_zone_operations.rb +28 -0
- data/lib/fog/google/requests/compute/list_zones.rb +29 -0
- data/lib/fog/google/requests/compute/set_metadata.rb +36 -0
- data/lib/fog/hp.rb +1 -1
- data/lib/fog/hp/storage.rb +1 -1
- data/lib/fog/internet_archive/models/storage/ia_attributes.rb +1 -1
- data/lib/fog/internet_archive/requests/storage/head_object.rb +1 -2
- data/lib/fog/internet_archive/requests/storage/list_multipart_uploads.rb +5 -6
- data/lib/fog/openstack.rb +29 -1
- data/lib/fog/openstack/CHANGELOG.md +1 -1
- data/lib/fog/openstack/compute.rb +3 -2
- data/lib/fog/openstack/identity.rb +1 -5
- data/lib/fog/openstack/image.rb +8 -9
- data/lib/fog/openstack/models/compute/server.rb +24 -0
- data/lib/fog/openstack/network.rb +7 -28
- data/lib/fog/openstack/requests/compute/allocate_address.rb +1 -1
- data/lib/fog/openstack/requests/compute/attach_volume.rb +11 -6
- 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 +1 -1
- data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_volume.rb +15 -14
- data/lib/fog/openstack/requests/compute/create_volume_snapshot.rb +1 -1
- data/lib/fog/openstack/requests/compute/delete_volume.rb +9 -2
- data/lib/fog/openstack/requests/compute/detach_volume.rb +7 -2
- data/lib/fog/openstack/requests/compute/get_server_volumes.rb +10 -0
- data/lib/fog/openstack/requests/compute/get_volume_details.rb +7 -16
- data/lib/fog/openstack/requests/compute/list_tenants.rb +1 -1
- data/lib/fog/openstack/requests/compute/list_volumes.rb +4 -26
- data/lib/fog/openstack/requests/compute/revert_resize_server.rb +2 -2
- 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/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_quota.rb +31 -0
- data/lib/fog/openstack/requests/volume/get_quota_defaults.rb +31 -0
- data/lib/fog/openstack/requests/volume/update_quota.rb +32 -0
- data/lib/fog/openstack/volume.rb +11 -7
- data/lib/fog/rackspace.rb +11 -5
- data/lib/fog/rackspace/block_storage.rb +2 -1
- data/lib/fog/rackspace/cdn.rb +15 -15
- data/lib/fog/rackspace/compute.rb +2 -2
- data/lib/fog/rackspace/compute_v2.rb +8 -5
- data/lib/fog/rackspace/databases.rb +2 -1
- data/lib/fog/rackspace/dns.rb +2 -1
- data/lib/fog/rackspace/errors.rb +27 -0
- data/lib/fog/rackspace/load_balancers.rb +2 -1
- data/lib/fog/rackspace/mock_data.rb +5 -6
- data/lib/fog/rackspace/models/block_storage/snapshot.rb +8 -8
- data/lib/fog/rackspace/models/block_storage/snapshots.rb +8 -8
- data/lib/fog/rackspace/models/block_storage/volume.rb +16 -16
- data/lib/fog/rackspace/models/block_storage/volume_types.rb +8 -8
- data/lib/fog/rackspace/models/block_storage/volumes.rb +8 -8
- data/lib/fog/rackspace/models/compute_v2/attachment.rb +8 -8
- data/lib/fog/rackspace/models/compute_v2/attachments.rb +8 -8
- data/lib/fog/rackspace/models/compute_v2/flavors.rb +8 -8
- data/lib/fog/rackspace/models/compute_v2/image.rb +8 -8
- data/lib/fog/rackspace/models/compute_v2/images.rb +8 -8
- data/lib/fog/rackspace/models/compute_v2/metadata.rb +12 -12
- data/lib/fog/rackspace/models/compute_v2/metadatum.rb +8 -8
- data/lib/fog/rackspace/models/compute_v2/server.rb +94 -55
- data/lib/fog/rackspace/models/compute_v2/servers.rb +12 -12
- data/lib/fog/rackspace/models/dns/records.rb +1 -1
- data/lib/fog/rackspace/models/dns/zones.rb +1 -1
- data/lib/fog/rackspace/models/storage/account.rb +8 -8
- data/lib/fog/rackspace/models/storage/directories.rb +8 -8
- data/lib/fog/rackspace/models/storage/directory.rb +32 -32
- data/lib/fog/rackspace/models/storage/file.rb +36 -36
- data/lib/fog/rackspace/models/storage/files.rb +20 -20
- data/lib/fog/rackspace/requests/block_storage/create_snapshot.rb +4 -4
- data/lib/fog/rackspace/requests/block_storage/create_volume.rb +4 -4
- data/lib/fog/rackspace/requests/block_storage/delete_snapshot.rb +4 -4
- data/lib/fog/rackspace/requests/block_storage/delete_volume.rb +4 -4
- data/lib/fog/rackspace/requests/block_storage/get_snapshot.rb +4 -4
- data/lib/fog/rackspace/requests/block_storage/get_volume.rb +4 -4
- data/lib/fog/rackspace/requests/block_storage/get_volume_type.rb +4 -4
- data/lib/fog/rackspace/requests/block_storage/list_snapshots.rb +4 -4
- data/lib/fog/rackspace/requests/block_storage/list_volume_types.rb +4 -4
- data/lib/fog/rackspace/requests/block_storage/list_volumes.rb +4 -4
- data/lib/fog/rackspace/requests/cdn/delete_object.rb +4 -4
- data/lib/fog/rackspace/requests/cdn/get_containers.rb +4 -4
- data/lib/fog/rackspace/requests/cdn/head_container.rb +4 -4
- data/lib/fog/rackspace/requests/cdn/post_container.rb +4 -4
- data/lib/fog/rackspace/requests/cdn/put_container.rb +4 -4
- data/lib/fog/rackspace/requests/compute/delete_image.rb +1 -1
- data/lib/fog/rackspace/requests/compute_v2/attach_volume.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/change_server_password.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/confirm_resize_server.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/create_image.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/create_server.rb +11 -5
- data/lib/fog/rackspace/requests/compute_v2/delete_attachment.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/delete_image.rb +5 -4
- data/lib/fog/rackspace/requests/compute_v2/delete_metadata_item.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/delete_server.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/get_attachment.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/get_flavor.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/get_image.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/get_metadata_item.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/get_server.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/list_addresses.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/list_addresses_by_network.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/list_attachments.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/list_flavors.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/list_images.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/list_metadata.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/list_servers.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/reboot_server.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/rebuild_server.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/rescue_server.rb +43 -0
- data/lib/fog/rackspace/requests/compute_v2/resize_server.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/revert_resize_server.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/set_metadata.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/set_metadata_item.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/unrescue_server.rb +40 -0
- data/lib/fog/rackspace/requests/compute_v2/update_metadata.rb +4 -4
- data/lib/fog/rackspace/requests/compute_v2/update_server.rb +4 -4
- data/lib/fog/rackspace/requests/storage/copy_object.rb +4 -4
- data/lib/fog/rackspace/requests/storage/delete_container.rb +4 -4
- data/lib/fog/rackspace/requests/storage/delete_object.rb +4 -4
- data/lib/fog/rackspace/requests/storage/get_container.rb +4 -4
- data/lib/fog/rackspace/requests/storage/get_containers.rb +4 -4
- data/lib/fog/rackspace/requests/storage/get_object.rb +4 -4
- data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +4 -4
- data/lib/fog/rackspace/requests/storage/head_container.rb +4 -4
- data/lib/fog/rackspace/requests/storage/head_containers.rb +4 -4
- data/lib/fog/rackspace/requests/storage/head_object.rb +4 -4
- data/lib/fog/rackspace/requests/storage/post_set_meta_temp_url_key.rb +4 -4
- data/lib/fog/rackspace/requests/storage/put_container.rb +4 -4
- data/lib/fog/rackspace/requests/storage/put_object.rb +4 -4
- data/lib/fog/rackspace/requests/storage/put_object_manifest.rb +4 -4
- data/lib/fog/rackspace/service.rb +1 -1
- data/lib/fog/rackspace/storage.rb +12 -6
- data/lib/fog/riakcs.rb +3 -3
- 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 -1
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/compute.rb +21 -14
- data/lib/fog/vsphere/models/compute/networks.rb +2 -2
- data/lib/fog/vsphere/models/compute/server.rb +10 -0
- data/lib/fog/vsphere/requests/compute/get_resource_pool.rb +1 -1
- data/lib/fog/vsphere/requests/compute/get_template.rb +16 -0
- data/lib/fog/vsphere/requests/compute/list_datacenters.rb +1 -1
- data/lib/fog/vsphere/requests/compute/list_templates.rb +49 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +9 -6
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +41 -27
- data/lib/fog/xenserver/CHANGELOG.md +1 -1
- data/lib/fog/xenserver/models/compute/network.rb +2 -2
- data/lib/tasks/changelog_task.rb +2 -1
- data/tests/aws/models/storage/directory_tests.rb +41 -5
- data/tests/aws/models/storage/file_tests.rb +1 -2
- data/tests/aws/models/storage/files_tests.rb +6 -4
- data/tests/aws/models/storage/url_tests.rb +7 -5
- data/tests/aws/models/storage/version_tests.rb +2 -2
- data/tests/aws/models/storage/versions_tests.rb +5 -5
- data/tests/aws/requests/iam/user_tests.rb +10 -8
- data/tests/aws/requests/storage/multipart_upload_tests.rb +1 -1
- data/tests/aws/requests/storage/object_tests.rb +15 -13
- data/tests/brightbox/compute/image_selector_tests.rb +103 -0
- data/tests/cloudstack/compute/models/disk_offering_tests.rb +5 -0
- data/tests/cloudstack/compute/models/snapshot_tests.rb +5 -20
- data/tests/cloudstack/requests/disk_offering_tests.rb +3 -3
- data/tests/cloudstack/requests/os_type_tests.rb +2 -3
- data/tests/compute/helper.rb +9 -0
- data/tests/core/json_tests.rb +62 -0
- data/tests/dynect/requests/dns/dns_tests.rb +0 -3
- data/tests/google/models/compute/server_tests.rb +24 -0
- data/tests/google/requests/compute/disk_tests.rb +88 -0
- data/tests/google/requests/compute/firewall_tests.rb +85 -0
- data/tests/google/requests/compute/image_tests.rb +80 -0
- data/tests/google/requests/compute/network_tests.rb +74 -0
- data/tests/google/requests/compute/operation_tests.rb +19 -0
- data/tests/google/requests/compute/server_tests.rb +84 -0
- data/tests/google/requests/compute/zone_tests.rb +46 -0
- data/tests/helpers/mock_helper.rb +4 -0
- data/tests/openstack/models/compute/server_tests.rb +91 -1
- data/tests/openstack/requests/compute/volume_tests.rb +11 -9
- data/tests/openstack/requests/volume/quota_tests.rb +51 -0
- data/tests/openstack/version_tests.rb +55 -0
- data/tests/rackspace/helper.rb +10 -0
- data/tests/rackspace/models/compute_v2/server_tests.rb +26 -1
- data/tests/rackspace/requests/compute/image_tests.rb +1 -1
- data/tests/rackspace/requests/compute_v2/image_tests.rb +2 -2
- data/tests/rackspace/requests/compute_v2/server_tests.rb +13 -0
- data/tests/rackspace/requests/dns/dns_tests.rb +1 -1
- data/tests/rackspace/requests/dns/records_tests.rb +3 -3
- data/tests/vsphere/requests/compute/vm_clone_tests.rb +10 -0
- metadata +109 -747
data/lib/fog/bin/google.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
module Google # deviates from other bin stuff to accomodate gem
|
2
2
|
class << self
|
3
3
|
|
4
4
|
def class_for(key)
|
5
5
|
case key
|
6
|
+
when :compute
|
7
|
+
Fog::Compute::Google
|
6
8
|
when :storage
|
7
9
|
Fog::Storage::Google
|
8
10
|
else
|
@@ -16,6 +18,9 @@ class Google < Fog::Bin
|
|
16
18
|
when :storage
|
17
19
|
Fog::Logger.warning("Google[:storage] is not recommended, use Storage[:google] for portability")
|
18
20
|
Fog::Storage.new(:provider => 'Google')
|
21
|
+
when :compute
|
22
|
+
Fog::Logger.warning("Google[:compute] is not recommended, use Compute[:google] for portability")
|
23
|
+
Fog::Compute.new(:provider => 'Google')
|
19
24
|
else
|
20
25
|
raise ArgumentError, "Unrecognized service: #{key.inspect}"
|
21
26
|
end
|
@@ -23,9 +28,50 @@ class Google < Fog::Bin
|
|
23
28
|
@@connections[service]
|
24
29
|
end
|
25
30
|
|
31
|
+
def account
|
32
|
+
@@connections[:compute].account
|
33
|
+
end
|
34
|
+
|
26
35
|
def services
|
27
36
|
Fog::Google.services
|
28
37
|
end
|
29
38
|
|
39
|
+
# based off of virtual_box.rb
|
40
|
+
def available?
|
41
|
+
# Make sure the gem we use is enabled.
|
42
|
+
availability = if Gem::Specification.respond_to?(:find_all_by_name)
|
43
|
+
!Gem::Specification.find_all_by_name('google-api-client').empty? # newest rubygems
|
44
|
+
else
|
45
|
+
!Gem.source_index.find_name('google-api-client').empty? # legacy
|
46
|
+
end
|
47
|
+
|
48
|
+
# Then make sure we have all of the requirements
|
49
|
+
for service in services
|
50
|
+
begin
|
51
|
+
service = self.class_for(service)
|
52
|
+
availability &&= service.requirements.all? { |requirement| Fog.credentials.include?(requirement) }
|
53
|
+
rescue ArgumentError => e
|
54
|
+
Fog::Logger.warning(e.message)
|
55
|
+
availability = false
|
56
|
+
rescue => e
|
57
|
+
availability = false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
if availability
|
62
|
+
for service in services
|
63
|
+
for collection in self.class_for(service).collections
|
64
|
+
unless self.respond_to?(collection)
|
65
|
+
self.class_eval <<-EOS, __FILE__, __LINE__
|
66
|
+
def self.#{collection}
|
67
|
+
self[:#{service}].#{collection}
|
68
|
+
end
|
69
|
+
EOS
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
availability
|
75
|
+
end
|
30
76
|
end
|
31
77
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'fog/brightbox'
|
2
2
|
require 'fog/compute'
|
3
3
|
require 'fog/brightbox/oauth2'
|
4
|
+
require 'fog/brightbox/compute/image_selector'
|
4
5
|
|
5
6
|
module Fog
|
6
7
|
module Compute
|
@@ -268,13 +269,15 @@ module Fog
|
|
268
269
|
|
269
270
|
# Returns an identifier for the default image for use
|
270
271
|
#
|
271
|
-
# Currently tries to find the latest version Ubuntu
|
272
|
-
#
|
272
|
+
# Currently tries to find the latest version of Ubuntu (i686) from
|
273
|
+
# Brightbox.
|
273
274
|
#
|
274
275
|
# Highly recommended that you actually select the image you want to run
|
275
276
|
# on your servers yourself!
|
276
277
|
#
|
277
|
-
# @return [String,
|
278
|
+
# @return [String] if image is found, returns the identifier
|
279
|
+
# @return [NilClass] if no image is found or an error occurs
|
280
|
+
#
|
278
281
|
def default_image
|
279
282
|
return @default_image_id unless @default_image_id.nil?
|
280
283
|
@default_image_id = Fog.credentials[:brightbox_default_image] || select_default_image
|
@@ -458,30 +461,12 @@ module Fog
|
|
458
461
|
|
459
462
|
# Queries the API and tries to select the most suitable official Image
|
460
463
|
# to use if the user chooses not to select their own.
|
464
|
+
#
|
465
|
+
# @return [String] if image is found, the image's identifier
|
466
|
+
# @return [NilClass] if no image found or an error occured
|
467
|
+
#
|
461
468
|
def select_default_image
|
462
|
-
|
463
|
-
|
464
|
-
all_images = list_images
|
465
|
-
official_images = all_images.select {|img| img["official"] == true}
|
466
|
-
ubuntu_lts_images = official_images.select {|img| img["name"] =~ /Ubuntu.*LTS/}
|
467
|
-
ubuntu_lts_i686_images = ubuntu_lts_images.select {|img| img["arch"] == "i686"}
|
468
|
-
|
469
|
-
if ubuntu_lts_i686_images.empty?
|
470
|
-
# Accept other architectures
|
471
|
-
if ubuntu_lts_images.empty?
|
472
|
-
# Accept non-LTS versions of Ubuntu
|
473
|
-
unsorted_images = official_images.select {|img| img["name"] =~ /Ubuntu/}
|
474
|
-
else
|
475
|
-
unsorted_images = ubuntu_lts_images
|
476
|
-
end
|
477
|
-
else
|
478
|
-
unsorted_images = ubuntu_lts_i686_images
|
479
|
-
end
|
480
|
-
|
481
|
-
# Get the latest and use it's ID for the default image
|
482
|
-
@default_image_id = unsorted_images.sort {|a,b| a["created_at"] <=> b["created_at"]}.first["id"]
|
483
|
-
rescue
|
484
|
-
nil
|
469
|
+
Fog::Brightbox::Compute::ImageSelector.new(list_images).latest_ubuntu
|
485
470
|
end
|
486
471
|
end
|
487
472
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Fog
|
2
|
+
module Brightbox
|
3
|
+
module Compute
|
4
|
+
#
|
5
|
+
# This selects the preferred image to use based on a number of
|
6
|
+
# conditions
|
7
|
+
#
|
8
|
+
class ImageSelector
|
9
|
+
# Prepares a selector with the API output
|
10
|
+
#
|
11
|
+
# @param [Array<Hash>] images hash matching API output for {Fog::Compute::Brightbox#list_images}
|
12
|
+
#
|
13
|
+
def initialize(images)
|
14
|
+
@images = images
|
15
|
+
end
|
16
|
+
|
17
|
+
# Returns current identifier of the latest version of Ubuntu
|
18
|
+
#
|
19
|
+
# The order of preference is:
|
20
|
+
# * Only Official Brightbox images
|
21
|
+
# * Only Ubuntu images
|
22
|
+
# * Latest by name (alphanumeric sort)
|
23
|
+
# * Latest by creation date
|
24
|
+
#
|
25
|
+
# @note This performs a live query against the API
|
26
|
+
#
|
27
|
+
# @return [String] if image matches containing the identifier
|
28
|
+
# @return [NilClass] if no image matches
|
29
|
+
#
|
30
|
+
def latest_ubuntu
|
31
|
+
@images.select do |img|
|
32
|
+
img["official"] == true &&
|
33
|
+
img["arch"] == "i686" &&
|
34
|
+
img["name"] =~ /ubuntu/i
|
35
|
+
end.sort do |a,b|
|
36
|
+
# Reverse sort so "raring" > "precise" and "13.10" > "13.04"
|
37
|
+
b["name"].downcase <=> a["name"].downcase
|
38
|
+
end.first["id"]
|
39
|
+
rescue
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -19,6 +19,8 @@ module Fog
|
|
19
19
|
|
20
20
|
model_path 'fog/cloudstack/models/compute'
|
21
21
|
model :address
|
22
|
+
model :disk_offering
|
23
|
+
collection :disk_offerings
|
22
24
|
model :flavor
|
23
25
|
collection :flavors
|
24
26
|
model :job
|
@@ -46,6 +48,7 @@ module Fog
|
|
46
48
|
request :authorize_security_group_ingress
|
47
49
|
request :change_service_for_virtual_machine
|
48
50
|
request :create_account
|
51
|
+
request :create_disk_offering
|
49
52
|
request :create_domain
|
50
53
|
request :create_load_balancer_rule
|
51
54
|
request :create_network
|
@@ -58,6 +61,7 @@ module Fog
|
|
58
61
|
request :create_volume
|
59
62
|
request :create_zone
|
60
63
|
request :delete_account
|
64
|
+
request :delete_disk_offering
|
61
65
|
request :delete_domain
|
62
66
|
request :delete_load_balancer_rule
|
63
67
|
request :delete_port_forwarding_rule
|
@@ -420,9 +424,73 @@ module Fog
|
|
420
424
|
:domains => {domain_id => domain},
|
421
425
|
:servers => {},
|
422
426
|
:jobs => {},
|
423
|
-
:volumes => {
|
427
|
+
:volumes => {
|
428
|
+
"89198f7c-0245-aa1d-136a-c5f479ef9db7" => {
|
429
|
+
"id"=> "89198f7c-0245-aa1d-136a-c5f479ef9db7",
|
430
|
+
"name"=>"test volume",
|
431
|
+
"zoneid"=> zone_id,
|
432
|
+
"zonename"=>"zone-00",
|
433
|
+
"type"=>"DATADISK",
|
434
|
+
"deviceid"=>1,
|
435
|
+
"virtualmachineid"=> "51dcffee-5f9f-29a4-acee-2717e1a3656b",
|
436
|
+
"vmname"=>"i-2824-11621-VM",
|
437
|
+
"vmdisplayname"=>"test vm",
|
438
|
+
"vmstate"=>"Running",
|
439
|
+
"size"=>17179869184,
|
440
|
+
"created"=>"2013-04-16T12:33:41+0000",
|
441
|
+
"state"=>"Ready",
|
442
|
+
"account"=> 'accountname',
|
443
|
+
"domainid"=> domain_id,
|
444
|
+
"domain"=> domain_name,
|
445
|
+
"storagetype"=>"shared",
|
446
|
+
"hypervisor"=>"KVM",
|
447
|
+
"diskofferingid"=> "cc4de87d-672d-4353-abb5-6a8a4c0abf59",
|
448
|
+
"diskofferingname"=>"Small Disk",
|
449
|
+
"diskofferingdisplaytext"=>"Small Disk [16GB Disk]",
|
450
|
+
"storage"=>"ps1",
|
451
|
+
"attached"=>"2013-04-16T12:34:07+0000",
|
452
|
+
"destroyed"=>false,
|
453
|
+
"isextractable"=>false
|
454
|
+
},
|
455
|
+
},
|
424
456
|
:security_groups => {},
|
425
|
-
:snapshots => {}
|
457
|
+
:snapshots => {},
|
458
|
+
:disk_offerings => {
|
459
|
+
"cc4de87d-672d-4353-abb5-6a8a4c0abf59" => {
|
460
|
+
"id" => "cc4de87d-672d-4353-abb5-6a8a4c0abf59",
|
461
|
+
"domainid" => domain_id,
|
462
|
+
"domain" => domain_name,
|
463
|
+
"name" => "Small Disk",
|
464
|
+
"displaytext" => "Small Disk [16GB Disk]",
|
465
|
+
"disksize" => 16,
|
466
|
+
"created" => "2013-02-21T03:12:520300",
|
467
|
+
"iscustomized" => false,
|
468
|
+
"storagetype" => "shared"
|
469
|
+
},
|
470
|
+
"d5deeb0c-de03-4ebf-820a-dc74221bcaeb" => {
|
471
|
+
"id" => "d5deeb0c-de03-4ebf-820a-dc74221bcaeb",
|
472
|
+
"domainid" => domain_id,
|
473
|
+
"domain" => domain_name,
|
474
|
+
"name" => "Medium Disk",
|
475
|
+
"displaytext" => "Medium Disk [32GB Disk]",
|
476
|
+
"disksize" => 32,
|
477
|
+
"created" => "2013-02-21T03:12:520300",
|
478
|
+
"iscustomized" => false,
|
479
|
+
"storagetype" => "shared"
|
480
|
+
}
|
481
|
+
},
|
482
|
+
:os_types => {
|
483
|
+
"51ef854d-279e-4e68-9059-74980fd7b29b" => {
|
484
|
+
"id" => "51ef854d-279e-4e68-9059-74980fd7b29b",
|
485
|
+
"oscategoryid" => "56f67279-e082-45c3-a01c-d290d6cd4ce2",
|
486
|
+
"description" => "Asianux 3(32-bit)"
|
487
|
+
},
|
488
|
+
"daf124c8-95d8-4756-8e1c-1871b073babb" => {
|
489
|
+
"id" => "daf124c8-95d8-4756-8e1c-1871b073babb",
|
490
|
+
"oscategoryid" => "56f67279-e082-45c3-a01c-d290d6cd4ce2",
|
491
|
+
"description" => "Asianux 3(64-bit)"
|
492
|
+
}
|
493
|
+
}
|
426
494
|
}
|
427
495
|
end
|
428
496
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Cloudstack
|
4
|
+
class DiskOffering < Fog::Model
|
5
|
+
identity :id, :aliases => 'id'
|
6
|
+
attribute :created
|
7
|
+
attribute :disk_size, :aliases => 'disk_size'
|
8
|
+
attribute :display_text, :aliases => 'display_text'
|
9
|
+
attribute :domain
|
10
|
+
attribute :domain_id, :aliases => 'domainid'
|
11
|
+
attribute :is_customized, :aliases => 'iscustomized'
|
12
|
+
attribute :name
|
13
|
+
attribute :storage_type, :aliases => 'storagetype'
|
14
|
+
attribute :tags
|
15
|
+
|
16
|
+
|
17
|
+
def save
|
18
|
+
requires :display_text, :name
|
19
|
+
|
20
|
+
options = {
|
21
|
+
'displaytext' => display_text,
|
22
|
+
'name' => name,
|
23
|
+
'customized' => is_customized,
|
24
|
+
'disksize' => disk_size,
|
25
|
+
'domain_id' => domain_id,
|
26
|
+
'storagetype' => storage_type,
|
27
|
+
'tags' => tags
|
28
|
+
}
|
29
|
+
|
30
|
+
response = service.create_disk_offering(options)
|
31
|
+
merge_attributes(response['creatediskofferingresponse'])
|
32
|
+
end
|
33
|
+
|
34
|
+
def destroy
|
35
|
+
requires :id
|
36
|
+
|
37
|
+
response = service.delete_disk_offering('id' => id )
|
38
|
+
success_status = response['deletediskofferingresponse']['success']
|
39
|
+
|
40
|
+
success_status == 'true'
|
41
|
+
end
|
42
|
+
|
43
|
+
end # DiskOffering
|
44
|
+
end # Cloudstack
|
45
|
+
end # Compute
|
46
|
+
end # Fog
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/cloudstack/models/compute/disk_offering'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Compute
|
6
|
+
class Cloudstack
|
7
|
+
|
8
|
+
class DiskOfferings < Fog::Collection
|
9
|
+
|
10
|
+
model Fog::Compute::Cloudstack::DiskOffering
|
11
|
+
|
12
|
+
def all(options = {})
|
13
|
+
response = service.list_disk_offerings(options)
|
14
|
+
disk_offerings_data = response["listdiskofferingsresponse"]["diskoffering"] || []
|
15
|
+
load(disk_offerings_data)
|
16
|
+
end
|
17
|
+
|
18
|
+
def get(disk_offering_id)
|
19
|
+
response = service.list_disk_offerings('id' => disk_offering_id)
|
20
|
+
disk_offering_data = response["listdiskofferingsresponse"]["diskoffering"].first
|
21
|
+
new(disk_offering_data)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -26,7 +26,7 @@ module Fog
|
|
26
26
|
attribute :name
|
27
27
|
attribute :os_type_id, :aliases => 'ostypeid'
|
28
28
|
attribute :os_type_name, :aliases => 'ostypename'
|
29
|
-
attribute :password_enabled, :aliases => '
|
29
|
+
attribute :password_enabled, :aliases => 'passwordenabled'
|
30
30
|
attribute :project
|
31
31
|
attribute :project_id, :aliases => 'projectid'
|
32
32
|
attribute :removed
|
@@ -9,8 +9,9 @@ module Fog
|
|
9
9
|
|
10
10
|
model Fog::Compute::Cloudstack::Server
|
11
11
|
|
12
|
-
def all
|
13
|
-
|
12
|
+
def all(attributes={})
|
13
|
+
response = service.list_virtual_machines(attributes)
|
14
|
+
data = response["listvirtualmachinesresponse"]["virtualmachine"] || []
|
14
15
|
load(data)
|
15
16
|
end
|
16
17
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Cloudstack
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# Creates a disk offering.
|
7
|
+
#
|
8
|
+
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.0.0/root_admin/createDiskOffering.html]
|
9
|
+
def create_disk_offering(options={})
|
10
|
+
options.merge!(
|
11
|
+
'command' => 'createDiskOffering'
|
12
|
+
)
|
13
|
+
request(options)
|
14
|
+
end
|
15
|
+
|
16
|
+
end # Real
|
17
|
+
|
18
|
+
class Mock
|
19
|
+
|
20
|
+
def create_disk_offering(options={})
|
21
|
+
disk_offering_id = Fog::Cloudstack.uuid
|
22
|
+
|
23
|
+
first_domain_data = data[:domains].first.last
|
24
|
+
domain_id = options['domainid'] || first_domain_data['id']
|
25
|
+
domain_name = data[:domains][domain_id]['name']
|
26
|
+
|
27
|
+
storage_type = options['storagetype'] || 'shared'
|
28
|
+
customized = options['customized'] || false
|
29
|
+
disk_size = options['disk_size'] || 1
|
30
|
+
|
31
|
+
disk_offering = {
|
32
|
+
"id" => disk_offering_id,
|
33
|
+
"domainid" => domain_id,
|
34
|
+
"domain" => domain_name,
|
35
|
+
"name" => options['name'],
|
36
|
+
"displaytext" => options['display_text'],
|
37
|
+
"disksize" => disk_size,
|
38
|
+
"created" => Time.now.iso8601,
|
39
|
+
"iscustomized" => customized,
|
40
|
+
"storagetype" => storage_type
|
41
|
+
}
|
42
|
+
|
43
|
+
self.data[:disk_offerings][disk_offering_id] = disk_offering
|
44
|
+
|
45
|
+
{'creatediskofferingresponse' => disk_offering}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end # Cloudstack
|
50
|
+
end # Compute
|
51
|
+
end # Fog
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Cloudstack
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# Updates a disk offering.
|
7
|
+
#
|
8
|
+
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.0.0/root_admin/deleteDiskOffering.html]
|
9
|
+
def delete_disk_offering(options={})
|
10
|
+
options.merge!(
|
11
|
+
'command' => 'deleteDiskOffering'
|
12
|
+
)
|
13
|
+
request(options)
|
14
|
+
end
|
15
|
+
|
16
|
+
end # Real
|
17
|
+
|
18
|
+
class Mock
|
19
|
+
|
20
|
+
def delete_disk_offering(options={})
|
21
|
+
disk_offering_id = options['id']
|
22
|
+
data[:disk_offerings].delete(disk_offering_id) if data[:disk_offerings][disk_offering_id]
|
23
|
+
|
24
|
+
{ 'deletediskofferingresponse' => { 'success' => 'true' } }
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end # Cloudstack
|
30
|
+
end # Compute
|
31
|
+
end # Fog
|