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
@@ -3,9 +3,9 @@ module Fog
|
|
3
3
|
class Cloudstack
|
4
4
|
class Real
|
5
5
|
|
6
|
-
# Deletes a specified
|
6
|
+
# Deletes a specified snapshot.
|
7
7
|
#
|
8
|
-
# {CloudStack API Reference}[http://
|
8
|
+
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.0.0/user/deleteSnapshot.html]
|
9
9
|
def delete_snapshot(options={})
|
10
10
|
options.merge!(
|
11
11
|
'command' => 'deleteSnapshot'
|
@@ -15,6 +15,48 @@ module Fog
|
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
+
|
19
|
+
class Mock
|
20
|
+
|
21
|
+
# Deletes a specified snapashot.
|
22
|
+
#
|
23
|
+
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.0.0/user/deleteSnapshot.html]
|
24
|
+
def delete_snapshot(options={})
|
25
|
+
snapshot_id = options['id']
|
26
|
+
snapshots = self.data[:snapshots]
|
27
|
+
|
28
|
+
if snapshots[snapshot_id]
|
29
|
+
|
30
|
+
snapshots.delete(snapshot_id)
|
31
|
+
job_id = add_delete_snapshot_job(snapshot_id)
|
32
|
+
|
33
|
+
{'deletesnapshotresponse' => {'jobid' => job_id}}
|
34
|
+
end
|
35
|
+
# TODO add cases for empty or wrong id
|
36
|
+
end
|
37
|
+
|
38
|
+
def add_delete_snapshot_job(snapshot_id)
|
39
|
+
job_id = Fog::Cloudstack.uuid
|
40
|
+
|
41
|
+
job = {
|
42
|
+
'id' => job_id,
|
43
|
+
'user_id' => self.data[:users].first, # TODO use current user
|
44
|
+
'account_id' => self.data[:accounts].first, # TODO use current user
|
45
|
+
'cmd' => 'com.cloud.api.commands.DeleteSnapshotCmd',
|
46
|
+
'job_status'=> 1,
|
47
|
+
'job_result_type' => nil,
|
48
|
+
'job_result_code' => 0,
|
49
|
+
'job_proc_status' => 0,
|
50
|
+
'created_at' => Time.now.iso8601,
|
51
|
+
'job_result' => { "success" => true }
|
52
|
+
}
|
53
|
+
|
54
|
+
self.data[:jobs][job_id] = job
|
55
|
+
job_id
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
18
60
|
end
|
19
61
|
end
|
20
62
|
end
|
@@ -15,6 +15,15 @@ module Fog
|
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
+
|
19
|
+
class Mock
|
20
|
+
# TODO: add id, name filters and paging params
|
21
|
+
def list_disk_offerings(options={})
|
22
|
+
disk_offerings = self.data[:disk_offerings]
|
23
|
+
{ "listdiskofferingsresponse" => { "count"=> disk_offerings.count, "diskoffering"=> disk_offerings.values } }
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
18
27
|
end
|
19
28
|
end
|
20
29
|
end
|
@@ -15,6 +15,15 @@ module Fog
|
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
+
|
19
|
+
class Mock
|
20
|
+
# TODO: add id, category_id filters and paging params
|
21
|
+
def list_os_types(options={})
|
22
|
+
os_types = self.data[:os_types]
|
23
|
+
{ "listostypesresponse" => { "count"=> os_types.count, "ostype"=> os_types.values } }
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
18
27
|
end
|
19
28
|
end
|
20
29
|
end
|
@@ -15,6 +15,27 @@ module Fog
|
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
|
+
|
19
|
+
class Mock
|
20
|
+
|
21
|
+
def list_snapshots(options={})
|
22
|
+
snapshot_id = options.delete('id')
|
23
|
+
if snapshot_id
|
24
|
+
snapshots = [self.data[:snapshots][snapshot_id]]
|
25
|
+
else
|
26
|
+
snapshots = self.data[:snapshots].values
|
27
|
+
end
|
28
|
+
|
29
|
+
{
|
30
|
+
'listsnapshotsresponse' => {
|
31
|
+
'count' => snapshots.size,
|
32
|
+
'snapshot' => snapshots
|
33
|
+
}
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
18
39
|
end
|
19
40
|
end
|
20
41
|
end
|
data/lib/fog/core/errors.rb
CHANGED
@@ -46,6 +46,9 @@ An alternate file may be used by placing its path in the FOG_RC environment vari
|
|
46
46
|
:clodo_username:
|
47
47
|
:go_grid_api_key:
|
48
48
|
:go_grid_shared_secret:
|
49
|
+
:google_client_email:
|
50
|
+
:google_key_location:
|
51
|
+
:google_project:
|
49
52
|
:google_storage_access_key_id:
|
50
53
|
:google_storage_secret_access_key:
|
51
54
|
:hp_access_key:
|
data/lib/fog/core/json.rb
CHANGED
@@ -1,7 +1,51 @@
|
|
1
|
-
require '
|
1
|
+
require 'singleton'
|
2
|
+
require 'fog/core/logger'
|
2
3
|
|
3
4
|
module Fog
|
4
|
-
|
5
|
+
class JSON
|
6
|
+
include Singleton
|
7
|
+
|
8
|
+
class LoadError < StandardError
|
9
|
+
attr_reader :data
|
10
|
+
def initialize(message='', backtrace=[], data='')
|
11
|
+
super(message)
|
12
|
+
self.set_backtrace(backtrace)
|
13
|
+
@data = data
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module LegacyJSON
|
18
|
+
def encode(obj)
|
19
|
+
::JSON.generate(obj)
|
20
|
+
end
|
21
|
+
|
22
|
+
def decode(obj)
|
23
|
+
::JSON.parse(obj)
|
24
|
+
rescue ::JSON::ParserError => e
|
25
|
+
raise LoadError.new(e.message, e.backtrace, obj)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
module NewJSON
|
30
|
+
def encode(obj)
|
31
|
+
::MultiJson.encode(obj)
|
32
|
+
end
|
33
|
+
|
34
|
+
def decode(obj)
|
35
|
+
::MultiJson.decode(obj)
|
36
|
+
rescue MultiJson::LoadError => e
|
37
|
+
raise LoadError.new(e.message, e.backtrace, obj)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
begin
|
42
|
+
require 'multi_json'
|
43
|
+
include NewJSON
|
44
|
+
rescue Exception
|
45
|
+
Fog::Logger.deprecation "Defaulting to json library for json parsing. Please consider using multi_json library for the greatest performance/flexibility."
|
46
|
+
require 'json'
|
47
|
+
include LegacyJSON
|
48
|
+
end
|
5
49
|
|
6
50
|
def self.sanitize(data)
|
7
51
|
case data
|
@@ -20,15 +64,12 @@ module Fog
|
|
20
64
|
|
21
65
|
# Do the MultiJson introspection at this level so we can define our encode/decode methods and perform
|
22
66
|
# the introspection only once rather than once per call.
|
23
|
-
|
24
67
|
def self.encode(obj)
|
25
|
-
|
68
|
+
Fog::JSON.instance.encode(obj)
|
26
69
|
end
|
27
70
|
|
28
71
|
def self.decode(obj)
|
29
|
-
|
72
|
+
Fog::JSON.instance.decode(obj)
|
30
73
|
end
|
31
|
-
|
32
|
-
|
33
74
|
end
|
34
75
|
end
|
data/lib/fog/core/model.rb
CHANGED
@@ -60,18 +60,19 @@ module Fog
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def wait_for(timeout=Fog.timeout, interval=1, &block)
|
63
|
-
|
64
|
-
|
65
|
-
Fog.wait_for(timeout, interval) do
|
63
|
+
reload_has_succeeded = false
|
64
|
+
duration = Fog.wait_for(timeout, interval) do # Note that duration = false if it times out
|
66
65
|
if reload
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
elsif retries == 0
|
72
|
-
raise Fog::Errors::Error.new("Reload failed, #{self.class} #{self.identity} went away.")
|
66
|
+
reload_has_succeeded = true
|
67
|
+
instance_eval(&block)
|
68
|
+
else
|
69
|
+
false
|
73
70
|
end
|
74
|
-
|
71
|
+
end
|
72
|
+
if reload_has_succeeded
|
73
|
+
return duration # false if timeout; otherwise {:duration => elapsed time }
|
74
|
+
else
|
75
|
+
raise Fog::Errors::Error.new("Reload failed, #{self.class} #{self.identity} not present.")
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
data/lib/fog/core/service.rb
CHANGED
@@ -72,7 +72,7 @@ module Fog
|
|
72
72
|
def fetch_credentials(options)
|
73
73
|
# attempt to load credentials from config file
|
74
74
|
begin
|
75
|
-
|
75
|
+
Fog.credentials.reject {|key, value| !(recognized | requirements).include?(key)}
|
76
76
|
rescue LoadError
|
77
77
|
# if there are no configured credentials, do nothing
|
78
78
|
{}
|
data/lib/fog/dreamhost/dns.rb
CHANGED
@@ -47,8 +47,6 @@ module Fog
|
|
47
47
|
class Real
|
48
48
|
|
49
49
|
def initialize(options={})
|
50
|
-
require 'multi_json'
|
51
|
-
|
52
50
|
@dreamhost_api_key = options[:dreamhost_api_key]
|
53
51
|
if options[:dreamhost_url]
|
54
52
|
uri = URI.parse(options[:dreamhost_url])
|
@@ -73,7 +71,7 @@ module Fog
|
|
73
71
|
response = @connection.request(params)
|
74
72
|
|
75
73
|
unless response.body.empty?
|
76
|
-
response.body =
|
74
|
+
response.body = Fog::JSON.decode(response.body)
|
77
75
|
end
|
78
76
|
if response.body['result'] != 'success'
|
79
77
|
raise response.body['data']
|
data/lib/fog/google.rb
CHANGED
@@ -0,0 +1,131 @@
|
|
1
|
+
require 'fog/google'
|
2
|
+
require 'fog/compute'
|
3
|
+
require 'google/api_client'
|
4
|
+
|
5
|
+
module Fog
|
6
|
+
module Compute
|
7
|
+
class Google < Fog::Service
|
8
|
+
|
9
|
+
requires :google_project
|
10
|
+
requires :google_client_email
|
11
|
+
requires :google_key_location
|
12
|
+
|
13
|
+
request_path 'fog/google/requests/compute'
|
14
|
+
request :list_servers
|
15
|
+
request :list_disks
|
16
|
+
request :list_firewalls
|
17
|
+
request :list_images
|
18
|
+
request :list_machine_types
|
19
|
+
request :list_networks
|
20
|
+
request :list_zones
|
21
|
+
request :list_global_operations
|
22
|
+
request :list_zone_operations
|
23
|
+
|
24
|
+
request :get_server
|
25
|
+
request :get_disk
|
26
|
+
request :get_firewall
|
27
|
+
request :get_image
|
28
|
+
request :get_machine_type
|
29
|
+
request :get_network
|
30
|
+
request :get_zone
|
31
|
+
|
32
|
+
request :delete_disk
|
33
|
+
request :delete_firewall
|
34
|
+
request :delete_image
|
35
|
+
request :delete_network
|
36
|
+
request :delete_operation
|
37
|
+
request :delete_server
|
38
|
+
|
39
|
+
request :insert_disk
|
40
|
+
request :insert_firewall
|
41
|
+
request :insert_image
|
42
|
+
request :insert_network
|
43
|
+
request :insert_server
|
44
|
+
|
45
|
+
model_path 'fog/google/models/compute'
|
46
|
+
model :server
|
47
|
+
collection :servers
|
48
|
+
|
49
|
+
model :image
|
50
|
+
collection :images
|
51
|
+
|
52
|
+
model :flavor
|
53
|
+
collection :flavors
|
54
|
+
|
55
|
+
class Mock
|
56
|
+
include Collections
|
57
|
+
|
58
|
+
def initialize(options)
|
59
|
+
Fog::Mock::not_implemented
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
class Real
|
65
|
+
include Collections
|
66
|
+
|
67
|
+
attr_reader :project
|
68
|
+
|
69
|
+
def initialize(options)
|
70
|
+
base_url = 'https://www.googleapis.com/compute/'
|
71
|
+
api_version = 'v1beta14'
|
72
|
+
api_scope_url = 'https://www.googleapis.com/auth/compute'
|
73
|
+
|
74
|
+
@project = options[:google_project]
|
75
|
+
google_client_email = options[:google_client_email]
|
76
|
+
@api_url = base_url + api_version + '/projects/'
|
77
|
+
key = ::Google::APIClient::KeyUtils.load_from_pkcs12(File.expand_path(options[:google_key_location]), 'notasecret')
|
78
|
+
|
79
|
+
@client = ::Google::APIClient.new({
|
80
|
+
:application_name => "fog",
|
81
|
+
:application_version => Fog::VERSION,
|
82
|
+
})
|
83
|
+
@client.authorization = Signet::OAuth2::Client.new({
|
84
|
+
:audience => 'https://accounts.google.com/o/oauth2/token',
|
85
|
+
:auth_provider_x509_cert_url => "https://www.googleapis.com/oauth2/v1/certs",
|
86
|
+
:client_x509_cert_url => "https://www.googleapis.com/robot/v1/metadata/x509/#{google_client_email}",
|
87
|
+
:issuer => google_client_email,
|
88
|
+
:scope => api_scope_url,
|
89
|
+
:signing_key => key,
|
90
|
+
:token_credential_uri => 'https://accounts.google.com/o/oauth2/token',
|
91
|
+
})
|
92
|
+
@client.authorization.fetch_access_token!
|
93
|
+
|
94
|
+
@compute = @client.discovered_api('compute', api_version)
|
95
|
+
@default_network = 'default'
|
96
|
+
end
|
97
|
+
|
98
|
+
def build_result(api_method, parameters, body_object=nil)
|
99
|
+
if body_object
|
100
|
+
#p api_method, parameters
|
101
|
+
result = @client.execute(
|
102
|
+
:api_method => api_method,
|
103
|
+
:parameters => parameters,
|
104
|
+
:body_object => body_object
|
105
|
+
)
|
106
|
+
else
|
107
|
+
result = @client.execute(
|
108
|
+
:api_method => api_method,
|
109
|
+
:parameters => parameters
|
110
|
+
)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def build_response(result)
|
115
|
+
response = Excon::Response.new
|
116
|
+
response.body = Fog::JSON.decode(result.body)
|
117
|
+
if response.body["error"]
|
118
|
+
response.status = response.body["error"]["code"]
|
119
|
+
else
|
120
|
+
response.status = 200
|
121
|
+
end
|
122
|
+
response
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
RUNNING_STATE = 'RUNNING'
|
128
|
+
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Google
|
6
|
+
|
7
|
+
class Flavor < Fog::Model
|
8
|
+
|
9
|
+
identity :name
|
10
|
+
|
11
|
+
attribute :description
|
12
|
+
attribute :guest_cpus, :aliases => 'guestCpus'
|
13
|
+
attribute :memory_mb, :aliases => 'memoryMb'
|
14
|
+
attribute :image_space_gb, :aliases => 'imageSpaceGb'
|
15
|
+
attribute :maximum_persistent_disks,
|
16
|
+
:aliases => 'maximumPersistentDisks'
|
17
|
+
attribute :maximum_persistent_disks_size,
|
18
|
+
:aliases => 'maximumPersistentDisksSizeGb'
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/google/models/compute/flavor'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Compute
|
6
|
+
class Google
|
7
|
+
|
8
|
+
class Flavors < Fog::Collection
|
9
|
+
|
10
|
+
model Fog::Compute::Google::Flavor
|
11
|
+
|
12
|
+
def all
|
13
|
+
data = connection.list_machine_types.body["items"]
|
14
|
+
load(data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(identity)
|
18
|
+
data = connection.get_machine_type(identity).body
|
19
|
+
new(data)
|
20
|
+
rescue Excon::Errors::NotFound
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|