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
@@ -0,0 +1,31 @@
|
|
1
|
+
module Fog
|
2
|
+
module Volume
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def get_quota(tenant_id)
|
7
|
+
request(
|
8
|
+
:expects => 200,
|
9
|
+
:method => 'GET',
|
10
|
+
:path => "/os-quota-sets/#{tenant_id}"
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
class Mock
|
17
|
+
|
18
|
+
def get_quota(tenant_id)
|
19
|
+
response = Excon::Response.new
|
20
|
+
response.status = 200
|
21
|
+
response.body = {
|
22
|
+
'quota_set' => (self.data[:quota_updated] or self.data[:quota]).merge({'id' => tenant_id})
|
23
|
+
}
|
24
|
+
response
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Fog
|
2
|
+
module Volume
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def get_quota_defaults(tenant_id)
|
7
|
+
request(
|
8
|
+
:expects => 200,
|
9
|
+
:method => 'GET',
|
10
|
+
:path => "/os-quota-sets/#{tenant_id}/defaults"
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
class Mock
|
17
|
+
|
18
|
+
def get_quota_defaults(tenant_id)
|
19
|
+
response = Excon::Response.new
|
20
|
+
response.status = 200
|
21
|
+
response.body = {
|
22
|
+
'quota_set' => self.data[:quota].merge({'id' => tenant_id})
|
23
|
+
}
|
24
|
+
response
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Fog
|
2
|
+
module Volume
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def update_quota(tenant_id, options = {})
|
7
|
+
options['tenant_id'] = tenant_id
|
8
|
+
request(
|
9
|
+
:body => Fog::JSON.encode({ 'quota_set' => options }),
|
10
|
+
:expects => 200,
|
11
|
+
:method => 'PUT',
|
12
|
+
:path => "/os-quota-sets/#{tenant_id}"
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class Mock
|
19
|
+
|
20
|
+
def update_quota(tenant_id, options = {})
|
21
|
+
self.data[:quota_updated] = self.data[:quota].merge options
|
22
|
+
|
23
|
+
response = Excon::Response.new
|
24
|
+
response.status = 200
|
25
|
+
response.body = { 'quota_set' => self.data[:quota_updated] }
|
26
|
+
response
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/fog/openstack/volume.rb
CHANGED
@@ -29,6 +29,10 @@ module Fog
|
|
29
29
|
request :list_snapshots
|
30
30
|
request :get_snapshot_details
|
31
31
|
request :delete_snapshot
|
32
|
+
|
33
|
+
request :update_quota
|
34
|
+
request :get_quota
|
35
|
+
request :get_quota_defaults
|
32
36
|
|
33
37
|
request :set_tenant
|
34
38
|
|
@@ -37,7 +41,12 @@ module Fog
|
|
37
41
|
@data ||= Hash.new do |hash, key|
|
38
42
|
hash[key] = {
|
39
43
|
:users => {},
|
40
|
-
:tenants => {}
|
44
|
+
:tenants => {},
|
45
|
+
:quota => {
|
46
|
+
'gigabytes' => 1000,
|
47
|
+
'volumes' => 10,
|
48
|
+
'snapshots' => 10
|
49
|
+
}
|
41
50
|
}
|
42
51
|
end
|
43
52
|
end
|
@@ -47,7 +56,6 @@ module Fog
|
|
47
56
|
end
|
48
57
|
|
49
58
|
def initialize(options={})
|
50
|
-
require 'multi_json'
|
51
59
|
@openstack_username = options[:openstack_username]
|
52
60
|
@openstack_tenant = options[:openstack_tenant]
|
53
61
|
@openstack_auth_uri = URI.parse(options[:openstack_auth_url])
|
@@ -94,8 +102,6 @@ module Fog
|
|
94
102
|
attr_reader :current_tenant
|
95
103
|
|
96
104
|
def initialize(options={})
|
97
|
-
require 'multi_json'
|
98
|
-
|
99
105
|
@openstack_auth_token = options[:openstack_auth_token]
|
100
106
|
|
101
107
|
unless @openstack_auth_token
|
@@ -150,8 +156,6 @@ module Fog
|
|
150
156
|
}.merge!(params[:headers] || {}),
|
151
157
|
:host => @host,
|
152
158
|
:path => "#{@path}/#{params[:path]}"#,
|
153
|
-
# Causes errors for some requests like tenants?limit=1
|
154
|
-
# :query => ('ignore_awful_caching' << Time.now.to_i.to_s)
|
155
159
|
}))
|
156
160
|
rescue Excon::Errors::Unauthorized => error
|
157
161
|
if error.response.body != 'Bad username or password' # token expiration
|
@@ -170,7 +174,7 @@ module Fog
|
|
170
174
|
end
|
171
175
|
end
|
172
176
|
unless response.body.empty?
|
173
|
-
response.body =
|
177
|
+
response.body = Fog::JSON.decode(response.body)
|
174
178
|
end
|
175
179
|
response
|
176
180
|
end
|
data/lib/fog/rackspace.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require File.join(File.dirname(__FILE__), 'core')
|
2
2
|
require 'fog/rackspace/mock_data'
|
3
3
|
require 'fog/rackspace/service'
|
4
|
+
require 'fog/rackspace/errors'
|
4
5
|
|
5
6
|
module Fog
|
6
7
|
module Rackspace
|
@@ -25,21 +26,26 @@ module Fog
|
|
25
26
|
if error.response
|
26
27
|
status_code = error.response.status
|
27
28
|
unless error.response.body.empty?
|
28
|
-
|
29
|
-
|
29
|
+
begin
|
30
|
+
data = Fog::JSON.decode(error.response.body)
|
31
|
+
message = data.values.first ? data.values.first['message'] : data['message']
|
32
|
+
rescue => e
|
33
|
+
Fog::Logger.warning("Received exception '#{e}' while decoding>> #{error.response.body}")
|
34
|
+
message = error.response.body
|
35
|
+
data = error.response.body
|
36
|
+
end
|
30
37
|
end
|
31
38
|
end
|
32
39
|
|
33
40
|
new_error = super(error, message)
|
34
41
|
new_error.instance_variable_set(:@response_data, data)
|
35
|
-
new_error.instance_variable_set(:@status_code, status_code)
|
42
|
+
new_error.instance_variable_set(:@status_code, status_code)
|
36
43
|
new_error
|
37
44
|
end
|
38
45
|
end
|
39
46
|
|
40
47
|
class InternalServerError < ServiceError; end
|
41
48
|
class Conflict < ServiceError; end
|
42
|
-
class NotFound < ServiceError; end
|
43
49
|
class ServiceUnavailable < ServiceError; end
|
44
50
|
|
45
51
|
class BadRequest < ServiceError
|
@@ -3,6 +3,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rackspace'))
|
|
3
3
|
module Fog
|
4
4
|
module Rackspace
|
5
5
|
class BlockStorage < Fog::Service
|
6
|
+
include Fog::Rackspace::Errors
|
6
7
|
|
7
8
|
class IdentifierTaken < Fog::Errors::Error; end
|
8
9
|
class ServiceError < Fog::Rackspace::Errors::ServiceError; end
|
@@ -98,7 +99,7 @@ module Fog
|
|
98
99
|
:path => "#{endpoint_uri.path}/#{params[:path]}"
|
99
100
|
}))
|
100
101
|
rescue Excon::Errors::NotFound => error
|
101
|
-
raise NotFound.slurp
|
102
|
+
raise NotFound.slurp(error, region)
|
102
103
|
rescue Excon::Errors::BadRequest => error
|
103
104
|
raise BadRequest.slurp error
|
104
105
|
rescue Excon::Errors::InternalServerError => error
|
data/lib/fog/rackspace/cdn.rb
CHANGED
@@ -4,7 +4,6 @@ require 'fog/cdn'
|
|
4
4
|
module Fog
|
5
5
|
module CDN
|
6
6
|
class Rackspace < Fog::Service
|
7
|
-
|
8
7
|
requires :rackspace_api_key, :rackspace_username
|
9
8
|
recognizes :rackspace_auth_url, :persistent, :rackspace_cdn_ssl, :rackspace_region, :rackspace_cdn_url
|
10
9
|
|
@@ -37,13 +36,13 @@ module Fog
|
|
37
36
|
end
|
38
37
|
|
39
38
|
# Publish container to CDN
|
40
|
-
# @param [Fog::Storage::Rackspace::Directory] directory to publish
|
39
|
+
# @param [Fog::Storage::Rackspace::Directory] container directory to publish
|
41
40
|
# @param [Boolean] publish If true directory is published. If false directory is unpublished.
|
42
41
|
# @return [Hash] hash containing urls for published container
|
43
|
-
# @raise [Fog::Rackspace::
|
44
|
-
# @raise [Fog::Rackspace::
|
45
|
-
# @raise [Fog::Rackspace::
|
46
|
-
# @raise [Fog::Rackspace::
|
42
|
+
# @raise [Fog::Storage::Rackspace::NotFound] - HTTP 404
|
43
|
+
# @raise [Fog::Storage::Rackspace::BadRequest] - HTTP 400
|
44
|
+
# @raise [Fog::Storage::Rackspace::InternalServerError] - HTTP 500
|
45
|
+
# @raise [Fog::Storage::Rackspace::ServiceError]
|
47
46
|
def publish_container(container, publish = true)
|
48
47
|
enabled = publish ? 'True' : 'False'
|
49
48
|
response = put_container(container.key, 'X-Cdn-Enabled' => enabled)
|
@@ -54,9 +53,9 @@ module Fog
|
|
54
53
|
# Returns hash of urls for container
|
55
54
|
# @param [Fog::Storage::Rackspace::Directory] container to retrieve urls for
|
56
55
|
# @return [Hash] hash containing urls for published container
|
57
|
-
# @raise [Fog::Rackspace::
|
58
|
-
# @raise [Fog::Rackspace::
|
59
|
-
# @raise [Fog::Rackspace::
|
56
|
+
# @raise [Fog::Storage::Rackspace::BadRequest] - HTTP 400
|
57
|
+
# @raise [Fog::Storage::Rackspace::InternalServerError] - HTTP 500
|
58
|
+
# @raise [Fog::Storage::Rackspace::ServiceError]
|
60
59
|
# @note If unable to find container or container is not published this method will return an empty hash.
|
61
60
|
def urls(container)
|
62
61
|
begin
|
@@ -164,13 +163,14 @@ module Fog
|
|
164
163
|
:host => endpoint_uri.host,
|
165
164
|
:path => "#{endpoint_uri.path}/#{params[:path]}",
|
166
165
|
}))
|
166
|
+
rescue Excon::Errors::NotFound => error
|
167
|
+
raise Fog::Storage::Rackspace::NotFound.slurp(error, region)
|
168
|
+
rescue Excon::Errors::BadRequest => error
|
169
|
+
raise Fog::Storage::Rackspace::BadRequest.slurp error
|
170
|
+
rescue Excon::Errors::InternalServerError => error
|
171
|
+
raise Fog::Storage::Rackspace::InternalServerError.slurp error
|
167
172
|
rescue Excon::Errors::HTTPStatusError => error
|
168
|
-
raise
|
169
|
-
when Excon::Errors::NotFound
|
170
|
-
Fog::Storage::Rackspace::NotFound.slurp(error)
|
171
|
-
else
|
172
|
-
error
|
173
|
-
end
|
173
|
+
raise Fog::Storage::Rackspace::ServiceError.slurp error
|
174
174
|
end
|
175
175
|
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
176
176
|
response.body = Fog::JSON.decode(response.body)
|
@@ -4,6 +4,7 @@ require 'fog/compute'
|
|
4
4
|
module Fog
|
5
5
|
module Compute
|
6
6
|
class Rackspace < Fog::Service
|
7
|
+
include Fog::Rackspace::Errors
|
7
8
|
|
8
9
|
requires :rackspace_api_key, :rackspace_username
|
9
10
|
recognizes :rackspace_auth_url, :rackspace_servicenet, :persistent
|
@@ -210,7 +211,6 @@ module Fog
|
|
210
211
|
}.merge!(params[:headers] || {}),
|
211
212
|
:host => endpoint_uri.host,
|
212
213
|
:path => "#{endpoint_uri.path}/#{params[:path]}",
|
213
|
-
:query => ('ignore_awful_caching' << Time.now.to_i.to_s)
|
214
214
|
}))
|
215
215
|
rescue Excon::Errors::Unauthorized => error
|
216
216
|
if error.response.body != 'Bad username or password' # token expiration
|
@@ -223,7 +223,7 @@ module Fog
|
|
223
223
|
rescue Excon::Errors::HTTPStatusError => error
|
224
224
|
raise case error
|
225
225
|
when Excon::Errors::NotFound
|
226
|
-
|
226
|
+
NotFound.slurp(error, region)
|
227
227
|
else
|
228
228
|
error
|
229
229
|
end
|
@@ -3,6 +3,7 @@ require 'fog/compute'
|
|
3
3
|
module Fog
|
4
4
|
module Compute
|
5
5
|
class RackspaceV2 < Fog::Service
|
6
|
+
include Fog::Rackspace::Errors
|
6
7
|
|
7
8
|
class ServiceError < Fog::Rackspace::Errors::ServiceError; end
|
8
9
|
class InternalServerError < Fog::Rackspace::Errors::InternalServerError; end
|
@@ -21,15 +22,15 @@ module Fog
|
|
21
22
|
|
22
23
|
class InvalidServerStateException < InvalidStateException
|
23
24
|
def to_s
|
24
|
-
"Server should have transitioned to '#{desired_state}' not '#{
|
25
|
+
"Server should have transitioned to '#{desired_state}' not '#{current_state}'"
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
28
29
|
class InvalidImageStateException < InvalidStateException
|
29
30
|
def to_s
|
30
|
-
"Image should have transitioned to '#{desired_state}' not '#{
|
31
|
+
"Image should have transitioned to '#{desired_state}' not '#{current_state}'"
|
31
32
|
end
|
32
|
-
|
33
|
+
end
|
33
34
|
|
34
35
|
DFW_ENDPOINT = 'https://dfw.servers.api.rackspacecloud.com/v2'
|
35
36
|
ORD_ENDPOINT = 'https://ord.servers.api.rackspacecloud.com/v2'
|
@@ -66,6 +67,8 @@ module Fog
|
|
66
67
|
request :resize_server
|
67
68
|
request :confirm_resize_server
|
68
69
|
request :revert_resize_server
|
70
|
+
request :rescue_server
|
71
|
+
request :unrescue_server
|
69
72
|
request :list_addresses
|
70
73
|
request :list_addresses_by_network
|
71
74
|
|
@@ -148,7 +151,7 @@ module Fog
|
|
148
151
|
:path => "#{endpoint_uri.path}/#{params[:path]}"
|
149
152
|
}))
|
150
153
|
rescue Excon::Errors::NotFound => error
|
151
|
-
raise NotFound.slurp
|
154
|
+
raise NotFound.slurp(error, region)
|
152
155
|
rescue Excon::Errors::BadRequest => error
|
153
156
|
raise BadRequest.slurp error
|
154
157
|
rescue Excon::Errors::InternalServerError => error
|
@@ -160,7 +163,7 @@ module Fog
|
|
160
163
|
unless response.body.empty?
|
161
164
|
begin
|
162
165
|
response.body = Fog::JSON.decode(response.body)
|
163
|
-
rescue
|
166
|
+
rescue Fog::JSON::LoadError
|
164
167
|
response.body = {}
|
165
168
|
end
|
166
169
|
end
|
@@ -3,6 +3,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rackspace'))
|
|
3
3
|
module Fog
|
4
4
|
module Rackspace
|
5
5
|
class Databases < Fog::Service
|
6
|
+
include Fog::Rackspace::Errors
|
6
7
|
|
7
8
|
class ServiceError < Fog::Rackspace::Errors::ServiceError; end
|
8
9
|
class InternalServerError < Fog::Rackspace::Errors::InternalServerError; end
|
@@ -96,7 +97,7 @@ module Fog
|
|
96
97
|
:path => "#{endpoint_uri.path}/#{params[:path]}"
|
97
98
|
}))
|
98
99
|
rescue Excon::Errors::NotFound => error
|
99
|
-
raise NotFound.slurp
|
100
|
+
raise NotFound.slurp(error, region)
|
100
101
|
rescue Excon::Errors::BadRequest => error
|
101
102
|
raise BadRequest.slurp error
|
102
103
|
rescue Excon::Errors::InternalServerError => error
|
data/lib/fog/rackspace/dns.rb
CHANGED
@@ -4,6 +4,7 @@ require 'fog/dns'
|
|
4
4
|
module Fog
|
5
5
|
module DNS
|
6
6
|
class Rackspace < Fog::Service
|
7
|
+
include Fog::Rackspace::Errors
|
7
8
|
|
8
9
|
class CallbackError < Fog::Errors::Error
|
9
10
|
attr_reader :response, :message, :details
|
@@ -118,7 +119,7 @@ module Fog
|
|
118
119
|
rescue Excon::Errors::Conflict => error
|
119
120
|
raise Fog::Rackspace::Errors::Conflict.slurp error
|
120
121
|
rescue Excon::Errors::NotFound => error
|
121
|
-
raise
|
122
|
+
raise NotFound.slurp(error, region)
|
122
123
|
rescue Excon::Errors::ServiceUnavailable => error
|
123
124
|
raise Fog::Rackspace::Errors::ServiceUnavailable.slurp error
|
124
125
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
module Errors
|
4
|
+
|
5
|
+
def self.included(mod)
|
6
|
+
mod.class_eval <<-'EOS', __FILE__, __LINE__
|
7
|
+
class NotFound < Fog::Service::NotFound
|
8
|
+
attr_reader :region, :status_code
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
status = status_code ? "[HTTP #{status_code}] " : ""
|
12
|
+
message = region ? "resource not found in #{region} region" : super
|
13
|
+
"#{status}#{message}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.slurp(error, region=nil)
|
17
|
+
exception = NotFound.new
|
18
|
+
exception.instance_variable_set(:@region, region)
|
19
|
+
exception.instance_variable_set(:@status_code, error.response.status) rescue nil
|
20
|
+
exception
|
21
|
+
end
|
22
|
+
end
|
23
|
+
EOS
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -3,6 +3,7 @@ require 'fog/rackspace'
|
|
3
3
|
module Fog
|
4
4
|
module Rackspace
|
5
5
|
class LoadBalancers < Fog::Service
|
6
|
+
include Fog::Rackspace::Errors
|
6
7
|
|
7
8
|
#These references exist for backwards compatibility
|
8
9
|
class ServiceError < Fog::Rackspace::Errors::ServiceError; end
|
@@ -131,7 +132,7 @@ module Fog
|
|
131
132
|
:path => "#{endpoint_uri.path}/#{params[:path]}"
|
132
133
|
}))
|
133
134
|
rescue Excon::Errors::NotFound => error
|
134
|
-
raise NotFound.slurp
|
135
|
+
raise NotFound.slurp(error, region)
|
135
136
|
rescue Excon::Errors::BadRequest => error
|
136
137
|
raise BadRequest.slurp error
|
137
138
|
rescue Excon::Errors::InternalServerError => error
|
@@ -104,8 +104,7 @@ module Fog
|
|
104
104
|
"extra_specs" => {},
|
105
105
|
}
|
106
106
|
|
107
|
-
|
108
|
-
h = {
|
107
|
+
mock_data = {
|
109
108
|
#Compute V2
|
110
109
|
:flavors => Hash.new { |h,k| h[k] = flavor unless k == NOT_FOUND_ID},
|
111
110
|
:images => Hash.new { |h,k| h[k] = image unless k == NOT_FOUND_ID },
|
@@ -121,11 +120,11 @@ module Fog
|
|
121
120
|
}
|
122
121
|
|
123
122
|
# seed with initial data
|
124
|
-
|
125
|
-
|
126
|
-
|
123
|
+
mock_data[:flavors][flavor_id] = flavor
|
124
|
+
mock_data[:images][image_id] = image
|
125
|
+
mock_data[:networks][network_id] = network
|
127
126
|
|
128
|
-
|
127
|
+
mock_data
|
129
128
|
end
|
130
129
|
end[@rackspace_api_key]
|
131
130
|
end
|