fog 1.19.0 → 1.20.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.travis.yml +10 -0
- data/CONTRIBUTORS.md +694 -0
- data/Gemfile.1.8.7 +1 -1
- data/LICENSE.md +17 -17
- data/Rakefile +1 -1
- data/benchs/each_provider.sh +6 -0
- data/benchs/each_service.sh +6 -0
- data/benchs/load_times.rb +6 -0
- data/changelog.txt +312 -0
- data/fog.gemspec +3 -5
- data/lib/fog.rb +1 -0
- data/lib/fog/atmos.rb +1 -11
- data/lib/fog/atmos/core.rb +11 -0
- data/lib/fog/atmos/requests/storage/get_namespace.rb +1 -1
- data/lib/fog/atmos/requests/storage/head_namespace.rb +1 -1
- data/lib/fog/atmos/storage.rb +1 -1
- data/lib/fog/aws.rb +22 -327
- data/lib/fog/aws/auto_scaling.rb +1 -1
- data/lib/fog/aws/beanstalk.rb +1 -1
- data/lib/fog/aws/cdn.rb +1 -1
- data/lib/fog/aws/cloud_formation.rb +1 -1
- data/lib/fog/aws/cloud_watch.rb +1 -1
- data/lib/fog/aws/compute.rb +12 -1
- data/lib/fog/aws/core.rb +329 -0
- data/lib/fog/aws/data_pipeline.rb +1 -1
- data/lib/fog/aws/dns.rb +1 -1
- data/lib/fog/aws/dynamodb.rb +1 -1
- data/lib/fog/aws/elasticache.rb +10 -3
- data/lib/fog/aws/elb.rb +1 -1
- data/lib/fog/aws/emr.rb +1 -2
- data/lib/fog/aws/glacier.rb +1 -1
- data/lib/fog/aws/iam.rb +1 -1
- data/lib/fog/aws/models/compute/dhcp_option.rb +2 -2
- data/lib/fog/aws/models/compute/flavor.rb +2 -0
- data/lib/fog/aws/models/compute/flavors.rb +363 -49
- data/lib/fog/aws/models/compute/network_acl.rb +170 -0
- data/lib/fog/aws/models/compute/network_acls.rb +138 -0
- data/lib/fog/aws/models/compute/server.rb +2 -2
- data/lib/fog/aws/models/compute/servers.rb +7 -2
- data/lib/fog/aws/models/compute/subnet.rb +2 -2
- data/lib/fog/aws/models/elasticache/cluster.rb +6 -0
- data/lib/fog/aws/models/elasticache/subnet_group.rb +35 -0
- data/lib/fog/aws/models/elasticache/subnet_groups.rb +27 -0
- data/lib/fog/aws/models/rds/snapshot.rb +1 -0
- data/lib/fog/aws/models/storage/file.rb +1 -1
- data/lib/fog/aws/parsers/compute/create_network_acl.rb +28 -0
- data/lib/fog/aws/parsers/compute/create_subnet.rb +2 -3
- data/lib/fog/aws/parsers/compute/describe_network_acls.rb +42 -0
- data/lib/fog/aws/parsers/compute/describe_reserved_instances.rb +29 -3
- data/lib/fog/aws/parsers/compute/network_acl_parser.rb +105 -0
- data/lib/fog/aws/parsers/compute/network_interface_parser.rb +16 -0
- data/lib/fog/aws/parsers/compute/replace_network_acl_association.rb +20 -0
- data/lib/fog/aws/parsers/compute/run_instances.rb +1 -1
- data/lib/fog/aws/parsers/elasticache/cache_cluster_parser.rb +2 -2
- data/lib/fog/aws/parsers/elasticache/create_cache_subnet_group.rb +38 -0
- data/lib/fog/aws/parsers/elasticache/describe_cache_subnet_groups.rb +38 -0
- data/lib/fog/aws/parsers/elasticache/subnet_group_parser.rb +38 -0
- data/lib/fog/aws/parsers/iam/upload_server_certificate.rb +1 -1
- data/lib/fog/aws/parsers/rds/db_parser.rb +6 -0
- data/lib/fog/aws/parsers/rds/snapshot_parser.rb +1 -0
- data/lib/fog/aws/rds.rb +1 -1
- data/lib/fog/aws/redshift.rb +1 -1
- data/lib/fog/aws/requests/compute/associate_address.rb +1 -0
- data/lib/fog/aws/requests/compute/create_network_acl.rb +105 -0
- data/lib/fog/aws/requests/compute/create_network_acl_entry.rb +80 -0
- data/lib/fog/aws/requests/compute/create_subnet.rb +14 -4
- data/lib/fog/aws/requests/compute/create_vpc.rb +7 -1
- data/lib/fog/aws/requests/compute/delete_network_acl.rb +52 -0
- data/lib/fog/aws/requests/compute/delete_network_acl_entry.rb +55 -0
- data/lib/fog/aws/requests/compute/delete_vpc.rb +4 -0
- data/lib/fog/aws/requests/compute/describe_addresses.rb +1 -1
- data/lib/fog/aws/requests/compute/describe_network_acls.rb +104 -0
- data/lib/fog/aws/requests/compute/describe_network_interfaces.rb +4 -0
- data/lib/fog/aws/requests/compute/disassociate_address.rb +4 -3
- data/lib/fog/aws/requests/compute/replace_network_acl_association.rb +66 -0
- data/lib/fog/aws/requests/compute/replace_network_acl_entry.rb +81 -0
- data/lib/fog/aws/requests/compute/replace_route.rb +84 -0
- data/lib/fog/aws/requests/compute/request_spot_instances.rb +8 -0
- data/lib/fog/aws/requests/compute/run_instances.rb +23 -3
- data/lib/fog/aws/requests/data_pipeline/put_pipeline_definition.rb +29 -21
- data/lib/fog/aws/requests/elasticache/create_cache_cluster.rb +18 -11
- data/lib/fog/aws/requests/elasticache/create_cache_subnet_group.rb +66 -0
- data/lib/fog/aws/requests/elasticache/delete_cache_subnet_group.rb +40 -0
- data/lib/fog/aws/requests/elasticache/describe_cache_subnet_groups.rb +63 -0
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +3 -2
- data/lib/fog/aws/requests/iam/delete_server_certificate.rb +3 -1
- data/lib/fog/aws/requests/rds/create_db_instance.rb +2 -0
- data/lib/fog/aws/requests/rds/create_db_instance_read_replica.rb +1 -0
- data/lib/fog/aws/requests/rds/create_db_snapshot.rb +1 -1
- data/lib/fog/aws/requests/rds/create_db_subnet_group.rb +2 -0
- data/lib/fog/aws/requests/rds/modify_db_instance.rb +1 -0
- data/lib/fog/aws/requests/storage/abort_multipart_upload.rb +18 -0
- data/lib/fog/aws/requests/storage/complete_multipart_upload.rb +23 -0
- data/lib/fog/aws/requests/storage/initiate_multipart_upload.rb +24 -0
- data/lib/fog/aws/requests/storage/put_object.rb +18 -54
- data/lib/fog/aws/requests/storage/shared_mock_methods.rb +87 -0
- data/lib/fog/aws/requests/storage/upload_part.rb +18 -0
- data/lib/fog/aws/ses.rb +1 -1
- data/lib/fog/aws/simpledb.rb +1 -1
- data/lib/fog/aws/sns.rb +1 -2
- data/lib/fog/aws/sqs.rb +5 -4
- data/lib/fog/aws/storage.rb +15 -5
- data/lib/fog/aws/sts.rb +1 -1
- data/lib/fog/bare_metal_cloud.rb +1 -11
- data/lib/fog/bare_metal_cloud/compute.rb +1 -1
- data/lib/fog/bare_metal_cloud/core.rb +11 -0
- data/lib/fog/bin.rb +1 -0
- data/lib/fog/bin/rage4.rb +31 -0
- data/lib/fog/bluebox.rb +3 -13
- data/lib/fog/bluebox/blb.rb +2 -2
- data/lib/fog/bluebox/compute.rb +1 -1
- data/lib/fog/bluebox/core.rb +13 -0
- data/lib/fog/bluebox/dns.rb +2 -2
- data/lib/fog/bluebox/models/compute/server.rb +1 -1
- data/lib/fog/brightbox.rb +1 -10
- data/lib/fog/brightbox/compute.rb +20 -1
- data/lib/fog/brightbox/core.rb +10 -0
- data/lib/fog/brightbox/models/compute/cloud_ip.rb +5 -0
- data/lib/fog/brightbox/models/compute/database_server.rb +91 -0
- data/lib/fog/brightbox/models/compute/database_servers.rb +28 -0
- data/lib/fog/brightbox/models/compute/database_snapshot.rb +52 -0
- data/lib/fog/brightbox/models/compute/database_snapshots.rb +24 -0
- data/lib/fog/brightbox/models/compute/database_type.rb +19 -0
- data/lib/fog/brightbox/models/compute/database_types.rb +26 -0
- data/lib/fog/brightbox/requests/compute/create_database_server.rb +25 -0
- data/lib/fog/brightbox/requests/compute/delete_database_server.rb +26 -0
- data/lib/fog/brightbox/requests/compute/delete_database_snapshot.rb +26 -0
- data/lib/fog/brightbox/requests/compute/get_database_server.rb +19 -0
- data/lib/fog/brightbox/requests/compute/get_database_snapshot.rb +19 -0
- data/lib/fog/brightbox/requests/compute/get_database_type.rb +21 -0
- data/lib/fog/brightbox/requests/compute/list_database_servers.rb +17 -0
- data/lib/fog/brightbox/requests/compute/list_database_snapshots.rb +17 -0
- data/lib/fog/brightbox/requests/compute/list_database_types.rb +19 -0
- data/lib/fog/brightbox/requests/compute/reset_password_database_server.rb +19 -0
- data/lib/fog/brightbox/requests/compute/snapshot_database_server.rb +19 -0
- data/lib/fog/brightbox/requests/compute/update_database_server.rb +25 -0
- data/lib/fog/brightbox/requests/compute/update_database_snapshot.rb +26 -0
- data/lib/fog/clodo.rb +1 -34
- data/lib/fog/clodo/compute.rb +2 -0
- data/lib/fog/clodo/core.rb +34 -0
- data/lib/fog/clodo/models/compute/server.rb +2 -2
- data/lib/fog/cloudsigma.rb +1 -9
- data/lib/fog/cloudsigma/compute.rb +2 -2
- data/lib/fog/cloudsigma/core.rb +9 -0
- data/lib/fog/cloudstack.rb +1 -40
- data/lib/fog/cloudstack/compute.rb +1 -1
- data/lib/fog/cloudstack/core.rb +40 -0
- data/lib/fog/cloudstack/models/compute/server.rb +3 -0
- data/lib/fog/compute/models/server.rb +33 -7
- data/lib/fog/core/collection.rb +1 -3
- data/lib/fog/core/errors.rb +2 -0
- data/lib/fog/core/hmac.rb +3 -16
- data/lib/fog/core/logger.rb +3 -3
- data/lib/fog/core/provider.rb +1 -2
- data/lib/fog/digitalocean.rb +1 -9
- data/lib/fog/digitalocean/compute.rb +1 -1
- data/lib/fog/digitalocean/core.rb +9 -0
- data/lib/fog/digitalocean/models/compute/server.rb +3 -2
- data/lib/fog/digitalocean/models/compute/servers.rb +23 -4
- data/lib/fog/digitalocean/requests/compute/create_server.rb +2 -1
- data/lib/fog/digitalocean/requests/compute/destroy_server.rb +3 -1
- data/lib/fog/dnsimple.rb +1 -11
- data/lib/fog/dnsimple/core.rb +11 -0
- data/lib/fog/dnsimple/dns.rb +5 -2
- data/lib/fog/dnsimple/models/dns/record.rb +3 -3
- data/lib/fog/dnsimple/requests/dns/create_domain.rb +26 -22
- data/lib/fog/dnsimple/requests/dns/create_record.rb +21 -24
- data/lib/fog/dnsimple/requests/dns/delete_domain.rb +7 -6
- data/lib/fog/dnsimple/requests/dns/delete_record.rb +7 -5
- data/lib/fog/dnsimple/requests/dns/get_domain.rb +12 -18
- data/lib/fog/dnsimple/requests/dns/get_record.rb +11 -17
- data/lib/fog/dnsimple/requests/dns/list_domains.rb +7 -15
- data/lib/fog/dnsimple/requests/dns/list_records.rb +10 -15
- data/lib/fog/dnsimple/requests/dns/update_record.rb +14 -19
- data/lib/fog/dnsmadeeasy.rb +1 -11
- data/lib/fog/dnsmadeeasy/core.rb +11 -0
- data/lib/fog/dnsmadeeasy/dns.rb +1 -1
- data/lib/fog/dreamhost.rb +1 -11
- data/lib/fog/dreamhost/core.rb +11 -0
- data/lib/fog/dreamhost/dns.rb +1 -1
- data/lib/fog/dynect.rb +1 -26
- data/lib/fog/dynect/core.rb +26 -0
- data/lib/fog/dynect/dns.rb +1 -1
- data/lib/fog/dynect/requests/dns/put_record.rb +5 -4
- data/lib/fog/dynect/requests/dns/put_zone.rb +5 -4
- data/lib/fog/ecloud.rb +1 -31
- data/lib/fog/ecloud/compute.rb +1 -0
- data/lib/fog/ecloud/core.rb +31 -0
- data/lib/fog/glesys.rb +1 -11
- data/lib/fog/glesys/compute.rb +6 -4
- data/lib/fog/glesys/core.rb +11 -0
- data/lib/fog/glesys/models/compute/server.rb +2 -2
- data/lib/fog/go_grid.rb +1 -11
- data/lib/fog/go_grid/compute.rb +1 -1
- data/lib/fog/go_grid/core.rb +11 -0
- data/lib/fog/go_grid/models/compute/server.rb +2 -2
- data/lib/fog/google.rb +2 -24
- data/lib/fog/google/README.md +8 -5
- data/lib/fog/google/compute.rb +60 -17
- data/lib/fog/google/core.rb +24 -0
- data/lib/fog/google/examples/create.rb +12 -1
- data/lib/fog/google/examples/eric-fail.rb +13 -2
- data/lib/fog/google/examples/image_create.rb +0 -1
- data/lib/fog/google/examples/launch_micro_instance.rb +1 -2
- data/lib/fog/google/examples/metadata.rb +14 -2
- data/lib/fog/google/examples/network.rb +13 -2
- data/lib/fog/google/models/compute/disk.rb +12 -11
- data/lib/fog/google/models/compute/flavor.rb +1 -0
- data/lib/fog/google/models/compute/flavors.rb +1 -1
- data/lib/fog/google/models/compute/image.rb +10 -3
- data/lib/fog/google/models/compute/images.rb +2 -0
- data/lib/fog/google/models/compute/server.rb +27 -4
- data/lib/fog/google/models/compute/servers.rb +26 -10
- data/lib/fog/google/models/compute/zone.rb +1 -0
- data/lib/fog/google/models/compute/zones.rb +1 -1
- data/lib/fog/google/requests/compute/attach_disk.rb +29 -0
- data/lib/fog/google/requests/compute/delete_address.rb +31 -0
- data/lib/fog/google/requests/compute/delete_snapshot.rb +35 -0
- data/lib/fog/google/requests/compute/detach_disk.rb +29 -0
- data/lib/fog/google/requests/compute/get_address.rb +31 -0
- data/lib/fog/google/requests/compute/insert_address.rb +30 -0
- data/lib/fog/google/requests/compute/insert_disk.rb +38 -20
- data/lib/fog/google/requests/compute/insert_firewall.rb +6 -9
- data/lib/fog/google/requests/compute/insert_image.rb +1 -5
- data/lib/fog/google/requests/compute/insert_server.rb +13 -29
- data/lib/fog/google/requests/compute/list_addresses.rb +28 -0
- data/lib/fog/google/requests/compute/set_metadata.rb +4 -5
- data/lib/fog/google/requests/compute/set_tags.rb +33 -0
- data/lib/fog/google/requests/storage/get_bucket_acl.rb +2 -2
- data/lib/fog/google/requests/storage/put_bucket_acl.rb +39 -48
- data/lib/fog/google/requests/storage/put_object_acl.rb +55 -0
- data/lib/fog/google/storage.rb +2 -1
- data/lib/fog/hp.rb +9 -352
- data/lib/fog/hp/block_storage.rb +1 -1
- data/lib/fog/hp/block_storage_v2.rb +1 -1
- data/lib/fog/hp/cdn.rb +1 -1
- data/lib/fog/hp/compute.rb +1 -1
- data/lib/fog/hp/compute_v2.rb +1 -1
- data/lib/fog/hp/core.rb +352 -0
- data/lib/fog/hp/dns.rb +1 -1
- data/lib/fog/hp/lb.rb +1 -1
- data/lib/fog/hp/models/compute/server.rb +2 -2
- data/lib/fog/hp/models/compute_v2/server.rb +2 -2
- data/lib/fog/hp/models/storage/directory.rb +12 -6
- data/lib/fog/hp/network.rb +1 -1
- data/lib/fog/hp/storage.rb +1 -1
- data/lib/fog/ibm.rb +2 -176
- data/lib/fog/ibm/compute.rb +1 -1
- data/lib/fog/ibm/core.rb +176 -0
- data/lib/fog/ibm/storage.rb +1 -1
- data/lib/fog/internet_archive.rb +1 -292
- data/lib/fog/internet_archive/core.rb +292 -0
- data/lib/fog/internet_archive/models/storage/file.rb +1 -1
- data/lib/fog/internet_archive/storage.rb +1 -1
- data/lib/fog/joyent.rb +2 -10
- data/lib/fog/joyent/compute.rb +1 -1
- data/lib/fog/joyent/core.rb +10 -0
- data/lib/fog/joyent/errors.rb +1 -0
- data/lib/fog/libvirt.rb +1 -11
- data/lib/fog/libvirt/compute.rb +1 -1
- data/lib/fog/libvirt/core.rb +11 -0
- data/lib/fog/libvirt/models/compute/README.md +1 -1
- data/lib/fog/libvirt/models/compute/server.rb +6 -6
- data/lib/fog/libvirt/models/compute/templates/volume.xml.erb +12 -0
- data/lib/fog/libvirt/models/compute/volume.rb +1 -0
- data/lib/fog/linode.rb +2 -10
- data/lib/fog/linode/compute.rb +1 -1
- data/lib/fog/linode/core.rb +10 -0
- data/lib/fog/linode/dns.rb +1 -1
- data/lib/fog/local.rb +1 -11
- data/lib/fog/local/core.rb +11 -0
- data/lib/fog/local/storage.rb +1 -1
- data/lib/fog/ninefold.rb +1 -12
- data/lib/fog/ninefold/compute.rb +1 -1
- data/lib/fog/ninefold/core.rb +12 -0
- data/lib/fog/openstack.rb +8 -249
- data/lib/fog/openstack/compute.rb +3 -1
- data/lib/fog/openstack/core.rb +249 -0
- data/lib/fog/openstack/docs/compute.md +681 -0
- data/lib/fog/openstack/docs/getting_started.md +81 -0
- data/lib/fog/openstack/docs/storage.md +441 -0
- data/lib/fog/openstack/identity.rb +1 -1
- data/lib/fog/openstack/image.rb +1 -1
- data/lib/fog/openstack/metering.rb +1 -1
- data/lib/fog/openstack/models/compute/server.rb +13 -5
- data/lib/fog/openstack/models/compute/servers.rb +13 -0
- data/lib/fog/openstack/models/network/network.rb +9 -11
- data/lib/fog/openstack/models/network/security_group.rb +32 -0
- data/lib/fog/openstack/models/network/security_group_rule.rb +33 -0
- data/lib/fog/openstack/models/network/security_group_rules.rb +33 -0
- data/lib/fog/openstack/models/network/security_groups.rb +34 -0
- data/lib/fog/openstack/models/storage/directories.rb +1 -0
- data/lib/fog/openstack/network.rb +19 -1
- data/lib/fog/openstack/orchestration.rb +1 -1
- data/lib/fog/openstack/requests/compute/add_security_group.rb +24 -0
- data/lib/fog/openstack/requests/compute/create_flavor.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +3 -3
- data/lib/fog/openstack/requests/compute/remove_security_group.rb +24 -0
- data/lib/fog/openstack/requests/image/update_image_members.rb +2 -2
- data/lib/fog/openstack/requests/network/create_security_group.rb +94 -0
- data/lib/fog/openstack/requests/network/create_security_group_rule.rb +79 -0
- data/lib/fog/openstack/requests/network/delete_security_group.rb +32 -0
- data/lib/fog/openstack/requests/network/delete_security_group_rule.rb +36 -0
- data/lib/fog/openstack/requests/network/get_security_group.rb +52 -0
- data/lib/fog/openstack/requests/network/get_security_group_rule.rb +47 -0
- data/lib/fog/openstack/requests/network/list_networks.rb +0 -1
- data/lib/fog/openstack/requests/network/list_security_group_rules.rb +52 -0
- data/lib/fog/openstack/requests/network/list_security_groups.rb +57 -0
- data/lib/fog/openstack/storage.rb +2 -2
- data/lib/fog/openstack/volume.rb +1 -1
- data/lib/fog/openvz.rb +1 -9
- data/lib/fog/openvz/compute.rb +1 -1
- data/lib/fog/openvz/core.rb +9 -0
- data/lib/fog/ovirt.rb +1 -17
- data/lib/fog/ovirt/compute.rb +2 -0
- data/lib/fog/ovirt/core.rb +17 -0
- data/lib/fog/rackspace.rb +12 -145
- data/lib/fog/rackspace/auto_scale.rb +1 -1
- data/lib/fog/rackspace/block_storage.rb +5 -1
- data/lib/fog/rackspace/cdn.rb +22 -16
- data/lib/fog/rackspace/compute.rb +1 -1
- data/lib/fog/rackspace/compute_v2.rb +6 -2
- data/lib/fog/rackspace/core.rb +145 -0
- data/lib/fog/rackspace/databases.rb +5 -1
- data/lib/fog/rackspace/dns.rb +1 -1
- data/lib/fog/rackspace/docs/compute_v2.md +2 -10
- data/lib/fog/rackspace/errors.rb +1 -1
- data/lib/fog/rackspace/examples/storage/upload_file.rb +1 -1
- data/lib/fog/rackspace/identity.rb +26 -16
- data/lib/fog/rackspace/load_balancers.rb +7 -1
- data/lib/fog/rackspace/mock_data.rb +17 -0
- data/lib/fog/rackspace/models/compute/server.rb +2 -2
- data/lib/fog/rackspace/models/compute_v2/key_pair.rb +1 -1
- data/lib/fog/rackspace/models/compute_v2/server.rb +42 -5
- data/lib/fog/rackspace/models/monitoring/entities.rb +1 -1
- data/lib/fog/rackspace/models/queues/claim.rb +9 -1
- data/lib/fog/rackspace/models/storage/directory.rb +5 -2
- data/lib/fog/rackspace/models/storage/file.rb +14 -0
- data/lib/fog/rackspace/monitoring.rb +11 -2
- data/lib/fog/rackspace/queues.rb +318 -34
- data/lib/fog/rackspace/requests/compute_v2/create_keypair.rb +16 -5
- data/lib/fog/rackspace/requests/compute_v2/create_server.rb +7 -1
- data/lib/fog/rackspace/requests/compute_v2/delete_keypair.rb +1 -1
- data/lib/fog/rackspace/requests/identity/create_token.rb +192 -0
- data/lib/fog/rackspace/requests/identity/list_tenants.rb +23 -0
- data/lib/fog/rackspace/requests/monitoring/get_agent.rb +45 -0
- data/lib/fog/rackspace/requests/monitoring/get_cpus_info.rb +63 -0
- data/lib/fog/rackspace/requests/monitoring/get_disks_info.rb +56 -0
- data/lib/fog/rackspace/requests/monitoring/get_filesystems_info.rb +64 -0
- data/lib/fog/rackspace/requests/monitoring/get_logged_in_user_info.rb +58 -0
- data/lib/fog/rackspace/requests/monitoring/get_memory_info.rb +59 -0
- data/lib/fog/rackspace/requests/monitoring/get_network_interfaces_info.rb +91 -0
- data/lib/fog/rackspace/requests/monitoring/get_processes_info.rb +72 -0
- data/lib/fog/rackspace/requests/monitoring/get_system_info.rb +53 -0
- data/lib/fog/rackspace/requests/monitoring/list_agents.rb +62 -0
- data/lib/fog/rackspace/requests/queues/create_claim.rb +37 -0
- data/lib/fog/rackspace/requests/queues/create_message.rb +23 -0
- data/lib/fog/rackspace/requests/queues/create_queue.rb +15 -1
- data/lib/fog/rackspace/requests/queues/delete_claim.rb +18 -0
- data/lib/fog/rackspace/requests/queues/delete_message.rb +34 -0
- data/lib/fog/rackspace/requests/queues/delete_queue.rb +12 -0
- data/lib/fog/rackspace/requests/queues/get_claim.rb +15 -0
- data/lib/fog/rackspace/requests/queues/get_message.rb +17 -0
- data/lib/fog/rackspace/requests/queues/get_queue.rb +14 -1
- data/lib/fog/rackspace/requests/queues/get_queue_stats.rb +36 -0
- data/lib/fog/rackspace/requests/queues/list_messages.rb +33 -0
- data/lib/fog/rackspace/requests/queues/list_queues.rb +35 -1
- data/lib/fog/rackspace/requests/queues/update_claim.rb +17 -0
- data/lib/fog/rackspace/requests/storage/delete_container.rb +15 -0
- data/lib/fog/rackspace/requests/storage/delete_multiple_objects.rb +57 -0
- data/lib/fog/rackspace/requests/storage/delete_object.rb +14 -0
- data/lib/fog/rackspace/requests/storage/delete_static_large_object.rb +33 -0
- data/lib/fog/rackspace/requests/storage/extract_archive.rb +39 -0
- data/lib/fog/rackspace/requests/storage/get_container.rb +25 -0
- data/lib/fog/rackspace/requests/storage/get_containers.rb +17 -0
- data/lib/fog/rackspace/requests/storage/get_object.rb +26 -0
- data/lib/fog/rackspace/requests/storage/get_object_http_url.rb +9 -2
- data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +8 -1
- data/lib/fog/rackspace/requests/storage/head_container.rb +12 -0
- data/lib/fog/rackspace/requests/storage/head_containers.rb +19 -0
- data/lib/fog/rackspace/requests/storage/head_object.rb +26 -0
- data/lib/fog/rackspace/requests/storage/post_set_meta_temp_url_key.rb +10 -0
- data/lib/fog/rackspace/requests/storage/put_container.rb +16 -0
- data/lib/fog/rackspace/requests/storage/put_dynamic_obj_manifest.rb +23 -0
- data/lib/fog/rackspace/requests/storage/put_object.rb +39 -0
- data/lib/fog/rackspace/requests/storage/put_object_manifest.rb +9 -1
- data/lib/fog/rackspace/requests/storage/put_static_obj_manifest.rb +48 -0
- data/lib/fog/rackspace/storage.rb +320 -67
- data/lib/fog/rage4.rb +2 -0
- data/lib/fog/rage4/core.rb +11 -0
- data/lib/fog/rage4/dns.rb +74 -0
- data/lib/fog/rage4/models/dns/record.rb +77 -0
- data/lib/fog/rage4/models/dns/records.rb +42 -0
- data/lib/fog/rage4/models/dns/zone.rb +46 -0
- data/lib/fog/rage4/models/dns/zones.rb +34 -0
- data/lib/fog/rage4/requests/dns/create_domain.rb +33 -0
- data/lib/fog/rage4/requests/dns/create_domain_vanity.rb +34 -0
- data/lib/fog/rage4/requests/dns/create_record.rb +65 -0
- data/lib/fog/rage4/requests/dns/create_reverse_domain_4.rb +32 -0
- data/lib/fog/rage4/requests/dns/delete_domain.rb +28 -0
- data/lib/fog/rage4/requests/dns/delete_record.rb +28 -0
- data/lib/fog/rage4/requests/dns/get_domain.rb +30 -0
- data/lib/fog/rage4/requests/dns/get_domain_by_name.rb +30 -0
- data/lib/fog/rage4/requests/dns/list_domains.rb +41 -0
- data/lib/fog/rage4/requests/dns/list_geo_regions.rb +27 -0
- data/lib/fog/rage4/requests/dns/list_record_types.rb +26 -0
- data/lib/fog/rage4/requests/dns/list_records.rb +31 -0
- data/lib/fog/rage4/requests/dns/set_record_failover.rb +29 -0
- data/lib/fog/rage4/requests/dns/show_current_usage.rb +25 -0
- data/lib/fog/rage4/requests/dns/show_global_usage.rb +25 -0
- data/lib/fog/rage4/requests/dns/update_domain.rb +43 -0
- data/lib/fog/rage4/requests/dns/update_record.rb +64 -0
- data/lib/fog/riakcs.rb +2 -122
- data/lib/fog/riakcs/core.rb +122 -0
- data/lib/fog/riakcs/provisioning.rb +1 -1
- data/lib/fog/riakcs/usage.rb +1 -1
- data/lib/fog/serverlove.rb +1 -10
- data/lib/fog/serverlove/compute.rb +2 -0
- data/lib/fog/serverlove/core.rb +10 -0
- data/lib/fog/storm_on_demand.rb +9 -20
- data/lib/fog/storm_on_demand/account.rb +1 -1
- data/lib/fog/storm_on_demand/billing.rb +1 -1
- data/lib/fog/storm_on_demand/compute.rb +1 -1
- data/lib/fog/storm_on_demand/core.rb +20 -0
- data/lib/fog/storm_on_demand/dns.rb +1 -1
- data/lib/fog/storm_on_demand/monitoring.rb +1 -1
- data/lib/fog/storm_on_demand/network.rb +1 -1
- data/lib/fog/storm_on_demand/shared.rb +0 -1
- data/lib/fog/storm_on_demand/storage.rb +1 -1
- data/lib/fog/storm_on_demand/support.rb +1 -1
- data/lib/fog/storm_on_demand/vpn.rb +1 -1
- data/lib/fog/vcloud.rb +1 -11
- data/lib/fog/vcloud/compute.rb +1 -1
- data/lib/fog/vcloud/core.rb +11 -0
- data/lib/fog/vcloud_director.rb +1 -67
- data/lib/fog/vcloud_director/compute.rb +1 -1
- data/lib/fog/vcloud_director/core.rb +67 -0
- data/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb +1 -1
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vmfusion.rb +1 -11
- data/lib/fog/vmfusion/compute.rb +1 -1
- data/lib/fog/vmfusion/core.rb +11 -0
- data/lib/fog/vmfusion/models/compute/server.rb +5 -5
- data/lib/fog/voxel.rb +1 -16
- data/lib/fog/voxel/compute.rb +1 -1
- data/lib/fog/voxel/core.rb +16 -0
- data/lib/fog/vsphere.rb +1 -17
- data/lib/fog/vsphere/compute.rb +1 -0
- data/lib/fog/vsphere/core.rb +17 -0
- data/lib/fog/xenserver.rb +1 -83
- data/lib/fog/xenserver/compute.rb +1 -1
- data/lib/fog/xenserver/core.rb +83 -0
- data/lib/fog/xenserver/models/compute/storage_manager.rb +1 -1
- data/lib/fog/zerigo.rb +1 -11
- data/lib/fog/zerigo/core.rb +11 -0
- data/lib/fog/zerigo/dns.rb +1 -1
- data/lib/tasks/changelog_task.rb +2 -0
- data/tests/aws/models/compute/network_acl_tests.rb +109 -0
- data/tests/aws/models/compute/network_acls_tests.rb +7 -0
- data/tests/aws/models/elasticache/subnet_groups_tests.rb +44 -0
- data/tests/aws/requests/compute/network_acl_tests.rb +86 -0
- data/tests/aws/requests/compute/route_tests.rb +64 -3
- data/tests/aws/requests/compute/subnet_tests.rb +18 -11
- data/tests/aws/requests/elasticache/helper.rb +19 -0
- data/tests/aws/requests/elasticache/subnet_group_tests.rb +52 -0
- data/tests/aws/requests/iam/server_certificate_tests.rb +3 -0
- data/tests/aws/requests/rds/subnet_groups_tests.rb +1 -1
- data/tests/aws/requests/storage/multipart_upload_tests.rb +3 -14
- data/tests/brightbox/compute/schema.rb +118 -2
- data/tests/brightbox/helper.rb +1 -0
- data/tests/brightbox/models/compute/cloud_ip_tests.rb +32 -0
- data/tests/brightbox/models/compute/database_server_tests.rb +66 -0
- data/tests/brightbox/models/compute/database_snapshot_tests.rb +26 -0
- data/tests/brightbox/models/compute/database_type_tests.rb +27 -0
- data/tests/brightbox/requests/compute/database_server_tests.rb +54 -0
- data/tests/brightbox/requests/compute/database_snapsnot_tests.rb +47 -0
- data/tests/brightbox/requests/compute/database_type_tests.rb +17 -0
- data/tests/compute/models/server_tests.rb +20 -2
- data/tests/digitalocean/helper.rb +9 -4
- data/tests/digitalocean/models/compute/server_tests.rb +1 -0
- data/tests/digitalocean/models/compute/servers_tests.rb +19 -4
- data/tests/digitalocean/requests/compute/create_server_tests.rb +13 -6
- data/tests/digitalocean/requests/compute/list_servers_tests.rb +2 -1
- data/tests/dns/helper.rb +3 -0
- data/tests/dns/models/record_tests.rb +1 -1
- data/tests/dns/models/records_tests.rb +1 -1
- data/tests/dns/models/zone_tests.rb +1 -1
- data/tests/dns/models/zones_tests.rb +1 -1
- data/tests/google/helpers/disk_helper.rb +12 -0
- data/tests/google/models/compute/server_tests.rb +4 -1
- data/tests/google/models/compute/servers_tests.rb +4 -1
- data/tests/google/requests/compute/image_tests.rb +0 -1
- data/tests/google/requests/compute/server_tests.rb +2 -1
- data/tests/helper.rb +7 -1
- data/tests/helpers/compute/server_helper.rb +1 -0
- data/tests/helpers/compute/servers_helper.rb +1 -0
- data/tests/openstack/models/network/security_group_rule_tests.rb +27 -0
- data/tests/openstack/models/network/security_group_rules_tests.rb +25 -0
- data/tests/openstack/models/network/security_group_tests.rb +17 -0
- data/tests/openstack/models/network/security_groups_tests.rb +16 -0
- data/tests/openstack/requests/compute/helper.rb +5 -0
- data/tests/openstack/requests/compute/server_tests.rb +11 -0
- data/tests/openstack/requests/network/security_group_rule_tests.rb +58 -0
- data/tests/openstack/requests/network/security_group_tests.rb +43 -0
- data/tests/rackspace/identity_tests.rb +0 -4
- data/tests/rackspace/models/compute_v2/server_tests.rb +36 -8
- data/tests/rackspace/models/queues/claim_tests.rb +1 -3
- data/tests/rackspace/models/queues/claims_tests.rb +1 -3
- data/tests/rackspace/models/queues/message_tests.rb +1 -3
- data/tests/rackspace/models/queues/messages_tests.rb +1 -3
- data/tests/rackspace/models/queues/queue_tests.rb +1 -3
- data/tests/rackspace/models/queues/queues_tests.rb +1 -3
- data/tests/rackspace/models/storage/account_tests.rb +0 -2
- data/tests/rackspace/models/storage/directories_tests.rb +0 -3
- data/tests/rackspace/models/storage/directory_tests.rb +2 -5
- data/tests/rackspace/models/storage/file_tests.rb +49 -2
- data/tests/rackspace/models/storage/files_tests.rb +1 -4
- data/tests/rackspace/queues_tests.rb +0 -13
- data/tests/rackspace/requests/identity/token_tests.rb +1 -3
- data/tests/rackspace/requests/monitoring/agent_tests.rb +42 -0
- data/tests/rackspace/requests/queues/claim_tests.rb +1 -3
- data/tests/rackspace/requests/queues/messages_tests.rb +0 -6
- data/tests/rackspace/requests/queues/queues_tests.rb +0 -5
- data/tests/rackspace/requests/storage/account_tests.rb +0 -1
- data/tests/rackspace/requests/storage/container_tests.rb +7 -11
- data/tests/rackspace/requests/storage/large_object_tests.rb +33 -43
- data/tests/rackspace/requests/storage/object_tests.rb +2 -27
- data/tests/rackspace/storage_tests.rb +9 -15
- data/tests/rage4/requests/dns/dns_tests.rb +241 -0
- data/tests/vcloud/requests/compute/disk_configure_tests.rb +0 -8
- metadata +193 -38
- data/lib/fog/brightbox/requests/compute/destroy_user_collaboration.rb +0 -21
@@ -3,9 +3,7 @@ module Fog
|
|
3
3
|
class Google
|
4
4
|
|
5
5
|
class Mock
|
6
|
-
|
7
|
-
def insert_firewall(firewall_name, source_range, allowed,
|
8
|
-
network=@default_network)
|
6
|
+
def insert_firewall(firewall_name, source_range=[], allowed=[], network=@default_network, source_tags=[])
|
9
7
|
Fog::Mock.not_implemented
|
10
8
|
end
|
11
9
|
|
@@ -13,8 +11,7 @@ module Fog
|
|
13
11
|
|
14
12
|
class Real
|
15
13
|
|
16
|
-
def insert_firewall(firewall_name, source_range,
|
17
|
-
network=@default_network)
|
14
|
+
def insert_firewall(firewall_name, source_range=[], allowed=[], network=@default_network, source_tags=[])
|
18
15
|
api_method = @compute.firewalls.insert
|
19
16
|
parameters = {
|
20
17
|
'project' => @project,
|
@@ -22,12 +19,12 @@ module Fog
|
|
22
19
|
body_object = {
|
23
20
|
"name" => firewall_name,
|
24
21
|
"network" => "#{@api_url}#{@project}/global/networks/#{network}",
|
25
|
-
"
|
26
|
-
"allowed" => allowed
|
22
|
+
"allowed" => allowed,
|
27
23
|
}
|
24
|
+
body_object["sourceRanges"] = source_range if !source_range.empty?
|
25
|
+
body_object["sourceTags"] = source_tags if !source_tags.empty?
|
28
26
|
|
29
|
-
result = self.build_result(api_method, parameters,
|
30
|
-
body_object=body_object)
|
27
|
+
result = self.build_result(api_method, parameters, body_object=body_object)
|
31
28
|
response = self.build_response(result)
|
32
29
|
end
|
33
30
|
|
@@ -19,14 +19,10 @@ module Fog
|
|
19
19
|
'project' => @project,
|
20
20
|
}
|
21
21
|
|
22
|
-
kernel_url = @api_url + 'google/global/kernels/' + \
|
23
|
-
options.delete('preferredKernel').to_s
|
24
|
-
|
25
22
|
body_object = {
|
26
23
|
'sourceType' => 'RAW',
|
27
24
|
'name' => image_name,
|
28
|
-
'rawDisk' => options.delete('rawDisk')
|
29
|
-
'preferredKernel' => kernel_url,
|
25
|
+
'rawDisk' => options.delete('rawDisk')
|
30
26
|
}
|
31
27
|
|
32
28
|
# Merge in the remaining params (only 'description' should remain)
|
@@ -26,17 +26,13 @@ module Fog
|
|
26
26
|
|
27
27
|
def insert_server(server_name, zone_name, options={}, *deprecated_args)
|
28
28
|
|
29
|
-
# check that
|
30
|
-
image_project = nil
|
31
|
-
if options.has_key? 'image'
|
32
|
-
([ @project ] + Fog::Compute::Google::Images::GLOBAL_PROJECTS).each do |project|
|
33
|
-
image_project = project
|
34
|
-
break if data(project)[:images][options['image']]
|
35
|
-
end
|
36
|
-
get_image(options['image'], image_project) # ok if image exists, will fail otherwise
|
37
|
-
end
|
29
|
+
# check that zone exists
|
38
30
|
get_zone(zone_name)
|
39
31
|
|
32
|
+
if options['disks'].nil? or options['disks'].empty?
|
33
|
+
raise ArgumentError.new "Empty value for field 'disks'. Boot disk must be specified"
|
34
|
+
end
|
35
|
+
|
40
36
|
id = Fog::Mock.random_numbers(19).to_s
|
41
37
|
self.data[:servers][server_name] = {
|
42
38
|
"kind" => "compute#instance",
|
@@ -47,8 +43,6 @@ module Fog
|
|
47
43
|
"name" => server_name,
|
48
44
|
"tags" => { "fingerprint" => "42WmSpB8rSM=" },
|
49
45
|
"machineType" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/machineTypes/#{options['machineType']}",
|
50
|
-
"image" => "https://www.googleapis.com/compute/#{api_version}/projects/#{image_project}/global/images/#{options['image']}",
|
51
|
-
"kernel" => "https://www.googleapis.com/compute/#{api_version}/projects/google/global/kernels/gce-v20130813",
|
52
46
|
"canIpForward" => false,
|
53
47
|
"networkInterfaces" => [
|
54
48
|
{
|
@@ -65,14 +59,7 @@ module Fog
|
|
65
59
|
]
|
66
60
|
}
|
67
61
|
],
|
68
|
-
"disks" =>
|
69
|
-
{
|
70
|
-
"kind" => "compute#attachedDisk",
|
71
|
-
"index" => 0,
|
72
|
-
"type" => "SCRATCH",
|
73
|
-
"mode" => "READ_WRITE"
|
74
|
-
}
|
75
|
-
],
|
62
|
+
"disks" => handle_disks(options, zone_name),
|
76
63
|
"metadata" => {
|
77
64
|
"kind" => "compute#metadata",
|
78
65
|
"fingerprint" => "5_hasd_gC3E=",
|
@@ -113,6 +100,8 @@ module Fog
|
|
113
100
|
|
114
101
|
def handle_disks(options)
|
115
102
|
disks = []
|
103
|
+
# An array of persistent disks. You must supply a boot disk as the first disk in
|
104
|
+
# this array and mark it as a boot disk using the disks[].boot property.
|
116
105
|
options.delete('disks').each do |disk|
|
117
106
|
if disk.is_a? Disk
|
118
107
|
disks << disk.get_object
|
@@ -120,6 +109,7 @@ module Fog
|
|
120
109
|
disks << disk
|
121
110
|
end
|
122
111
|
end
|
112
|
+
disks.first['boot'] = true
|
123
113
|
disks
|
124
114
|
end
|
125
115
|
|
@@ -139,12 +129,6 @@ module Fog
|
|
139
129
|
}
|
140
130
|
body_object = {:name => server_name}
|
141
131
|
|
142
|
-
if options.has_key? 'image'
|
143
|
-
image_name = options.delete 'image'
|
144
|
-
image = images.get(image_name)
|
145
|
-
@image_url = @api_url + image.resource_url
|
146
|
-
body_object['image'] = @image_url
|
147
|
-
end
|
148
132
|
body_object['machineType'] = @api_url + @project + "/zones/#{zone_name}/machineTypes/#{options.delete 'machineType'}"
|
149
133
|
network = nil
|
150
134
|
if options.has_key? 'network'
|
@@ -170,15 +154,15 @@ module Fog
|
|
170
154
|
# TODO: add other networks
|
171
155
|
body_object['networkInterfaces'] = networkInterfaces
|
172
156
|
|
173
|
-
|
157
|
+
if options['disks'].nil? or options['disks'].empty?
|
158
|
+
raise ArgumentError.new "Empty value for field 'disks'. Boot disk must be specified"
|
159
|
+
end
|
160
|
+
body_object['disks'] = handle_disks(options)
|
174
161
|
|
175
162
|
options['metadata'] = format_metadata options['metadata'] if options['metadata']
|
176
163
|
|
177
164
|
body_object['tags'] = { 'items' => options.delete('tags') } if options['tags']
|
178
165
|
|
179
|
-
if options['kernel']
|
180
|
-
body_object['kernel'] = @api_url + "google/global/kernels/#{options.delete 'kernel'}"
|
181
|
-
end
|
182
166
|
body_object.merge!(options) # Adds in all remaining options that weren't explicitly handled.
|
183
167
|
|
184
168
|
result = self.build_result(api_method, parameters,
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
|
5
|
+
class Mock
|
6
|
+
|
7
|
+
def list_addresses(region_name)
|
8
|
+
Fog::Mock.not_implemented
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
class Real
|
14
|
+
|
15
|
+
def list_addresses(region_name)
|
16
|
+
api_method = @compute.addresses.list
|
17
|
+
parameters = {
|
18
|
+
'project' => @project,
|
19
|
+
'region' => region_name
|
20
|
+
}
|
21
|
+
|
22
|
+
result = self.build_result(api_method, parameters)
|
23
|
+
response = self.build_response(result)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -13,11 +13,11 @@ module Fog
|
|
13
13
|
class Real
|
14
14
|
|
15
15
|
def set_metadata(instance, zone, metadata={})
|
16
|
-
api_method = @compute.
|
16
|
+
api_method = @compute.instances.set_metadata
|
17
17
|
parameters = {
|
18
18
|
'project' => @project,
|
19
19
|
'instance' => instance,
|
20
|
-
'zone' => zone
|
20
|
+
'zone' => zone
|
21
21
|
}
|
22
22
|
body_object = {
|
23
23
|
"items" => metadata.to_a.map {|pair| { :key => pair[0], :value => pair[1] } }
|
@@ -25,12 +25,11 @@ module Fog
|
|
25
25
|
result = self.build_result(
|
26
26
|
api_method,
|
27
27
|
parameters,
|
28
|
-
body_object=body_object
|
28
|
+
body_object=body_object
|
29
|
+
)
|
29
30
|
response = self.build_response(result)
|
30
31
|
end
|
31
|
-
|
32
32
|
end
|
33
|
-
|
34
33
|
end
|
35
34
|
end
|
36
35
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
|
5
|
+
class Mock
|
6
|
+
|
7
|
+
def set_tags(instance, zone, tags=[])
|
8
|
+
Fog::Mock.not_implemented
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
class Real
|
14
|
+
|
15
|
+
def set_tags(instance, zone, tags=[])
|
16
|
+
api_method = @compute.instances.set_tags
|
17
|
+
parameters = {
|
18
|
+
'project' => @project,
|
19
|
+
'instance' => instance,
|
20
|
+
'zone' => zone
|
21
|
+
}
|
22
|
+
body_object = { "items" => tags }
|
23
|
+
result = self.build_result(
|
24
|
+
api_method,
|
25
|
+
parameters,
|
26
|
+
body_object=body_object
|
27
|
+
)
|
28
|
+
response = self.build_response(result)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,60 +1,27 @@
|
|
1
1
|
module Fog
|
2
2
|
module Storage
|
3
3
|
class Google
|
4
|
+
|
5
|
+
class Mock
|
6
|
+
def put_bucket_acl(bucket_name, acl)
|
7
|
+
Fog::Mock.not_implemented
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
4
11
|
class Real
|
5
12
|
|
6
13
|
# Change access control list for an Google Storage bucket
|
7
|
-
#
|
8
|
-
# ==== Parameters
|
9
|
-
# * bucket_name<~String> - name of bucket to modify
|
10
|
-
# * acl<~Hash>:
|
11
|
-
# * Owner<~Hash>:
|
12
|
-
# * ID<~String>: id of owner
|
13
|
-
# * DisplayName<~String>: display name of owner
|
14
|
-
# * AccessControlList<~Array>:
|
15
|
-
# * scope<~Hash>:
|
16
|
-
# * 'type'<~String> - 'UserById'
|
17
|
-
# * 'ID'<~String> - Id of grantee
|
18
|
-
# or
|
19
|
-
# * 'type'<~String> - 'UserByEmail'
|
20
|
-
# * 'EmailAddress'<~String> - Email address of grantee
|
21
|
-
# or
|
22
|
-
# * 'type'<~String> - type of user to grant permission to
|
23
|
-
# * Permission<~String> - Permission, in [FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP]
|
24
14
|
def put_bucket_acl(bucket_name, acl)
|
25
|
-
|
26
|
-
<<-DATA
|
27
|
-
<
|
15
|
+
|
16
|
+
data = <<-DATA
|
17
|
+
<AccessControlList>
|
28
18
|
<Owner>
|
29
|
-
|
30
|
-
<DisplayName>#{acl['Owner']['DisplayName']}</DisplayName>
|
19
|
+
#{tag('ID', acl['Owner']['ID'])}
|
31
20
|
</Owner>
|
32
|
-
<
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
data << " <Grant>"
|
37
|
-
type = case grant['Grantee'].keys.sort
|
38
|
-
when ['DisplayName', 'ID']
|
39
|
-
'CanonicalUser'
|
40
|
-
when ['EmailAddress']
|
41
|
-
'AmazonCustomerByEmail'
|
42
|
-
when ['URI']
|
43
|
-
'Group'
|
44
|
-
end
|
45
|
-
data << " <Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"#{type}\">"
|
46
|
-
for key, value in grant['Grantee']
|
47
|
-
data << " <#{key}>#{value}</#{key}>"
|
48
|
-
end
|
49
|
-
data << " </Grantee>"
|
50
|
-
data << " <Permission>#{grant['Permission']}</Permission>"
|
51
|
-
data << " </Grant>"
|
52
|
-
end
|
53
|
-
|
54
|
-
data <<
|
55
|
-
<<-DATA
|
56
|
-
</AccessControlList>
|
57
|
-
</AccessControlPolicy>
|
21
|
+
<Entries>
|
22
|
+
#{entries_list(acl['AccessControlList'])}
|
23
|
+
</Entries>
|
24
|
+
</AccessControlList>
|
58
25
|
DATA
|
59
26
|
|
60
27
|
request({
|
@@ -67,7 +34,31 @@ DATA
|
|
67
34
|
})
|
68
35
|
end
|
69
36
|
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def tag(name, value)
|
41
|
+
"<#{name}>#{value}</#{name}>"
|
42
|
+
end
|
43
|
+
|
44
|
+
def scope_tag(scope)
|
45
|
+
if %w(AllUsers AllAuthenticatedUsers).include?(scope['type'])
|
46
|
+
"<Scope type='#{scope['type']}'/>"
|
47
|
+
else
|
48
|
+
"<Scope type='#{scope['type']}'>" +
|
49
|
+
scope.to_a.select { |pair| pair[0] != 'type' }.map { |pair| tag(pair[0], pair[1]) }.join("\n") +
|
50
|
+
"</Scope>"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def entries_list(access_control_list)
|
55
|
+
access_control_list.map do |entry|
|
56
|
+
tag('Entry', scope_tag(entry['Scope']) + tag('Permission', entry['Permission']))
|
57
|
+
end.join("\n")
|
58
|
+
end
|
59
|
+
|
70
60
|
end
|
61
|
+
|
71
62
|
end
|
72
63
|
end
|
73
64
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class Google
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# TODO: move this methods to helper to use them with put_bucket_acl request
|
7
|
+
def tag(name, value)
|
8
|
+
"<#{name}>#{value}</#{name}>"
|
9
|
+
end
|
10
|
+
|
11
|
+
def scope_tag(scope)
|
12
|
+
if %w(AllUsers AllAuthenticatedUsers).include?(scope['type'])
|
13
|
+
"<Scope type='#{scope['type']}'/>"
|
14
|
+
else
|
15
|
+
"<Scope type='#{scope['type']}'>" +
|
16
|
+
scope.to_a.select {|pair| pair[0] != 'type'}.map { |pair| tag(pair[0], pair[1]) }.join("\n") +
|
17
|
+
"</Scope>"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def entries_list(access_control_list)
|
22
|
+
access_control_list.map do |entry|
|
23
|
+
tag('Entry', scope_tag(entry['Scope']) + tag('Permission', entry['Permission']))
|
24
|
+
end.join("\n")
|
25
|
+
end
|
26
|
+
|
27
|
+
def put_object_acl(bucket_name, object_name, acl)
|
28
|
+
|
29
|
+
data = <<-DATA
|
30
|
+
<AccessControlList>
|
31
|
+
<Owner>
|
32
|
+
#{tag('ID', acl['Owner']['ID'])}
|
33
|
+
</Owner>
|
34
|
+
<Entries>
|
35
|
+
#{entries_list(acl['AccessControlList'])}
|
36
|
+
</Entries>
|
37
|
+
</AccessControlList>
|
38
|
+
DATA
|
39
|
+
|
40
|
+
request({
|
41
|
+
:body => data,
|
42
|
+
:expects => 200,
|
43
|
+
:headers => {},
|
44
|
+
:host => "#{bucket_name}.#{@host}",
|
45
|
+
:method => 'PUT',
|
46
|
+
:query => {'acl' => nil},
|
47
|
+
:path => CGI.escape(object_name)
|
48
|
+
})
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/fog/google/storage.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/google'
|
1
|
+
require 'fog/google/core'
|
2
2
|
require 'fog/storage'
|
3
3
|
|
4
4
|
module Fog
|
@@ -31,6 +31,7 @@ module Fog
|
|
31
31
|
request :put_bucket
|
32
32
|
request :put_bucket_acl
|
33
33
|
request :put_object
|
34
|
+
request :put_object_acl
|
34
35
|
request :put_object_url
|
35
36
|
|
36
37
|
module Utils
|
data/lib/fog/hp.rb
CHANGED
@@ -1,352 +1,9 @@
|
|
1
|
-
require 'fog/
|
2
|
-
require 'fog/hp/
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
extend Fog::Provider
|
13
|
-
|
14
|
-
module Errors
|
15
|
-
class ServiceError < Fog::Errors::Error
|
16
|
-
attr_reader :response_data
|
17
|
-
|
18
|
-
def self.slurp(error)
|
19
|
-
if error.response.body.empty?
|
20
|
-
data = nil
|
21
|
-
message = nil
|
22
|
-
else
|
23
|
-
begin
|
24
|
-
data = Fog::JSON.decode(error.response.body)
|
25
|
-
message = data['message']
|
26
|
-
if message.nil? and !data.values.first.nil?
|
27
|
-
message = data.values.first['message']
|
28
|
-
end
|
29
|
-
rescue Fog::JSON::DecodeError
|
30
|
-
message = error.response.body #### body is not in JSON format, so just return as is
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
new_error = super(error, message)
|
35
|
-
new_error.instance_variable_set(:@response_data, data)
|
36
|
-
new_error
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
class InternalServerError < ServiceError; end
|
41
|
-
class Conflict < ServiceError; end
|
42
|
-
class NotFound < ServiceError; end
|
43
|
-
class Forbidden < ServiceError; end
|
44
|
-
class ServiceUnavailable < ServiceError; end
|
45
|
-
|
46
|
-
class BadRequest < ServiceError
|
47
|
-
attr_reader :validation_errors
|
48
|
-
|
49
|
-
def self.slurp(error)
|
50
|
-
new_error = super(error)
|
51
|
-
unless new_error.response_data.nil? or new_error.response_data['badRequest'].nil?
|
52
|
-
new_error.instance_variable_set(:@validation_errors, new_error.response_data['badRequest']['validationErrors'])
|
53
|
-
end
|
54
|
-
new_error
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
service(:block_storage, 'hp/block_storage', 'BlockStorage')
|
60
|
-
service(:block_storage_v2, 'hp/block_storage_v2', 'BlockStorageV2')
|
61
|
-
service(:cdn, 'hp/cdn', 'CDN')
|
62
|
-
service(:compute, 'hp/compute', 'Compute')
|
63
|
-
service(:dns, 'hp/dns', 'DNS')
|
64
|
-
service(:lb, 'hp/lb', 'LB')
|
65
|
-
service(:network, 'hp/network', 'Network')
|
66
|
-
service(:storage, 'hp/storage', 'Storage')
|
67
|
-
|
68
|
-
# legacy swauth 1.0/1.1 style authentication
|
69
|
-
def self.authenticate_v1(options, connection_options = {})
|
70
|
-
hp_auth_uri = options[:hp_auth_uri] || "https://region-a.geo-1.objects.hpcloudsvc.com/auth/v1.0/"
|
71
|
-
endpoint = URI.parse(hp_auth_uri)
|
72
|
-
@scheme = endpoint.scheme || "http"
|
73
|
-
@host = endpoint.host || "region-a.geo-1.objects.hpcloudsvc.com"
|
74
|
-
@port = endpoint.port.to_s || "80"
|
75
|
-
if (endpoint.path)
|
76
|
-
@auth_path = endpoint.path.slice(1, endpoint.path.length) # remove the leading slash
|
77
|
-
else
|
78
|
-
@auth_path = "auth/v1.0"
|
79
|
-
end
|
80
|
-
service_url = "#{@scheme}://#{@host}:#{@port}"
|
81
|
-
# Set the User-Agent
|
82
|
-
@user_agent = options[:user_agent]
|
83
|
-
set_user_agent_header(connection_options, "fog/#{Fog::VERSION}", @user_agent)
|
84
|
-
connection = Fog::Connection.new(service_url, false, connection_options)
|
85
|
-
@hp_access_key = options[:hp_access_key]
|
86
|
-
@hp_secret_key = options[:hp_secret_key]
|
87
|
-
response = connection.request({
|
88
|
-
:expects => [200, 204],
|
89
|
-
:headers => {
|
90
|
-
'X-Auth-Key' => @hp_secret_key,
|
91
|
-
'X-Auth-User' => @hp_access_key
|
92
|
-
},
|
93
|
-
:method => 'GET',
|
94
|
-
:path => @auth_path
|
95
|
-
})
|
96
|
-
response.headers.reject do |key, value|
|
97
|
-
!['X-Server-Management-Url', 'X-Storage-Url', 'X-CDN-Management-Url', 'X-Auth-Token'].include?(key)
|
98
|
-
end
|
99
|
-
|
100
|
-
return {
|
101
|
-
:auth_token => response.headers['X-Auth-Token'],
|
102
|
-
:endpoint_url => nil,
|
103
|
-
:cdn_endpoint_url => response.headers['X-Storage-Url']
|
104
|
-
}
|
105
|
-
end
|
106
|
-
|
107
|
-
def self.service_catalog(options, connection_options = {})
|
108
|
-
creds = authenticate_v2(options, connection_options)
|
109
|
-
return {} if creds.nil?
|
110
|
-
return {} if creds[:service_catalog].nil?
|
111
|
-
return creds[:service_catalog]
|
112
|
-
end
|
113
|
-
|
114
|
-
# keystone based control services style authentication
|
115
|
-
def self.authenticate_v2(options, connection_options = {})
|
116
|
-
unless options[:credentials].nil?
|
117
|
-
expires = true
|
118
|
-
begin
|
119
|
-
expire = DateTime.parse(options[:credentials][:expires])
|
120
|
-
expires = false if expire > DateTime.now
|
121
|
-
rescue
|
122
|
-
end
|
123
|
-
if expires
|
124
|
-
options = options.clone
|
125
|
-
options.delete(:credentials)
|
126
|
-
else
|
127
|
-
service_catalog = options[:credentials][:service_catalog]
|
128
|
-
type = options[:hp_service_type]
|
129
|
-
zone = options[:hp_avl_zone]
|
130
|
-
begin
|
131
|
-
creds = options[:credentials].clone
|
132
|
-
creds[:endpoint_url] = get_endpoint_url(service_catalog, type, zone)
|
133
|
-
begin
|
134
|
-
creds[:cdn_endpoint_url] = get_endpoint_url(service_catalog, "CDN", zone)
|
135
|
-
rescue
|
136
|
-
end
|
137
|
-
return creds
|
138
|
-
rescue
|
139
|
-
end
|
140
|
-
options = options.clone
|
141
|
-
options.delete(:credentials)
|
142
|
-
end
|
143
|
-
end
|
144
|
-
hp_auth_uri = options[:hp_auth_uri] || "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens"
|
145
|
-
# append /tokens if missing from auth uri
|
146
|
-
@hp_auth_uri = hp_auth_uri.include?('tokens')? hp_auth_uri : hp_auth_uri + "tokens"
|
147
|
-
endpoint = URI.parse(@hp_auth_uri)
|
148
|
-
@scheme = endpoint.scheme || "https"
|
149
|
-
@host = endpoint.host || "region-a.geo-1.identity.hpcloudsvc.com"
|
150
|
-
@port = endpoint.port.to_s || "35357"
|
151
|
-
if (endpoint.path)
|
152
|
-
@auth_path = endpoint.path.slice(1, endpoint.path.length) # remove the leading slash
|
153
|
-
else
|
154
|
-
@auth_path = "v2.0/tokens"
|
155
|
-
end
|
156
|
-
service_url = "#{@scheme}://#{@host}:#{@port}"
|
157
|
-
# Set the User-Agent. If the caller sets a user_agent, use it.
|
158
|
-
@user_agent = options[:user_agent]
|
159
|
-
set_user_agent_header(connection_options, "fog/#{Fog::VERSION}", @user_agent)
|
160
|
-
connection = Fog::Connection.new(service_url, false, connection_options)
|
161
|
-
|
162
|
-
### Implement HP Control Services Authentication services ###
|
163
|
-
# Get the style of auth credentials passed, defaults to access/secret key style
|
164
|
-
@hp_use_upass_auth_style = options[:hp_use_upass_auth_style] || false
|
165
|
-
@hp_access_key = options[:hp_access_key]
|
166
|
-
@hp_secret_key = options[:hp_secret_key]
|
167
|
-
@hp_tenant_id = options[:hp_tenant_id]
|
168
|
-
@hp_service_type = options[:hp_service_type]
|
169
|
-
@hp_avl_zone = options[:hp_avl_zone]
|
170
|
-
|
171
|
-
### Decide which auth style to use
|
172
|
-
unless (@hp_use_upass_auth_style)
|
173
|
-
# If Access Key style credentials are provided, use that
|
174
|
-
request_body = {
|
175
|
-
'auth' => {
|
176
|
-
'apiAccessKeyCredentials' => {
|
177
|
-
'accessKey' => "#{@hp_access_key}",
|
178
|
-
'secretKey' => "#{@hp_secret_key}"
|
179
|
-
}
|
180
|
-
}
|
181
|
-
}
|
182
|
-
else
|
183
|
-
# Otherwise use the Username/Password style
|
184
|
-
request_body = {
|
185
|
-
'auth' => {
|
186
|
-
'passwordCredentials' => {
|
187
|
-
'username' => "#{@hp_access_key}",
|
188
|
-
'password' => "#{@hp_secret_key}"
|
189
|
-
}
|
190
|
-
}
|
191
|
-
}
|
192
|
-
end
|
193
|
-
# add tenant_id if specified
|
194
|
-
request_body['auth']['tenantId'] = @hp_tenant_id if @hp_tenant_id
|
195
|
-
|
196
|
-
### Make the call to CS to get auth token and service catalog
|
197
|
-
response = connection.request(
|
198
|
-
{
|
199
|
-
:expects => 200,
|
200
|
-
:headers => {
|
201
|
-
'Content-Type' => 'application/json'
|
202
|
-
},
|
203
|
-
:method => 'POST',
|
204
|
-
:body => Fog::JSON.encode(request_body),
|
205
|
-
:path => @auth_path
|
206
|
-
}
|
207
|
-
)
|
208
|
-
|
209
|
-
body = Fog::JSON.decode(response.body)
|
210
|
-
|
211
|
-
### fish out auth_token and endpoint for the service
|
212
|
-
auth_token = body['access']['token']['id']
|
213
|
-
expires = body['access']['token']['expires']
|
214
|
-
service_catalog = get_service_catalog(body['access']['serviceCatalog'])
|
215
|
-
endpoint_url = get_endpoint_url(service_catalog, @hp_service_type, @hp_avl_zone)
|
216
|
-
begin
|
217
|
-
cdn_endpoint_url = get_endpoint_url(service_catalog, "CDN", @hp_avl_zone)
|
218
|
-
rescue
|
219
|
-
end
|
220
|
-
|
221
|
-
creds = {
|
222
|
-
:auth_token => auth_token,
|
223
|
-
:expires => expires,
|
224
|
-
:service_catalog => service_catalog,
|
225
|
-
:endpoint_url => endpoint_url,
|
226
|
-
:cdn_endpoint_url => cdn_endpoint_url
|
227
|
-
}
|
228
|
-
return creds
|
229
|
-
end
|
230
|
-
|
231
|
-
# CGI.escape, but without special treatment on spaces
|
232
|
-
def self.escape(str,extra_exclude_chars = '')
|
233
|
-
str.gsub(/([^a-zA-Z0-9_.-#{extra_exclude_chars}]+)/) do
|
234
|
-
'%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
# converts any attributes hash from aliased keys to original attribute keys
|
239
|
-
def self.convert_aliased_attributes_to_original(model, attributes)
|
240
|
-
original_attributes = {}
|
241
|
-
attributes.each do |k, v|
|
242
|
-
if orig_key = model.aliases.invert[k]
|
243
|
-
original_attributes[orig_key] = v
|
244
|
-
else
|
245
|
-
original_attributes[k] = v
|
246
|
-
end
|
247
|
-
end
|
248
|
-
original_attributes
|
249
|
-
end
|
250
|
-
|
251
|
-
private
|
252
|
-
|
253
|
-
def self.get_service_catalog(body)
|
254
|
-
raise "Unable to parse service catalog." unless body
|
255
|
-
service_catalog = {}
|
256
|
-
body.each do |s|
|
257
|
-
name = s["name"]
|
258
|
-
next if name.nil?
|
259
|
-
name = name.to_sym
|
260
|
-
next if s['endpoints'].nil?
|
261
|
-
service_catalog[name] = {}
|
262
|
-
s['endpoints'].each do |ep|
|
263
|
-
next if ep['region'].nil?
|
264
|
-
next if ep['publicURL'].nil?
|
265
|
-
next if ep['publicURL'].empty?
|
266
|
-
service_catalog[name][ep['region'].to_sym] = ep['publicURL']
|
267
|
-
end
|
268
|
-
end
|
269
|
-
return service_catalog
|
270
|
-
end
|
271
|
-
|
272
|
-
def self.get_endpoint_url(service_catalog, service_type, avl_zone)
|
273
|
-
return nil if service_type.nil?
|
274
|
-
service_type = service_type.to_sym
|
275
|
-
avl_zone = avl_zone.to_sym
|
276
|
-
unless service_catalog[service_type].nil?
|
277
|
-
unless service_catalog[service_type][avl_zone].nil?
|
278
|
-
return service_catalog[service_type][avl_zone]
|
279
|
-
end
|
280
|
-
end
|
281
|
-
raise "Unable to retrieve endpoint service url for availability zone '#{avl_zone}' from service catalog. "
|
282
|
-
end
|
283
|
-
|
284
|
-
def self.set_user_agent_header(conn_opts, base_str, client_str)
|
285
|
-
if client_str
|
286
|
-
user_agent = {'User-Agent' => base_str + " (#{client_str})"}
|
287
|
-
else
|
288
|
-
user_agent = {'User-Agent' => base_str}
|
289
|
-
end
|
290
|
-
if conn_opts[:headers]
|
291
|
-
conn_opts[:headers] = user_agent.merge!(conn_opts[:headers])
|
292
|
-
else
|
293
|
-
conn_opts[:headers] = user_agent
|
294
|
-
end
|
295
|
-
end
|
296
|
-
|
297
|
-
class Mock
|
298
|
-
def self.etag
|
299
|
-
Fog::Mock.random_hex(32)
|
300
|
-
end
|
301
|
-
|
302
|
-
def self.key_fingerprint
|
303
|
-
fingerprint = []
|
304
|
-
20.times do
|
305
|
-
fingerprint << Fog::Mock.random_hex(2)
|
306
|
-
end
|
307
|
-
fingerprint.join(':')
|
308
|
-
end
|
309
|
-
|
310
|
-
def self.key_material
|
311
|
-
private_key = OpenSSL::PKey::RSA.generate(1024)
|
312
|
-
public_key = private_key.public_key
|
313
|
-
return private_key.to_s, public_key.to_s
|
314
|
-
end
|
315
|
-
|
316
|
-
def self.user_id
|
317
|
-
"dev_" + Fog::Mock.random_numbers(14)
|
318
|
-
end
|
319
|
-
|
320
|
-
def self.instance_id
|
321
|
-
Fog::Mock.random_numbers(6)
|
322
|
-
end
|
323
|
-
|
324
|
-
def self.ip_address
|
325
|
-
ip = []
|
326
|
-
4.times do
|
327
|
-
ip << Fog::Mock.random_numbers(rand(3) + 1).to_i.to_s # remove leading 0
|
328
|
-
end
|
329
|
-
ip.join('.')
|
330
|
-
end
|
331
|
-
|
332
|
-
def self.uuid
|
333
|
-
# pattern of 8-4-4-4-12 hexadecimal digits
|
334
|
-
uuid = []
|
335
|
-
[8,4,4,4,12].each do |x|
|
336
|
-
uuid << Fog::Mock.random_hex(x)
|
337
|
-
end
|
338
|
-
uuid.join('-')
|
339
|
-
end
|
340
|
-
|
341
|
-
def self.mac_address
|
342
|
-
mac_add = []
|
343
|
-
6.times do
|
344
|
-
mac_add << Fog::Mock.random_hex(2)
|
345
|
-
end
|
346
|
-
mac_add.join(':')
|
347
|
-
end
|
348
|
-
|
349
|
-
end
|
350
|
-
|
351
|
-
end
|
352
|
-
end
|
1
|
+
require 'fog/hp/block_storage'
|
2
|
+
require 'fog/hp/block_storage_v2'
|
3
|
+
require 'fog/hp/cdn'
|
4
|
+
require 'fog/hp/compute'
|
5
|
+
require 'fog/hp/compute_v2'
|
6
|
+
require 'fog/hp/dns'
|
7
|
+
require 'fog/hp/lb'
|
8
|
+
require 'fog/hp/network'
|
9
|
+
require 'fog/hp/storage'
|