fog 1.9.0 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/changelog.txt +743 -0
- data/fog.gemspec +3 -5
- data/lib/fog/aws.rb +1 -0
- data/lib/fog/aws/credential_fetcher.rb +1 -1
- data/lib/fog/aws/data_pipeline.rb +114 -0
- data/lib/fog/aws/dynamodb.rb +1 -1
- data/lib/fog/aws/models/compute/flavors.rb +1 -1
- data/lib/fog/aws/models/compute/spot_request.rb +2 -0
- data/lib/fog/aws/models/data_pipeline/pipeline.rb +67 -0
- data/lib/fog/aws/models/data_pipeline/pipelines.rb +36 -0
- data/lib/fog/aws/parsers/cloud_watch/list_metrics.rb +1 -1
- data/lib/fog/aws/parsers/compute/describe_instances.rb +1 -1
- data/lib/fog/aws/parsers/compute/spot_instance_requests.rb +2 -0
- data/lib/fog/aws/requests/compute/request_spot_instances.rb +1 -0
- data/lib/fog/aws/requests/data_pipeline/activate_pipeline.rb +35 -0
- data/lib/fog/aws/requests/data_pipeline/create_pipeline.rb +41 -0
- data/lib/fog/aws/requests/data_pipeline/delete_pipeline.rb +35 -0
- data/lib/fog/aws/requests/data_pipeline/describe_pipelines.rb +36 -0
- data/lib/fog/aws/requests/data_pipeline/list_pipelines.rb +36 -0
- data/lib/fog/aws/requests/data_pipeline/put_pipeline_definition.rb +72 -0
- data/lib/fog/aws/requests/rds/describe_db_instances.rb +8 -9
- data/lib/fog/aws/requests/storage/get_service.rb +1 -2
- data/lib/fog/aws/requests/storage/list_multipart_uploads.rb +3 -3
- data/lib/fog/aws/requests/storage/put_bucket_policy.rb +2 -2
- data/lib/fog/aws/storage.rb +1 -1
- data/lib/fog/bin.rb +2 -1
- data/lib/fog/bin/aws.rb +4 -0
- data/lib/fog/bin/bluebox.rb +2 -0
- data/lib/fog/bin/dreamhost.rb +31 -0
- data/lib/fog/bin/hp.rb +7 -0
- data/lib/fog/bin/internet_archive.rb +34 -0
- data/lib/fog/bin/openstack.rb +17 -2
- data/lib/fog/bluebox.rb +1 -0
- data/lib/fog/bluebox/blb.rb +85 -0
- data/lib/fog/bluebox/models/blb/lb_application.rb +32 -0
- data/lib/fog/bluebox/models/blb/lb_applications.rb +26 -0
- data/lib/fog/bluebox/models/blb/lb_backend.rb +22 -0
- data/lib/fog/bluebox/models/blb/lb_backends.rb +30 -0
- data/lib/fog/bluebox/models/blb/lb_service.rb +35 -0
- data/lib/fog/bluebox/models/blb/lb_services.rb +29 -0
- data/lib/fog/bluebox/requests/blb/add_machine_to_lb_application.rb +33 -0
- data/lib/fog/bluebox/requests/blb/add_machine_to_lb_backend.rb +31 -0
- data/lib/fog/bluebox/requests/blb/get_lb_application.rb +33 -0
- data/lib/fog/bluebox/requests/blb/get_lb_applications.rb +31 -0
- data/lib/fog/bluebox/requests/blb/get_lb_backend.rb +36 -0
- data/lib/fog/bluebox/requests/blb/get_lb_backends.rb +36 -0
- data/lib/fog/bluebox/requests/blb/get_lb_machine.rb +35 -0
- data/lib/fog/bluebox/requests/blb/get_lb_machines.rb +35 -0
- data/lib/fog/bluebox/requests/blb/get_lb_service.rb +36 -0
- data/lib/fog/bluebox/requests/blb/get_lb_services.rb +36 -0
- data/lib/fog/bluebox/requests/blb/remove_machine_from_lb_backend.rb +28 -0
- data/lib/fog/bluebox/requests/blb/update_lb_backend_machine.rb +29 -0
- data/lib/fog/brightbox/compute.rb +1 -0
- data/lib/fog/brightbox/requests/compute/create_firewall_policy.rb +1 -0
- data/lib/fog/brightbox/requests/compute/update_firewall_policy.rb +25 -0
- data/lib/fog/brightbox/requests/compute/update_server.rb +1 -0
- data/lib/fog/cdn.rb +5 -12
- data/lib/fog/compute.rb +7 -68
- data/lib/fog/core/errors.rb +5 -1
- data/lib/fog/core/scp.rb +1 -0
- data/lib/fog/core/ssh.rb +1 -0
- data/lib/fog/dns.rb +7 -27
- data/lib/fog/dreamhost.rb +11 -0
- data/lib/fog/dreamhost/dns.rb +86 -0
- data/lib/fog/dreamhost/examples/dns/getting_started.md +105 -0
- data/lib/fog/dreamhost/models/dns/record.rb +35 -0
- data/lib/fog/dreamhost/models/dns/records.rb +38 -0
- data/lib/fog/dreamhost/models/dns/zone.rb +59 -0
- data/lib/fog/dreamhost/models/dns/zones.rb +41 -0
- data/lib/fog/dreamhost/requests/dns/create_record.rb +32 -0
- data/lib/fog/dreamhost/requests/dns/delete_record.rb +31 -0
- data/lib/fog/dreamhost/requests/dns/list_records.rb +25 -0
- data/lib/fog/ecloud/models/compute/detached_disks.rb +1 -5
- data/lib/fog/ecloud/models/compute/internet_services.rb +1 -5
- data/lib/fog/ecloud/models/compute/nodes.rb +1 -5
- data/lib/fog/ecloud/models/compute/public_ips.rb +1 -5
- data/lib/fog/ecloud/models/compute/servers.rb +2 -6
- data/lib/fog/ecloud/requests/compute/get_detached_disk.rb +1 -1
- data/lib/fog/ecloud/requests/compute/get_internet_service.rb +1 -1
- data/lib/fog/ecloud/requests/compute/get_node.rb +1 -1
- data/lib/fog/ecloud/requests/compute/get_public_ip.rb +1 -1
- data/lib/fog/ecloud/requests/compute/get_server.rb +1 -1
- data/lib/fog/ecloud/requests/compute/virtual_machine_create_from_template.rb +1 -1
- data/lib/fog/glesys/compute.rb +5 -1
- data/lib/fog/glesys/models/compute/ip.rb +47 -46
- data/lib/fog/glesys/models/compute/ips.rb +95 -12
- data/lib/fog/glesys/models/compute/server.rb +66 -5
- data/lib/fog/glesys/models/compute/servers.rb +7 -1
- data/lib/fog/glesys/models/compute/template.rb +8 -16
- data/lib/fog/glesys/models/compute/templates.rb +23 -5
- data/lib/fog/glesys/requests/compute/ip_details.rb +2 -2
- data/lib/fog/glesys/requests/compute/server_details.rb +2 -2
- data/lib/fog/glesys/requests/compute/template_list.rb +2 -2
- data/lib/fog/hp.rb +56 -26
- data/lib/fog/hp/CHANGELOG.hp +113 -0
- data/lib/fog/hp/README_HP.rdoc +7 -6
- data/lib/fog/hp/block_storage.rb +169 -0
- data/lib/fog/hp/cdn.rb +29 -7
- data/lib/fog/hp/compute.rb +88 -17
- data/lib/fog/hp/models/block_storage/bootable_volumes.rb +28 -0
- data/lib/fog/hp/models/block_storage/snapshot.rb +56 -0
- data/lib/fog/hp/models/block_storage/snapshots.rb +29 -0
- data/lib/fog/hp/models/block_storage/volume.rb +102 -0
- data/lib/fog/hp/models/block_storage/volumes.rb +28 -0
- data/lib/fog/hp/models/compute/address.rb +0 -1
- data/lib/fog/hp/models/compute/image.rb +43 -4
- data/lib/fog/hp/models/compute/images.rb +0 -5
- data/lib/fog/hp/models/compute/key_pair.rb +0 -5
- data/lib/fog/hp/models/compute/meta.rb +29 -0
- data/lib/fog/hp/models/compute/metadata.rb +79 -0
- data/lib/fog/hp/models/compute/server.rb +84 -20
- data/lib/fog/hp/models/meta_parent.rb +33 -0
- data/lib/fog/hp/models/storage/directories.rb +34 -9
- data/lib/fog/hp/models/storage/directory.rb +111 -26
- data/lib/fog/hp/models/storage/file.rb +10 -0
- data/lib/fog/hp/models/storage/files.rb +8 -0
- data/lib/fog/hp/models/storage/shared_directories.rb +55 -0
- data/lib/fog/hp/models/storage/shared_directory.rb +39 -0
- data/lib/fog/hp/models/storage/shared_file.rb +67 -0
- data/lib/fog/hp/models/storage/shared_files.rb +64 -0
- data/lib/fog/hp/requests/block_storage/create_snapshot.rb +76 -0
- data/lib/fog/hp/requests/block_storage/create_volume.rb +87 -0
- data/lib/fog/hp/requests/block_storage/delete_snapshot.rb +38 -0
- data/lib/fog/hp/requests/block_storage/delete_volume.rb +38 -0
- data/lib/fog/hp/requests/block_storage/get_bootable_volume_details.rb +59 -0
- data/lib/fog/hp/requests/block_storage/get_snapshot_details.rb +54 -0
- data/lib/fog/hp/requests/block_storage/get_volume_details.rb +58 -0
- data/lib/fog/hp/requests/block_storage/list_bootable_volumes.rb +53 -0
- data/lib/fog/hp/requests/block_storage/list_snapshots.rb +48 -0
- data/lib/fog/hp/requests/block_storage/list_volumes.rb +52 -0
- data/lib/fog/hp/requests/compute/attach_volume.rb +78 -0
- data/lib/fog/hp/requests/compute/create_image.rb +5 -8
- data/lib/fog/hp/requests/compute/create_persistent_server.rb +168 -0
- data/lib/fog/hp/requests/compute/create_server.rb +36 -20
- data/lib/fog/hp/requests/compute/delete_meta.rb +55 -0
- data/lib/fog/hp/requests/compute/delete_security_group_rule.rb +4 -4
- data/lib/fog/hp/requests/compute/detach_volume.rb +47 -0
- data/lib/fog/hp/requests/compute/get_console_output.rb +43 -0
- data/lib/fog/hp/requests/compute/get_meta.rb +57 -0
- data/lib/fog/hp/requests/compute/get_windows_password.rb +43 -0
- data/lib/fog/hp/requests/compute/list_metadata.rb +56 -0
- data/lib/fog/hp/requests/compute/list_server_volumes.rb +49 -0
- data/lib/fog/hp/requests/compute/set_metadata.rb +60 -0
- data/lib/fog/hp/requests/compute/update_meta.rb +61 -0
- data/lib/fog/hp/requests/compute/update_metadata.rb +60 -0
- data/lib/fog/hp/requests/storage/delete_shared_object.rb +38 -0
- data/lib/fog/hp/requests/storage/get_object.rb +12 -10
- data/lib/fog/hp/requests/storage/get_object_temp_url.rb +31 -0
- data/lib/fog/hp/requests/storage/get_shared_container.rb +75 -0
- data/lib/fog/hp/requests/storage/get_shared_object.rb +66 -0
- data/lib/fog/hp/requests/storage/head_container.rb +1 -0
- data/lib/fog/hp/requests/storage/head_object.rb +1 -0
- data/lib/fog/hp/requests/storage/head_shared_container.rb +45 -0
- data/lib/fog/hp/requests/storage/head_shared_object.rb +39 -0
- data/lib/fog/hp/requests/storage/put_container.rb +6 -6
- data/lib/fog/hp/requests/storage/put_object.rb +12 -1
- data/lib/fog/hp/requests/storage/put_shared_object.rb +85 -0
- data/lib/fog/hp/storage.rb +175 -33
- data/lib/fog/identity.rb +5 -4
- data/lib/fog/image.rb +5 -6
- data/lib/fog/internet_archive.rb +290 -0
- data/lib/fog/internet_archive/models/storage/directories.rb +43 -0
- data/lib/fog/internet_archive/models/storage/directory.rb +126 -0
- data/lib/fog/internet_archive/models/storage/file.rb +286 -0
- data/lib/fog/internet_archive/models/storage/files.rb +122 -0
- data/lib/fog/internet_archive/models/storage/version.rb +36 -0
- data/lib/fog/internet_archive/models/storage/versions.rb +38 -0
- data/lib/fog/internet_archive/parsers/storage/access_control_list.rb +46 -0
- data/lib/fog/internet_archive/parsers/storage/complete_multipart_upload.rb +24 -0
- data/lib/fog/internet_archive/parsers/storage/copy_object.rb +22 -0
- data/lib/fog/internet_archive/parsers/storage/cors_configuration.rb +41 -0
- data/lib/fog/internet_archive/parsers/storage/delete_multiple_objects.rb +50 -0
- data/lib/fog/internet_archive/parsers/storage/get_bucket.rb +62 -0
- data/lib/fog/internet_archive/parsers/storage/get_bucket_lifecycle.rb +66 -0
- data/lib/fog/internet_archive/parsers/storage/get_bucket_location.rb +20 -0
- data/lib/fog/internet_archive/parsers/storage/get_bucket_logging.rb +40 -0
- data/lib/fog/internet_archive/parsers/storage/get_bucket_object_versions.rb +88 -0
- data/lib/fog/internet_archive/parsers/storage/get_bucket_versioning.rb +24 -0
- data/lib/fog/internet_archive/parsers/storage/get_bucket_website.rb +26 -0
- data/lib/fog/internet_archive/parsers/storage/get_request_payment.rb +20 -0
- data/lib/fog/internet_archive/parsers/storage/get_service.rb +32 -0
- data/lib/fog/internet_archive/parsers/storage/initiate_multipart_upload.rb +24 -0
- data/lib/fog/internet_archive/parsers/storage/list_multipart_uploads.rb +56 -0
- data/lib/fog/internet_archive/parsers/storage/list_parts.rb +40 -0
- data/lib/fog/internet_archive/requests/storage/abort_multipart_upload.rb +28 -0
- data/lib/fog/internet_archive/requests/storage/acl_utils.rb +62 -0
- data/lib/fog/internet_archive/requests/storage/complete_multipart_upload.rb +48 -0
- data/lib/fog/internet_archive/requests/storage/copy_object.rb +81 -0
- data/lib/fog/internet_archive/requests/storage/cors_utils.rb +41 -0
- data/lib/fog/internet_archive/requests/storage/delete_bucket.rb +47 -0
- data/lib/fog/internet_archive/requests/storage/delete_bucket_cors.rb +29 -0
- data/lib/fog/internet_archive/requests/storage/delete_bucket_lifecycle.rb +27 -0
- data/lib/fog/internet_archive/requests/storage/delete_bucket_policy.rb +29 -0
- data/lib/fog/internet_archive/requests/storage/delete_bucket_website.rb +29 -0
- data/lib/fog/internet_archive/requests/storage/delete_multiple_objects.rb +167 -0
- data/lib/fog/internet_archive/requests/storage/delete_object.rb +118 -0
- data/lib/fog/internet_archive/requests/storage/get_bucket.rb +112 -0
- data/lib/fog/internet_archive/requests/storage/get_bucket_acl.rb +69 -0
- data/lib/fog/internet_archive/requests/storage/get_bucket_cors.rb +65 -0
- data/lib/fog/internet_archive/requests/storage/get_bucket_lifecycle.rb +38 -0
- data/lib/fog/internet_archive/requests/storage/get_bucket_location.rb +58 -0
- data/lib/fog/internet_archive/requests/storage/get_bucket_logging.rb +47 -0
- data/lib/fog/internet_archive/requests/storage/get_bucket_object_versions.rb +162 -0
- data/lib/fog/internet_archive/requests/storage/get_bucket_policy.rb +34 -0
- data/lib/fog/internet_archive/requests/storage/get_bucket_versioning.rb +69 -0
- data/lib/fog/internet_archive/requests/storage/get_bucket_website.rb +40 -0
- data/lib/fog/internet_archive/requests/storage/get_object.rb +188 -0
- data/lib/fog/internet_archive/requests/storage/get_object_acl.rb +80 -0
- data/lib/fog/internet_archive/requests/storage/get_object_http_url.rb +55 -0
- data/lib/fog/internet_archive/requests/storage/get_object_https_url.rb +37 -0
- data/lib/fog/internet_archive/requests/storage/get_object_torrent.rb +47 -0
- data/lib/fog/internet_archive/requests/storage/get_object_url.rb +55 -0
- data/lib/fog/internet_archive/requests/storage/get_request_payment.rb +49 -0
- data/lib/fog/internet_archive/requests/storage/get_service.rb +55 -0
- data/lib/fog/internet_archive/requests/storage/head_object.rb +66 -0
- data/lib/fog/internet_archive/requests/storage/initiate_multipart_upload.rb +44 -0
- data/lib/fog/internet_archive/requests/storage/list_multipart_uploads.rb +55 -0
- data/lib/fog/internet_archive/requests/storage/list_parts.rb +55 -0
- data/lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb +38 -0
- data/lib/fog/internet_archive/requests/storage/put_bucket.rb +74 -0
- data/lib/fog/internet_archive/requests/storage/put_bucket_acl.rb +71 -0
- data/lib/fog/internet_archive/requests/storage/put_bucket_cors.rb +49 -0
- data/lib/fog/internet_archive/requests/storage/put_bucket_lifecycle.rb +77 -0
- data/lib/fog/internet_archive/requests/storage/put_bucket_logging.rb +81 -0
- data/lib/fog/internet_archive/requests/storage/put_bucket_policy.rb +28 -0
- data/lib/fog/internet_archive/requests/storage/put_bucket_versioning.rb +75 -0
- data/lib/fog/internet_archive/requests/storage/put_bucket_website.rb +64 -0
- data/lib/fog/internet_archive/requests/storage/put_object.rb +113 -0
- data/lib/fog/internet_archive/requests/storage/put_object_acl.rb +80 -0
- data/lib/fog/internet_archive/requests/storage/put_object_url.rb +48 -0
- data/lib/fog/internet_archive/requests/storage/put_request_payment.rb +49 -0
- data/lib/fog/internet_archive/requests/storage/sync_clock.rb +28 -0
- data/lib/fog/internet_archive/requests/storage/upload_part.rb +41 -0
- data/lib/fog/internet_archive/signaturev4.rb +73 -0
- data/lib/fog/internet_archive/storage.rb +402 -0
- data/lib/fog/joyent/models/compute/server.rb +1 -1
- data/lib/fog/joyent/requests/compute/resize_machine.rb +2 -0
- data/lib/fog/libvirt/models/compute/volume.rb +1 -1
- data/lib/fog/network.rb +5 -6
- data/lib/fog/openstack.rb +10 -0
- data/lib/fog/openstack/compute.rb +11 -4
- data/lib/fog/openstack/identity.rb +5 -2
- data/lib/fog/openstack/models/compute/images.rb +2 -1
- data/lib/fog/openstack/models/compute/metadata.rb +4 -5
- data/lib/fog/openstack/models/compute/server.rb +36 -21
- data/lib/fog/openstack/models/identity/role.rb +1 -1
- data/lib/fog/openstack/models/network/floating_ip.rb +1 -1
- data/lib/fog/openstack/models/network/floating_ips.rb +2 -2
- data/lib/fog/openstack/models/network/network.rb +8 -0
- data/lib/fog/openstack/models/storage/directories.rb +39 -0
- data/lib/fog/openstack/models/storage/directory.rb +50 -0
- data/lib/fog/openstack/models/storage/file.rb +150 -0
- data/lib/fog/openstack/models/storage/files.rb +94 -0
- data/lib/fog/openstack/requests/compute/allocate_address.rb +1 -1
- data/lib/fog/openstack/requests/compute/delete_meta.rb +43 -0
- data/lib/fog/openstack/requests/compute/get_limits.rb +1 -1
- data/lib/fog/openstack/requests/compute/get_snapshot_details.rb +1 -1
- data/lib/fog/openstack/requests/compute/get_volume_details.rb +1 -1
- data/lib/fog/openstack/requests/compute/list_servers.rb +1 -1
- data/lib/fog/openstack/requests/compute/list_tenants.rb +1 -0
- data/lib/fog/openstack/requests/compute/remove_fixed_ip.rb +1 -1
- data/lib/fog/openstack/requests/compute/update_meta.rb +46 -0
- data/lib/fog/openstack/requests/compute/update_server.rb +1 -1
- data/lib/fog/openstack/requests/identity/delete_user_role.rb +2 -2
- data/lib/fog/openstack/requests/identity/get_user_by_name.rb +2 -2
- data/lib/fog/openstack/requests/image/create_image.rb +1 -1
- data/lib/fog/openstack/requests/network/associate_floating_ip.rb +3 -3
- data/lib/fog/openstack/requests/network/create_floating_ip.rb +3 -3
- data/lib/fog/openstack/requests/network/delete_floating_ip.rb +1 -1
- data/lib/fog/openstack/requests/network/disassociate_floating_ip.rb +3 -3
- data/lib/fog/openstack/requests/network/get_floating_ip.rb +1 -1
- data/lib/fog/openstack/requests/network/list_floating_ips.rb +1 -1
- data/lib/fog/openstack/requests/storage/copy_object.rb +27 -0
- data/lib/fog/openstack/requests/storage/delete_container.rb +22 -0
- data/lib/fog/openstack/requests/storage/delete_object.rb +23 -0
- data/lib/fog/openstack/requests/storage/get_container.rb +44 -0
- data/lib/fog/openstack/requests/storage/get_containers.rb +33 -0
- data/lib/fog/openstack/requests/storage/get_object.rb +29 -0
- data/lib/fog/openstack/requests/storage/get_object_https_url.rb +51 -0
- data/lib/fog/openstack/requests/storage/head_container.rb +28 -0
- data/lib/fog/openstack/requests/storage/head_containers.rb +25 -0
- data/lib/fog/openstack/requests/storage/head_object.rb +23 -0
- data/lib/fog/openstack/requests/storage/post_set_meta_temp_url_key.rb +37 -0
- data/lib/fog/openstack/requests/storage/put_container.rb +22 -0
- data/lib/fog/openstack/requests/storage/put_object.rb +30 -0
- data/lib/fog/openstack/requests/storage/put_object_manifest.rb +25 -0
- data/lib/fog/openstack/storage.rb +159 -0
- data/lib/fog/openstack/volume.rb +4 -2
- data/lib/fog/ovirt/compute.rb +1 -0
- data/lib/fog/ovirt/models/compute/server.rb +2 -2
- data/lib/fog/ovirt/models/compute/volume.rb +1 -0
- data/lib/fog/ovirt/requests/compute/get_api_version.rb +16 -0
- data/lib/fog/providers.rb +2 -1
- data/lib/fog/rackspace/block_storage.rb +1 -0
- data/lib/fog/rackspace/cdn.rb +61 -7
- data/lib/fog/rackspace/compute_v2.rb +16 -3
- data/lib/fog/rackspace/databases.rb +4 -3
- data/lib/fog/rackspace/docs/compute_v2.md +663 -0
- data/lib/fog/rackspace/docs/getting_started.md +9 -9
- data/lib/fog/rackspace/examples/README.md +47 -0
- data/lib/fog/rackspace/examples/compute_v2/README.md +47 -0
- data/lib/fog/rackspace/examples/compute_v2/create_image.rb +61 -0
- data/lib/fog/rackspace/examples/compute_v2/create_server.rb +89 -0
- data/lib/fog/rackspace/examples/compute_v2/delete_image.rb +61 -0
- data/lib/fog/rackspace/examples/compute_v2/delete_server.rb +56 -0
- data/lib/fog/rackspace/examples/compute_v2/detach_volume.rb +93 -0
- data/lib/fog/rackspace/examples/compute_v2/resize_server.rb +106 -0
- data/lib/fog/rackspace/examples/compute_v2/server_attachments.rb +69 -0
- data/lib/fog/rackspace/examples/compute_v2/server_metadata.rb +85 -0
- data/lib/fog/rackspace/identity.rb +1 -1
- data/lib/fog/rackspace/load_balancers.rb +2 -2
- data/lib/fog/rackspace/mock_data.rb +114 -96
- data/lib/fog/rackspace/models/compute_v2/attachment.rb +16 -0
- data/lib/fog/rackspace/models/compute_v2/attachments.rb +6 -0
- data/lib/fog/rackspace/models/compute_v2/flavor.rb +18 -0
- data/lib/fog/rackspace/models/compute_v2/flavors.rb +9 -1
- data/lib/fog/rackspace/models/compute_v2/image.rb +52 -7
- data/lib/fog/rackspace/models/compute_v2/images.rb +9 -0
- data/lib/fog/rackspace/models/compute_v2/meta_parent.rb +9 -0
- data/lib/fog/rackspace/models/compute_v2/metadata.rb +30 -7
- data/lib/fog/rackspace/models/compute_v2/metadatum.rb +4 -0
- data/lib/fog/rackspace/models/compute_v2/network.rb +27 -0
- data/lib/fog/rackspace/models/compute_v2/networks.rb +23 -0
- data/lib/fog/rackspace/models/compute_v2/server.rb +235 -24
- data/lib/fog/rackspace/models/compute_v2/servers.rb +19 -1
- data/lib/fog/rackspace/models/dns/zones.rb +35 -2
- data/lib/fog/rackspace/models/identity/credentials.rb +3 -2
- data/lib/fog/rackspace/models/storage/account.rb +24 -0
- data/lib/fog/rackspace/models/storage/directories.rb +3 -0
- data/lib/fog/rackspace/models/storage/directory.rb +68 -39
- data/lib/fog/rackspace/models/storage/file.rb +38 -67
- data/lib/fog/rackspace/models/storage/files.rb +11 -4
- data/lib/fog/rackspace/models/storage/metadata.rb +129 -0
- data/lib/fog/rackspace/requests/cdn/delete_object.rb +37 -0
- data/lib/fog/rackspace/requests/cdn/get_containers.rb +34 -0
- data/lib/fog/rackspace/requests/cdn/head_container.rb +24 -0
- data/lib/fog/rackspace/requests/cdn/post_container.rb +21 -0
- data/lib/fog/rackspace/requests/cdn/put_container.rb +21 -0
- data/lib/fog/rackspace/requests/compute_v2/attach_volume.rb +13 -0
- data/lib/fog/rackspace/requests/compute_v2/change_server_password.rb +7 -0
- data/lib/fog/rackspace/requests/compute_v2/confirm_resize_server.rb +9 -0
- data/lib/fog/rackspace/requests/compute_v2/create_image.rb +9 -5
- data/lib/fog/rackspace/requests/compute_v2/create_network.rb +36 -0
- data/lib/fog/rackspace/requests/compute_v2/create_server.rb +38 -0
- data/lib/fog/rackspace/requests/compute_v2/delete_attachment.rb +5 -0
- data/lib/fog/rackspace/requests/compute_v2/delete_image.rb +2 -4
- data/lib/fog/rackspace/requests/compute_v2/delete_metadata_item.rb +6 -0
- data/lib/fog/rackspace/requests/compute_v2/delete_network.rb +21 -0
- data/lib/fog/rackspace/requests/compute_v2/delete_server.rb +4 -0
- data/lib/fog/rackspace/requests/compute_v2/get_attachment.rb +12 -0
- data/lib/fog/rackspace/requests/compute_v2/get_flavor.rb +14 -0
- data/lib/fog/rackspace/requests/compute_v2/get_image.rb +18 -0
- data/lib/fog/rackspace/requests/compute_v2/get_metadata_item.rb +9 -0
- data/lib/fog/rackspace/requests/compute_v2/get_network.rb +21 -0
- data/lib/fog/rackspace/requests/compute_v2/get_server.rb +32 -0
- data/lib/fog/rackspace/requests/compute_v2/list_addresses.rb +5 -0
- data/lib/fog/rackspace/requests/compute_v2/list_addresses_by_network.rb +12 -0
- data/lib/fog/rackspace/requests/compute_v2/list_attachments.rb +12 -0
- data/lib/fog/rackspace/requests/compute_v2/list_flavors.rb +10 -0
- data/lib/fog/rackspace/requests/compute_v2/list_images.rb +10 -0
- data/lib/fog/rackspace/requests/compute_v2/list_metadata.rb +8 -0
- data/lib/fog/rackspace/requests/compute_v2/list_networks.rb +18 -0
- data/lib/fog/rackspace/requests/compute_v2/list_servers.rb +31 -0
- data/lib/fog/rackspace/requests/compute_v2/reboot_server.rb +5 -0
- data/lib/fog/rackspace/requests/compute_v2/rebuild_server.rb +37 -0
- data/lib/fog/rackspace/requests/compute_v2/resize_server.rb +10 -0
- data/lib/fog/rackspace/requests/compute_v2/revert_resize_server.rb +10 -0
- data/lib/fog/rackspace/requests/compute_v2/set_metadata.rb +9 -0
- data/lib/fog/rackspace/requests/compute_v2/set_metadata_item.rb +10 -0
- data/lib/fog/rackspace/requests/compute_v2/update_metadata.rb +9 -0
- data/lib/fog/rackspace/requests/compute_v2/update_server.rb +9 -0
- data/lib/fog/rackspace/requests/storage/get_object.rb +0 -1
- data/lib/fog/rackspace/requests/storage/put_container.rb +2 -1
- data/lib/fog/rackspace/storage.rb +14 -2
- data/lib/fog/schema/data_validator.rb +154 -0
- data/lib/fog/storage.rb +8 -24
- data/lib/fog/terremark/models/shared/server.rb +5 -3
- data/lib/fog/terremark/parser.rb +14 -13
- data/lib/fog/terremark/parsers/shared/get_catalog.rb +5 -19
- data/lib/fog/terremark/parsers/shared/get_catalog_item.rb +4 -14
- data/lib/fog/terremark/parsers/shared/get_internet_services.rb +1 -1
- data/lib/fog/terremark/parsers/shared/get_keys_list.rb +4 -18
- data/lib/fog/terremark/parsers/shared/get_network_ips.rb +1 -1
- data/lib/fog/terremark/parsers/shared/get_node_services.rb +1 -1
- data/lib/fog/terremark/parsers/shared/get_organization.rb +4 -3
- data/lib/fog/terremark/parsers/shared/get_organizations.rb +3 -2
- data/lib/fog/terremark/parsers/shared/get_public_ips.rb +1 -1
- data/lib/fog/terremark/parsers/shared/get_tasks_list.rb +4 -17
- data/lib/fog/terremark/parsers/shared/get_vapp_template.rb +3 -14
- data/lib/fog/terremark/parsers/shared/get_vdc.rb +6 -38
- data/lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb +3 -14
- data/lib/fog/terremark/parsers/shared/internet_service.rb +2 -5
- data/lib/fog/terremark/parsers/shared/network.rb +3 -11
- data/lib/fog/terremark/parsers/shared/node_service.rb +1 -1
- data/lib/fog/terremark/parsers/shared/public_ip.rb +1 -1
- data/lib/fog/terremark/parsers/shared/task.rb +3 -14
- data/lib/fog/terremark/parsers/shared/vapp.rb +3 -14
- data/lib/fog/vcloud/compute.rb +1 -0
- data/lib/fog/vcloud/models/compute/server.rb +15 -2
- data/lib/fog/vcloud/models/compute/vapp.rb +11 -0
- data/lib/fog/vcloud/requests/compute/configure_vm_network.rb +37 -0
- data/lib/fog/vcloud/requests/compute/instantiate_vapp_template.rb +8 -4
- data/lib/fog/version.rb +1 -1
- data/lib/fog/volume.rb +6 -6
- data/lib/fog/vsphere/requests/compute/create_vm.rb +18 -3
- data/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb +1 -1
- data/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb +1 -1
- data/tests/aws/models/data_pipeline/pipeline_tests.rb +8 -0
- data/tests/aws/models/data_pipeline/pipelines_tests.rb +8 -0
- data/tests/aws/models/rds/server_tests.rb +10 -9
- data/tests/aws/requests/compute/image_tests.rb +2 -2
- data/tests/aws/requests/compute/security_group_tests.rb +1 -1
- data/tests/aws/requests/compute/spot_instance_tests.rb +3 -2
- data/tests/aws/requests/data_pipeline/helper.rb +44 -0
- data/tests/aws/requests/data_pipeline/pipeline_tests.rb +54 -0
- data/tests/aws/requests/rds/instance_tests.rb +8 -5
- data/tests/bluebox/requests/blb/helper.rb +64 -0
- data/tests/bluebox/requests/blb/lb_tests.rb +75 -0
- data/tests/brightbox/requests/compute/firewall_policy_tests.rb +7 -0
- data/tests/brightbox/requests/compute/helper.rb +4 -2
- data/tests/compute/helper.rb +8 -0
- data/tests/core/user_agent_tests.rb +6 -0
- data/tests/dreamhost/README.md +56 -0
- data/tests/dreamhost/dns_tests.rb +20 -0
- data/tests/dreamhost/helper.rb +19 -0
- data/tests/dreamhost/models/dns/record_tests.rb +73 -0
- data/tests/dreamhost/models/dns/records_tests.rb +29 -0
- data/tests/dreamhost/models/dns/zone_tests.rb +62 -0
- data/tests/dreamhost/models/dns/zones_tests.rb +29 -0
- data/tests/dreamhost/requests/dns/create_record_tests.rb +39 -0
- data/tests/dreamhost/requests/dns/delete_record_tests.rb +26 -0
- data/tests/dreamhost/requests/dns/list_records_tests.rb +31 -0
- data/tests/glesys/requests/compute/helper.rb +5 -5
- data/tests/helper.rb +1 -1
- data/tests/helpers/formats_helper.rb +63 -50
- data/tests/helpers/formats_helper_tests.rb +87 -36
- data/tests/helpers/mock_helper.rb +4 -1
- data/tests/helpers/schema_validator_tests.rb +107 -0
- data/tests/hp/models/block_storage/bootable_volume_tests.rb +23 -0
- data/tests/hp/models/block_storage/snapshot_tests.rb +23 -0
- data/tests/hp/models/block_storage/volume_tests.rb +21 -0
- data/tests/hp/models/compute/address_tests.rb +1 -1
- data/tests/hp/models/compute/addresses_tests.rb +1 -1
- data/tests/hp/models/compute/key_pair_tests.rb +1 -1
- data/tests/hp/models/compute/key_pairs_tests.rb +1 -1
- data/tests/hp/models/compute/metadata_image_tests.rb +60 -0
- data/tests/hp/models/compute/metadata_server_tests.rb +54 -0
- data/tests/hp/models/compute/security_group_tests.rb +3 -1
- data/tests/hp/models/compute/security_groups_tests.rb +1 -1
- data/tests/hp/models/storage/directories_tests.rb +23 -0
- data/tests/hp/models/storage/directory_tests.rb +62 -0
- data/tests/hp/models/storage/file_tests.rb +44 -0
- data/tests/hp/models/storage/files_tests.rb +38 -0
- data/tests/hp/requests/block_storage/bootable_volume_tests.rb +78 -0
- data/tests/hp/requests/block_storage/snapshot_tests.rb +56 -0
- data/tests/hp/requests/block_storage/volume_tests.rb +94 -0
- data/tests/hp/requests/cdn/container_tests.rb +1 -1
- data/tests/hp/requests/compute/address_tests.rb +5 -6
- data/tests/hp/requests/compute/flavor_tests.rb +1 -1
- data/tests/hp/requests/compute/image_tests.rb +1 -1
- data/tests/hp/requests/compute/key_pair_tests.rb +1 -1
- data/tests/hp/requests/compute/metadata_tests.rb +70 -0
- data/tests/hp/requests/compute/persistent_server_tests.rb +66 -0
- data/tests/hp/requests/compute/security_group_rule_tests.rb +1 -1
- data/tests/hp/requests/compute/security_group_tests.rb +1 -1
- data/tests/hp/requests/compute/server_address_tests.rb +1 -1
- data/tests/hp/requests/compute/server_tests.rb +5 -6
- data/tests/hp/requests/compute/server_volume_tests.rb +76 -0
- data/tests/hp/requests/storage/container_tests.rb +1 -1
- data/tests/hp/requests/storage/object_tests.rb +9 -1
- data/tests/hp/user_agent_tests.rb +13 -0
- data/tests/internet_archive/models/storage/directory_tests.rb +51 -0
- data/tests/internet_archive/models/storage/file_tests.rb +80 -0
- data/tests/internet_archive/models/storage/files_tests.rb +56 -0
- data/tests/internet_archive/models/storage/url_tests.rb +28 -0
- data/tests/internet_archive/models/storage/version_tests.rb +52 -0
- data/tests/internet_archive/models/storage/versions_tests.rb +56 -0
- data/tests/internet_archive/requests/storage/acl_utils_tests.rb +209 -0
- data/tests/internet_archive/requests/storage/bucket_tests.rb +328 -0
- data/tests/internet_archive/requests/storage/cors_utils_tests.rb +108 -0
- data/tests/internet_archive/requests/storage/multipart_upload_tests.rb +132 -0
- data/tests/internet_archive/requests/storage/object_tests.rb +166 -0
- data/tests/internet_archive/requests/storage/versioning_tests.rb +258 -0
- data/tests/internet_archive/signaturev4_tests.rb +41 -0
- data/tests/internet_archive/signed_params_tests.rb +5 -0
- data/tests/openstack/models/compute/images_tests.rb +14 -0
- data/tests/openstack/models/compute/server_tests.rb +42 -1
- data/tests/openstack/models/identity/roles_tests.rb +1 -0
- data/tests/openstack/models/identity/user_tests.rb +2 -2
- data/tests/openstack/models/network/network_tests.rb +21 -1
- data/tests/openstack/models/storage/file_tests.rb +178 -0
- data/tests/openstack/requests/compute/limit_tests.rb +1 -1
- data/tests/openstack/requests/compute/tenant_tests.rb +2 -2
- data/tests/openstack/requests/identity/ec2_credentials_tests.rb +7 -4
- data/tests/openstack/requests/identity/helper.rb +17 -0
- data/tests/openstack/requests/identity/role_tests.rb +6 -0
- data/tests/openstack/requests/identity/tenant_tests.rb +14 -12
- data/tests/openstack/requests/identity/user_tests.rb +9 -5
- data/tests/openstack/requests/storage/container_tests.rb +64 -0
- data/tests/openstack/requests/storage/large_object_tests.rb +47 -0
- data/tests/openstack/requests/storage/object_tests.rb +84 -0
- data/tests/openstack/volume_tests.rb +15 -0
- data/tests/rackspace/cdn_tests.rb +78 -0
- data/tests/rackspace/helper.rb +9 -0
- data/tests/rackspace/models/compute_v2/flavors_tests.rb +1 -1
- data/tests/rackspace/models/compute_v2/image_tests.rb +2 -4
- data/tests/rackspace/models/compute_v2/images_tests.rb +1 -1
- data/tests/rackspace/models/compute_v2/metadata_tests.rb +5 -3
- data/tests/rackspace/models/compute_v2/network_tests.rb +10 -0
- data/tests/rackspace/models/compute_v2/networks_tests.rb +10 -0
- data/tests/rackspace/models/compute_v2/server_tests.rb +8 -7
- data/tests/rackspace/models/compute_v2/servers_tests.rb +5 -7
- data/tests/rackspace/models/dns/zones_tests.rb +22 -0
- data/tests/rackspace/models/identity/credentials_tests.rb +14 -5
- data/tests/rackspace/models/storage/account_tests.rb +28 -0
- data/tests/rackspace/models/storage/directories_tests.rb +29 -0
- data/tests/rackspace/models/storage/directory_tests.rb +141 -0
- data/tests/rackspace/models/storage/file_tests.rb +86 -11
- data/tests/rackspace/models/storage/metadata_tests.rb +174 -0
- data/tests/rackspace/requests/cdn/cdn_tests.rb +76 -0
- data/tests/rackspace/requests/compute/image_tests.rb +2 -2
- data/tests/rackspace/requests/compute_v2/image_tests.rb +6 -6
- data/tests/rackspace/requests/compute_v2/network_tests.rb +49 -0
- data/tests/rackspace/requests/identity/user_tests.rb +0 -4
- data/tests/rackspace/requests/storage/container_tests.rb +8 -1
- data/tests/rackspace/storage_tests.rb +8 -0
- data/tests/storage/helper.rb +3 -0
- metadata +341 -40
- data/docs/storage/aws.markdown +0 -21
- data/lib/fog/bin/virtual_box.rb +0 -57
- data/lib/fog/rackspace/docs/cloud_servers.md +0 -65
- data/lib/fog/rackspace/requests/identity/get_credentials.rb +0 -15
- data/lib/fog/virtual_box.rb +0 -11
- data/lib/fog/virtual_box/compute.rb +0 -59
- data/lib/fog/virtual_box/models/compute/medium.rb +0 -87
- data/lib/fog/virtual_box/models/compute/medium_format.rb +0 -34
- data/lib/fog/virtual_box/models/compute/mediums.rb +0 -32
- data/lib/fog/virtual_box/models/compute/nat_engine.rb +0 -65
- data/lib/fog/virtual_box/models/compute/nat_redirect.rb +0 -91
- data/lib/fog/virtual_box/models/compute/nat_redirects.rb +0 -41
- data/lib/fog/virtual_box/models/compute/network_adapter.rb +0 -82
- data/lib/fog/virtual_box/models/compute/network_adapters.rb +0 -42
- data/lib/fog/virtual_box/models/compute/server.rb +0 -199
- data/lib/fog/virtual_box/models/compute/servers.rb +0 -41
- data/lib/fog/virtual_box/models/compute/storage_controller.rb +0 -83
- data/lib/fog/virtual_box/models/compute/storage_controllers.rb +0 -38
@@ -0,0 +1,49 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class InternetArchive
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# Change who pays for requests to an S3 bucket
|
7
|
+
#
|
8
|
+
# @param bucket_name [String] name of bucket to modify
|
9
|
+
# @param payer [String] valid values are BucketOwner or Requester
|
10
|
+
#
|
11
|
+
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTrequestPaymentPUT.html
|
12
|
+
|
13
|
+
def put_request_payment(bucket_name, payer)
|
14
|
+
data =
|
15
|
+
<<-DATA
|
16
|
+
<RequestPaymentConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
17
|
+
<Payer>#{payer}</Payer>
|
18
|
+
</RequestPaymentConfiguration>
|
19
|
+
DATA
|
20
|
+
request({
|
21
|
+
:body => data,
|
22
|
+
:expects => 200,
|
23
|
+
:headers => {},
|
24
|
+
:host => "#{bucket_name}.#{@host}",
|
25
|
+
:method => 'PUT',
|
26
|
+
:query => {'requestPayment' => nil}
|
27
|
+
})
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
class Mock # :nodoc:all
|
33
|
+
|
34
|
+
def put_request_payment(bucket_name, payer)
|
35
|
+
response = Excon::Response.new
|
36
|
+
if bucket = self.data[:buckets][bucket_name]
|
37
|
+
response.status = 200
|
38
|
+
bucket['Payer'] = payer
|
39
|
+
else
|
40
|
+
response.status = 404
|
41
|
+
raise(Excon::Errors.status_error({:expects => 200}, response))
|
42
|
+
end
|
43
|
+
response
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class InternetArchive
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# Sync clock against S3 to avoid skew errors
|
7
|
+
#
|
8
|
+
def sync_clock
|
9
|
+
response = begin
|
10
|
+
get_service
|
11
|
+
rescue Excon::Errors::HTTPStatusError => error
|
12
|
+
error.response
|
13
|
+
end
|
14
|
+
Fog::Time.now = Time.parse(response.headers['Date'])
|
15
|
+
end
|
16
|
+
|
17
|
+
end # Real
|
18
|
+
|
19
|
+
class Mock # :nodoc:all
|
20
|
+
|
21
|
+
def sync_clock
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
end # Mock
|
26
|
+
end # Storage
|
27
|
+
end # InternetArchive
|
28
|
+
end # Fog
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class InternetArchive
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# Upload a part for a multipart upload
|
7
|
+
#
|
8
|
+
# @param bucket_name [String] Name of bucket to add part to
|
9
|
+
# @param object_name [String] Name of object to add part to
|
10
|
+
# @param upload_id [String] Id of upload to add part to
|
11
|
+
# @param part_number [String] Index of part in upload
|
12
|
+
# @param data [File||String] Content for part
|
13
|
+
# @param options [Hash]
|
14
|
+
# @option options Content-MD5 [String] Base64 encoded 128-bit MD5 digest of message
|
15
|
+
#
|
16
|
+
# @return [Excon::Response] response
|
17
|
+
# * headers [Hash]:
|
18
|
+
# * ETag [String] etag of new object (will be needed to complete upload)
|
19
|
+
#
|
20
|
+
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadUploadPart.html
|
21
|
+
#
|
22
|
+
def upload_part(bucket_name, object_name, upload_id, part_number, data, options = {})
|
23
|
+
data = Fog::Storage.parse_data(data)
|
24
|
+
headers = options
|
25
|
+
headers['Content-Length'] = data[:headers]['Content-Length']
|
26
|
+
request({
|
27
|
+
:body => data[:body],
|
28
|
+
:expects => 200,
|
29
|
+
:idempotent => true,
|
30
|
+
:headers => headers,
|
31
|
+
:host => "#{bucket_name}.#{@host}",
|
32
|
+
:method => 'PUT',
|
33
|
+
:path => CGI.escape(object_name),
|
34
|
+
:query => {'uploadId' => upload_id, 'partNumber' => part_number}
|
35
|
+
})
|
36
|
+
end
|
37
|
+
|
38
|
+
end # Real
|
39
|
+
end # Storage
|
40
|
+
end # InternetArchive
|
41
|
+
end # Fog
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# See http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html
|
2
|
+
#
|
3
|
+
module Fog
|
4
|
+
module InternetArchive
|
5
|
+
class SignatureV4
|
6
|
+
def initialize(ia_access_key_id, secret_key, region,service)
|
7
|
+
@region = region
|
8
|
+
@service = service
|
9
|
+
@ia_access_key_id = ia_access_key_id
|
10
|
+
@hmac = Fog::HMAC.new('sha256', 'AWS4' + secret_key)
|
11
|
+
end
|
12
|
+
|
13
|
+
def sign(params, date)
|
14
|
+
canonical_request = <<-DATA
|
15
|
+
#{params[:method].to_s.upcase}
|
16
|
+
#{params[:path]}
|
17
|
+
#{canonical_query_string(params[:query])}
|
18
|
+
#{canonical_headers(params[:headers])}
|
19
|
+
#{signed_headers(params[:headers])}
|
20
|
+
#{Digest::SHA256.hexdigest(params[:body] || '')}
|
21
|
+
DATA
|
22
|
+
canonical_request.chop!
|
23
|
+
credential_scope = "#{date.utc.strftime('%Y%m%d')}/#{@region}/#{@service}/aws4_request"
|
24
|
+
string_to_sign = <<-DATA
|
25
|
+
AWS4-HMAC-SHA256
|
26
|
+
#{date.to_iso8601_basic}
|
27
|
+
#{credential_scope}
|
28
|
+
#{Digest::SHA256.hexdigest(canonical_request)}
|
29
|
+
DATA
|
30
|
+
|
31
|
+
string_to_sign.chop!
|
32
|
+
|
33
|
+
signature = derived_hmac(date).sign(string_to_sign)
|
34
|
+
|
35
|
+
"AWS4-HMAC-SHA256 Credential=#{@ia_access_key_id}/#{credential_scope}, SignedHeaders=#{signed_headers(params[:headers])}, Signature=#{signature.unpack('H*').first}"
|
36
|
+
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def canonical_query_string(query)
|
41
|
+
canonical_query_string = []
|
42
|
+
for key in (query || {}).keys.sort_by {|k| k.to_s}
|
43
|
+
component = "#{Fog::InternetArchive.escape(key.to_s)}=#{Fog::InternetArchive.escape(query[key].to_s)}"
|
44
|
+
canonical_query_string << component
|
45
|
+
end
|
46
|
+
canonical_query_string.join("&")
|
47
|
+
end
|
48
|
+
|
49
|
+
def canonical_headers(headers)
|
50
|
+
canonical_headers = ''
|
51
|
+
|
52
|
+
for key in headers.keys.sort_by {|k| k.to_s}
|
53
|
+
canonical_headers << "#{key.to_s.downcase}:#{headers[key].to_s.strip}\n"
|
54
|
+
end
|
55
|
+
canonical_headers
|
56
|
+
end
|
57
|
+
|
58
|
+
def signed_headers(headers)
|
59
|
+
headers.keys.collect {|key| key.to_s}.sort.collect {|key| key.downcase}.join(';')
|
60
|
+
end
|
61
|
+
|
62
|
+
def derived_hmac(date)
|
63
|
+
kDate = @hmac.sign(date.utc.strftime('%Y%m%d'))
|
64
|
+
kRegion = Fog::HMAC.new('sha256', kDate).sign(@region)
|
65
|
+
kService = Fog::HMAC.new('sha256', kRegion).sign(@service)
|
66
|
+
kSigning = Fog::HMAC.new('sha256', kService).sign('aws4_request')
|
67
|
+
Fog::HMAC.new('sha256', kSigning)
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,402 @@
|
|
1
|
+
require 'fog/internet_archive'
|
2
|
+
require 'fog/storage'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Storage
|
6
|
+
class InternetArchive < Fog::Service
|
7
|
+
|
8
|
+
requires :ia_access_key_id, :ia_secret_access_key
|
9
|
+
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent, :ia_session_token, :ia_credentials_expire_at
|
10
|
+
|
11
|
+
secrets :ia_secret_access_key, :hmac
|
12
|
+
|
13
|
+
model_path 'fog/internet_archive/models/storage'
|
14
|
+
collection :directories
|
15
|
+
model :directory
|
16
|
+
collection :files
|
17
|
+
model :file
|
18
|
+
|
19
|
+
request_path 'fog/internet_archive/requests/storage'
|
20
|
+
request :abort_multipart_upload
|
21
|
+
request :complete_multipart_upload
|
22
|
+
request :copy_object
|
23
|
+
request :delete_bucket
|
24
|
+
request :delete_bucket_cors
|
25
|
+
request :delete_bucket_lifecycle
|
26
|
+
request :delete_bucket_policy
|
27
|
+
request :delete_bucket_website
|
28
|
+
request :delete_object
|
29
|
+
request :delete_multiple_objects
|
30
|
+
request :get_bucket
|
31
|
+
request :get_bucket_acl
|
32
|
+
request :get_bucket_cors
|
33
|
+
request :get_bucket_lifecycle
|
34
|
+
request :get_bucket_location
|
35
|
+
request :get_bucket_logging
|
36
|
+
request :get_bucket_object_versions
|
37
|
+
request :get_bucket_policy
|
38
|
+
request :get_bucket_versioning
|
39
|
+
request :get_bucket_website
|
40
|
+
request :get_object
|
41
|
+
request :get_object_acl
|
42
|
+
request :get_object_torrent
|
43
|
+
request :get_object_http_url
|
44
|
+
request :get_object_https_url
|
45
|
+
request :get_object_url
|
46
|
+
request :get_request_payment
|
47
|
+
request :get_service
|
48
|
+
request :head_object
|
49
|
+
request :initiate_multipart_upload
|
50
|
+
request :list_multipart_uploads
|
51
|
+
request :list_parts
|
52
|
+
request :post_object_hidden_fields
|
53
|
+
request :put_bucket
|
54
|
+
request :put_bucket_acl
|
55
|
+
request :put_bucket_cors
|
56
|
+
request :put_bucket_lifecycle
|
57
|
+
request :put_bucket_logging
|
58
|
+
request :put_bucket_policy
|
59
|
+
request :put_bucket_versioning
|
60
|
+
request :put_bucket_website
|
61
|
+
request :put_object
|
62
|
+
request :put_object_acl
|
63
|
+
request :put_object_url
|
64
|
+
request :put_request_payment
|
65
|
+
request :sync_clock
|
66
|
+
request :upload_part
|
67
|
+
|
68
|
+
module Utils
|
69
|
+
|
70
|
+
attr_accessor :region
|
71
|
+
|
72
|
+
def http_url(params, expires)
|
73
|
+
scheme_host_path_query(params.merge(:scheme => 'http', :port => 80), expires)
|
74
|
+
end
|
75
|
+
|
76
|
+
def https_url(params, expires)
|
77
|
+
scheme_host_path_query(params.merge(:scheme => 'https', :port => 443), expires)
|
78
|
+
end
|
79
|
+
|
80
|
+
def url(params, expires)
|
81
|
+
Fog::Logger.deprecation("Fog::Storage::InternetArchive => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
|
82
|
+
https_url(params, expires)
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def scheme_host_path_query(params, expires)
|
88
|
+
params[:scheme] ||= @scheme
|
89
|
+
if params[:port] == 80 && params[:scheme] == 'http'
|
90
|
+
params.delete(:port)
|
91
|
+
end
|
92
|
+
if params[:port] == 443 && params[:scheme] == 'https'
|
93
|
+
params.delete(:port)
|
94
|
+
end
|
95
|
+
params[:headers] ||= {}
|
96
|
+
params[:headers]['Date'] = expires.to_i
|
97
|
+
params[:path] = Fog::InternetArchive.escape(params[:path]).gsub('%2F', '/')
|
98
|
+
query = []
|
99
|
+
params[:headers]['x-amz-security-token'] = @ia_session_token if @ia_session_token
|
100
|
+
if params[:query]
|
101
|
+
for key, value in params[:query]
|
102
|
+
query << "#{key}=#{Fog::InternetArchive.escape(value)}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
query << "AWSAccessKeyId=#{@ia_access_key_id}"
|
106
|
+
query << "Signature=#{Fog::InternetArchive.escape(signature(params))}"
|
107
|
+
query << "Expires=#{params[:headers]['Date']}"
|
108
|
+
query << "x-amz-security-token=#{Fog::InternetArchive.escape(@ia_session_token)}" if @ia_session_token
|
109
|
+
port_part = params[:port] && ":#{params[:port]}"
|
110
|
+
"#{params[:scheme]}://#{params[:host]}#{port_part}/#{params[:path]}?#{query.join('&')}"
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
class Mock
|
116
|
+
include Utils
|
117
|
+
|
118
|
+
def self.acls(type)
|
119
|
+
case type
|
120
|
+
when 'private'
|
121
|
+
{
|
122
|
+
"AccessControlList" => [
|
123
|
+
{
|
124
|
+
"Permission" => "FULL_CONTROL",
|
125
|
+
"Grantee" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
|
126
|
+
}
|
127
|
+
],
|
128
|
+
"Owner" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
|
129
|
+
}
|
130
|
+
when 'public-read'
|
131
|
+
{
|
132
|
+
"AccessControlList" => [
|
133
|
+
{
|
134
|
+
"Permission" => "FULL_CONTROL",
|
135
|
+
"Grantee" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
|
136
|
+
},
|
137
|
+
{
|
138
|
+
"Permission" => "READ",
|
139
|
+
"Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AllUsers"}
|
140
|
+
}
|
141
|
+
],
|
142
|
+
"Owner" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
|
143
|
+
}
|
144
|
+
when 'public-read-write'
|
145
|
+
{
|
146
|
+
"AccessControlList" => [
|
147
|
+
{
|
148
|
+
"Permission" => "FULL_CONTROL",
|
149
|
+
"Grantee" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
|
150
|
+
},
|
151
|
+
{
|
152
|
+
"Permission" => "READ",
|
153
|
+
"Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AllUsers"}
|
154
|
+
},
|
155
|
+
{
|
156
|
+
"Permission" => "WRITE",
|
157
|
+
"Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AllUsers"}
|
158
|
+
}
|
159
|
+
],
|
160
|
+
"Owner" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
|
161
|
+
}
|
162
|
+
when 'authenticated-read'
|
163
|
+
{
|
164
|
+
"AccessControlList" => [
|
165
|
+
{
|
166
|
+
"Permission" => "FULL_CONTROL",
|
167
|
+
"Grantee" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
|
168
|
+
},
|
169
|
+
{
|
170
|
+
"Permission" => "READ",
|
171
|
+
"Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AuthenticatedUsers"}
|
172
|
+
}
|
173
|
+
],
|
174
|
+
"Owner" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
|
175
|
+
}
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def self.data
|
180
|
+
@data ||= Hash.new do |hash, region|
|
181
|
+
hash[region] = Hash.new do |region_hash, key|
|
182
|
+
region_hash[key] = {
|
183
|
+
:acls => {
|
184
|
+
:bucket => {},
|
185
|
+
:object => {}
|
186
|
+
},
|
187
|
+
:buckets => {},
|
188
|
+
:cors => {
|
189
|
+
:bucket => {}
|
190
|
+
}
|
191
|
+
}
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
def self.reset
|
197
|
+
@data = nil
|
198
|
+
end
|
199
|
+
|
200
|
+
def initialize(options={})
|
201
|
+
require 'mime/types'
|
202
|
+
setup_credentials(options)
|
203
|
+
options[:region] ||= 'us-east-1'
|
204
|
+
@host = options[:host] || case options[:region]
|
205
|
+
when 'us-east-1'
|
206
|
+
"s3.#{Fog::InternetArchive::DOMAIN_NAME}"
|
207
|
+
else
|
208
|
+
"s3-#{options[:region]}.#{Fog::InternetArchive::DOMAIN_NAME}"
|
209
|
+
end
|
210
|
+
@scheme = options[:scheme] || 'https'
|
211
|
+
@region = options[:region]
|
212
|
+
end
|
213
|
+
|
214
|
+
def data
|
215
|
+
self.class.data[@region][@ia_access_key_id]
|
216
|
+
end
|
217
|
+
|
218
|
+
def reset_data
|
219
|
+
self.class.data[@region].delete(@ia_access_key_id)
|
220
|
+
end
|
221
|
+
|
222
|
+
def signature(params)
|
223
|
+
"foo"
|
224
|
+
end
|
225
|
+
|
226
|
+
def setup_credentials(options)
|
227
|
+
@ia_access_key_id = options[:ia_access_key_id]
|
228
|
+
@ia_secret_access_key = options[:ia_secret_access_key]
|
229
|
+
@ia_session_token = options[:ia_session_token]
|
230
|
+
@ia_credentials_expire_at = options[:ia_credentials_expire_at]
|
231
|
+
end
|
232
|
+
|
233
|
+
end
|
234
|
+
|
235
|
+
class Real
|
236
|
+
include Utils
|
237
|
+
# include Fog::InternetArchive::CredentialFetcher::ConnectionMethods
|
238
|
+
# Initialize connection to S3
|
239
|
+
#
|
240
|
+
# ==== Notes
|
241
|
+
# options parameter must include values for :ia_access_key_id and
|
242
|
+
# :ia_secret_access_key in order to create a connection
|
243
|
+
#
|
244
|
+
# ==== Examples
|
245
|
+
# s3 = Fog::Storage.new(
|
246
|
+
# :provider => "InternetArchive",
|
247
|
+
# :ia_access_key_id => your_ia_access_key_id,
|
248
|
+
# :ia_secret_access_key => your_ia_secret_access_key
|
249
|
+
# )
|
250
|
+
#
|
251
|
+
# ==== Parameters
|
252
|
+
# * options<~Hash> - config arguments for connection. Defaults to {}.
|
253
|
+
#
|
254
|
+
# ==== Returns
|
255
|
+
# * S3 object with connection to aws.
|
256
|
+
def initialize(options={})
|
257
|
+
require 'fog/core/parser'
|
258
|
+
require 'mime/types'
|
259
|
+
|
260
|
+
setup_credentials(options)
|
261
|
+
@connection_options = options[:connection_options] || {}
|
262
|
+
|
263
|
+
if @endpoint = options[:endpoint]
|
264
|
+
endpoint = URI.parse(@endpoint)
|
265
|
+
@host = endpoint.host
|
266
|
+
@path = if endpoint.path.empty?
|
267
|
+
'/'
|
268
|
+
else
|
269
|
+
endpoint.path
|
270
|
+
end
|
271
|
+
@port = endpoint.port
|
272
|
+
@scheme = endpoint.scheme
|
273
|
+
else
|
274
|
+
options[:region] ||= 'us-east-1'
|
275
|
+
@region = options[:region]
|
276
|
+
@host = options[:host] || case options[:region]
|
277
|
+
when 'us-east-1'
|
278
|
+
"s3.#{Fog::InternetArchive::DOMAIN_NAME}"
|
279
|
+
else
|
280
|
+
"s3-#{options[:region]}.#{Fog::InternetArchive::DOMAIN_NAME}"
|
281
|
+
end
|
282
|
+
@path = options[:path] || '/'
|
283
|
+
@persistent = options.fetch(:persistent, false)
|
284
|
+
@port = options[:port] || 80
|
285
|
+
@scheme = options[:scheme] || 'http'
|
286
|
+
end
|
287
|
+
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
288
|
+
end
|
289
|
+
|
290
|
+
def reload
|
291
|
+
@connection.reset
|
292
|
+
end
|
293
|
+
|
294
|
+
def signature(params)
|
295
|
+
string_to_sign =
|
296
|
+
<<-DATA
|
297
|
+
#{params[:method].to_s.upcase}
|
298
|
+
#{params[:headers]['Content-MD5']}
|
299
|
+
#{params[:headers]['Content-Type']}
|
300
|
+
#{params[:headers]['Date']}
|
301
|
+
DATA
|
302
|
+
|
303
|
+
amz_headers, canonical_amz_headers = {}, ''
|
304
|
+
for key, value in params[:headers]
|
305
|
+
if key[0..5] == 'x-amz-'
|
306
|
+
amz_headers[key] = value
|
307
|
+
end
|
308
|
+
end
|
309
|
+
amz_headers = amz_headers.sort {|x, y| x[0] <=> y[0]}
|
310
|
+
for key, value in amz_headers
|
311
|
+
canonical_amz_headers << "#{key}:#{value}\n"
|
312
|
+
end
|
313
|
+
string_to_sign << canonical_amz_headers
|
314
|
+
|
315
|
+
subdomain = params[:host].split(".#{@host}").first
|
316
|
+
unless subdomain =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
|
317
|
+
Fog::Logger.warning("fog: the specified s3 bucket name(#{subdomain}) is not a valid dns name, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html")
|
318
|
+
params[:host] = params[:host].split("#{subdomain}.")[-1]
|
319
|
+
if params[:path]
|
320
|
+
params[:path] = "#{subdomain}/#{params[:path]}"
|
321
|
+
else
|
322
|
+
params[:path] = subdomain
|
323
|
+
end
|
324
|
+
subdomain = nil
|
325
|
+
end
|
326
|
+
|
327
|
+
canonical_resource = @path.dup
|
328
|
+
unless subdomain.nil? || subdomain == @host
|
329
|
+
canonical_resource << "#{Fog::InternetArchive.escape(subdomain).downcase}/"
|
330
|
+
end
|
331
|
+
canonical_resource << params[:path].to_s
|
332
|
+
canonical_resource << '?'
|
333
|
+
for key in (params[:query] || {}).keys.sort
|
334
|
+
if %w{
|
335
|
+
acl
|
336
|
+
cors
|
337
|
+
delete
|
338
|
+
lifecycle
|
339
|
+
location
|
340
|
+
logging
|
341
|
+
notification
|
342
|
+
partNumber
|
343
|
+
policy
|
344
|
+
requestPayment
|
345
|
+
response-cache-control
|
346
|
+
response-content-disposition
|
347
|
+
response-content-encoding
|
348
|
+
response-content-language
|
349
|
+
response-content-type
|
350
|
+
response-expires
|
351
|
+
torrent
|
352
|
+
uploadId
|
353
|
+
uploads
|
354
|
+
versionId
|
355
|
+
versioning
|
356
|
+
versions
|
357
|
+
website
|
358
|
+
}.include?(key)
|
359
|
+
canonical_resource << "#{key}#{"=#{params[:query][key]}" unless params[:query][key].nil?}&"
|
360
|
+
end
|
361
|
+
end
|
362
|
+
canonical_resource.chop!
|
363
|
+
string_to_sign << canonical_resource
|
364
|
+
|
365
|
+
signed_string = @hmac.sign(string_to_sign)
|
366
|
+
Base64.encode64(signed_string).chomp!
|
367
|
+
end
|
368
|
+
|
369
|
+
private
|
370
|
+
|
371
|
+
def setup_credentials(options)
|
372
|
+
@ia_access_key_id = options[:ia_access_key_id]
|
373
|
+
@ia_secret_access_key = options[:ia_secret_access_key]
|
374
|
+
@ia_session_token = options[:ia_session_token]
|
375
|
+
@ia_credentials_expire_at = options[:ia_credentials_expire_at]
|
376
|
+
|
377
|
+
@hmac = Fog::HMAC.new('sha1', @ia_secret_access_key)
|
378
|
+
end
|
379
|
+
|
380
|
+
def request(params, &block)
|
381
|
+
# refresh_credentials_if_expired
|
382
|
+
|
383
|
+
params[:headers]['Date'] = Fog::Time.now.to_date_header
|
384
|
+
params[:headers]['x-amz-security-token'] = @ia_session_token if @ia_session_token
|
385
|
+
params[:headers]['Authorization'] = "AWS #{@ia_access_key_id}:#{signature(params)}"
|
386
|
+
# FIXME: ToHashParser should make this not needed
|
387
|
+
original_params = params.dup
|
388
|
+
|
389
|
+
begin
|
390
|
+
response = @connection.request(params, &block)
|
391
|
+
rescue Excon::Errors::TemporaryRedirect => error
|
392
|
+
uri = URI.parse(error.response.headers['Location'])
|
393
|
+
Fog::Logger.warning("fog: followed redirect to #{uri.host}, connecting to the matching region will be more performant")
|
394
|
+
response = Fog::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false, @connection_options).request(original_params, &block)
|
395
|
+
end
|
396
|
+
|
397
|
+
response
|
398
|
+
end
|
399
|
+
end
|
400
|
+
end
|
401
|
+
end
|
402
|
+
end
|