fog 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +1 -1
- data/.irbrc +5 -10
- data/{README.rdoc → README.md} +66 -61
- data/Rakefile +4 -6
- data/changelog.txt +491 -0
- data/docs/about/users.markdown +1 -0
- data/fog.gemspec +4 -4
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +4 -0
- data/lib/fog/aws/auto_scaling.rb +3 -0
- data/lib/fog/aws/cloud_watch.rb +28 -0
- data/lib/fog/aws/compute.rb +7 -1
- data/lib/fog/aws/elasticache.rb +64 -6
- data/lib/fog/aws/models/auto_scaling/configuration.rb +3 -1
- data/lib/fog/aws/models/auto_scaling/group.rb +10 -9
- data/lib/fog/aws/models/auto_scaling/policies.rb +33 -0
- data/lib/fog/aws/models/auto_scaling/policy.rb +46 -0
- data/lib/fog/aws/models/cloud_watch/alarm.rb +50 -2
- data/lib/fog/aws/models/cloud_watch/alarms.rb +18 -1
- data/lib/fog/aws/models/compute/address.rb +2 -2
- data/lib/fog/aws/models/dns/records.rb +5 -0
- data/lib/fog/aws/models/elasticache/cluster.rb +1 -1
- data/lib/fog/aws/models/iam/users.rb +26 -4
- data/lib/fog/aws/parsers/auto_scaling/describe_policies.rb +7 -5
- data/lib/fog/aws/parsers/elb/describe_load_balancers.rb +1 -1
- data/lib/fog/aws/rds.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +8 -0
- data/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +1 -2
- data/lib/fog/aws/requests/auto_scaling/delete_auto_scaling_group.rb +10 -2
- data/lib/fog/aws/requests/auto_scaling/delete_launch_configuration.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/delete_policy.rb +10 -1
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_instances.rb +0 -1
- data/lib/fog/aws/requests/auto_scaling/describe_policies.rb +13 -1
- data/lib/fog/aws/requests/auto_scaling/put_scaling_policy.rb +20 -1
- data/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb +1 -1
- data/lib/fog/aws/requests/cloud_watch/delete_alarms.rb +19 -1
- data/lib/fog/aws/requests/cloud_watch/describe_alarms.rb +20 -2
- data/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb +9 -0
- data/lib/fog/aws/requests/compute/allocate_address.rb +4 -5
- data/lib/fog/aws/requests/compute/create_dhcp_options.rb +6 -5
- data/lib/fog/aws/requests/compute/create_internet_gateway.rb +7 -6
- data/lib/fog/aws/requests/compute/create_subnet.rb +11 -10
- data/lib/fog/aws/requests/compute/create_vpc.rb +8 -7
- data/lib/fog/aws/requests/compute/delete_dhcp_options.rb +1 -0
- data/lib/fog/aws/requests/compute/delete_internet_gateway.rb +1 -0
- data/lib/fog/aws/requests/compute/delete_subnet.rb +1 -0
- data/lib/fog/aws/requests/compute/delete_vpc.rb +2 -1
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +1 -0
- data/lib/fog/aws/requests/compute/describe_dhcp_options.rb +1 -8
- data/lib/fog/aws/requests/compute/describe_instances.rb +3 -1
- data/lib/fog/aws/requests/compute/describe_internet_gateways.rb +1 -8
- data/lib/fog/aws/requests/compute/describe_subnets.rb +1 -9
- data/lib/fog/aws/requests/compute/describe_vpcs.rb +1 -8
- data/lib/fog/aws/requests/compute/release_address.rb +12 -4
- data/lib/fog/aws/requests/compute/start_instances.rb +1 -0
- data/lib/fog/aws/requests/compute/stop_instances.rb +1 -0
- data/lib/fog/aws/requests/elasticache/create_cache_cluster.rb +26 -2
- data/lib/fog/aws/requests/elasticache/delete_cache_cluster.rb +10 -1
- data/lib/fog/aws/requests/elasticache/describe_cache_clusters.rb +16 -1
- data/lib/fog/aws/requests/elasticache/modify_cache_cluster.rb +35 -3
- data/lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb +10 -2
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +1 -1
- data/lib/fog/aws/requests/rds/describe_db_instances.rb +3 -3
- data/lib/fog/aws/sqs.rb +1 -1
- data/lib/fog/aws/storage.rb +1 -1
- data/lib/fog/bin/rackspace.rb +4 -0
- data/lib/fog/cloudstack/compute.rb +25 -18
- data/lib/fog/cloudstack/models/compute/image.rb +34 -34
- data/lib/fog/cloudstack/models/compute/job.rb +14 -1
- data/lib/fog/cloudstack/models/compute/jobs.rb +1 -1
- data/lib/fog/cloudstack/models/compute/security_group.rb +50 -0
- data/lib/fog/cloudstack/models/compute/security_group_rule.rb +62 -0
- data/lib/fog/cloudstack/models/compute/security_group_rules.rb +37 -0
- data/lib/fog/cloudstack/models/compute/security_groups.rb +27 -0
- data/lib/fog/cloudstack/models/compute/server.rb +63 -39
- data/lib/fog/cloudstack/models/compute/volume.rb +3 -7
- data/lib/fog/cloudstack/models/compute/zone.rb +1 -2
- data/lib/fog/cloudstack/requests/compute/assign_virtual_machine.rb +18 -0
- data/lib/fog/cloudstack/requests/compute/authorize_security_group_egress.rb +68 -0
- data/lib/fog/cloudstack/requests/compute/authorize_security_group_ingress.rb +55 -4
- data/lib/fog/cloudstack/requests/compute/create_security_group.rb +12 -4
- data/lib/fog/cloudstack/requests/compute/create_zone.rb +20 -0
- data/lib/fog/cloudstack/requests/compute/delete_security_group.rb +17 -0
- data/lib/fog/cloudstack/requests/compute/destroy_virtual_machine.rb +23 -1
- data/lib/fog/cloudstack/requests/compute/list_firewall_rules.rb +15 -0
- data/lib/fog/cloudstack/requests/compute/list_security_groups.rb +22 -4
- data/lib/fog/cloudstack/requests/compute/query_async_job_result.rb +15 -3
- data/lib/fog/cloudstack/requests/compute/revoke_security_group_egress.rb +42 -0
- data/lib/fog/cloudstack/requests/compute/revoke_security_group_ingress.rb +29 -3
- data/lib/fog/core.rb +1 -0
- data/lib/fog/core/attributes.rb +1 -1
- data/lib/fog/core/current_machine.rb +2 -2
- data/lib/fog/core/scp.rb +8 -0
- data/lib/fog/core/ssh.rb +8 -0
- data/lib/fog/dynect/dns.rb +14 -5
- data/lib/fog/ibm/requests/compute/create_instance.rb +1 -1
- data/lib/fog/libvirt/requests/compute/create_volume.rb +1 -1
- data/lib/fog/libvirt/requests/compute/list_volumes.rb +1 -1
- data/lib/fog/local/models/storage/file.rb +12 -1
- data/lib/fog/local/storage.rb +25 -1
- data/lib/fog/ninefold/compute.rb +1 -0
- data/lib/fog/openstack.rb +3 -1
- data/lib/fog/openstack/compute.rb +13 -2
- data/lib/fog/openstack/models/compute/servers.rb +10 -2
- data/lib/fog/openstack/requests/compute/create_flavor.rb +2 -2
- data/lib/fog/openstack/requests/compute/create_security_group.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_volume.rb +1 -1
- data/lib/fog/openstack/requests/compute/get_flavor_details.rb +7 -7
- data/lib/fog/openstack/requests/compute/get_quota.rb +1 -12
- data/lib/fog/openstack/requests/compute/get_quota_defaults.rb +1 -12
- data/lib/fog/openstack/requests/compute/get_volume_details.rb +1 -1
- data/lib/fog/openstack/requests/compute/list_flavors.rb +7 -7
- data/lib/fog/openstack/requests/compute/list_flavors_detail.rb +7 -7
- data/lib/fog/openstack/requests/compute/list_security_groups.rb +7 -7
- data/lib/fog/openstack/requests/compute/list_servers_detail.rb +4 -3
- data/lib/fog/openstack/requests/compute/list_volumes.rb +6 -8
- data/lib/fog/openstack/requests/compute/update_quota.rb +2 -15
- data/lib/fog/openstack/requests/identity/delete_role.rb +1 -1
- data/lib/fog/openstack/requests/identity/list_roles.rb +1 -1
- data/lib/fog/openstack/requests/image/create_image.rb +3 -1
- data/lib/fog/openstack/requests/image/list_public_images.rb +19 -1
- data/lib/fog/openstack/requests/image/list_public_images_detailed.rb +20 -2
- data/lib/fog/openstack/requests/image/update_image.rb +1 -1
- data/lib/fog/rackspace.rb +2 -0
- data/lib/fog/rackspace/databases.rb +121 -0
- data/lib/fog/rackspace/identity.rb +83 -0
- data/lib/fog/rackspace/load_balancers.rb +3 -0
- data/lib/fog/rackspace/models/databases/database.rb +32 -0
- data/lib/fog/rackspace/models/databases/databases.rb +31 -0
- data/lib/fog/rackspace/models/databases/flavor.rb +15 -0
- data/lib/fog/rackspace/models/databases/flavors.rb +25 -0
- data/lib/fog/rackspace/models/databases/instance.rb +104 -0
- data/lib/fog/rackspace/models/databases/instances.rb +25 -0
- data/lib/fog/rackspace/models/databases/user.rb +32 -0
- data/lib/fog/rackspace/models/databases/users.rb +31 -0
- data/lib/fog/rackspace/models/identity/credential.rb +13 -0
- data/lib/fog/rackspace/models/identity/credentials.rb +32 -0
- data/lib/fog/rackspace/models/identity/role.rb +14 -0
- data/lib/fog/rackspace/models/identity/roles.rb +32 -0
- data/lib/fog/rackspace/models/identity/tenant.rb +15 -0
- data/lib/fog/rackspace/models/identity/tenants.rb +28 -0
- data/lib/fog/rackspace/models/identity/user.rb +53 -0
- data/lib/fog/rackspace/models/identity/users.rb +36 -0
- data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +17 -0
- data/lib/fog/rackspace/requests/databases/check_root_user.rb +15 -0
- data/lib/fog/rackspace/requests/databases/create_database.rb +24 -0
- data/lib/fog/rackspace/requests/databases/create_instance.rb +26 -0
- data/lib/fog/rackspace/requests/databases/create_user.rb +24 -0
- data/lib/fog/rackspace/requests/databases/delete_database.rb +15 -0
- data/lib/fog/rackspace/requests/databases/delete_instance.rb +15 -0
- data/lib/fog/rackspace/requests/databases/delete_user.rb +15 -0
- data/lib/fog/rackspace/requests/databases/enable_root_user.rb +15 -0
- data/lib/fog/rackspace/requests/databases/get_flavor.rb +15 -0
- data/lib/fog/rackspace/requests/databases/get_instance.rb +15 -0
- data/lib/fog/rackspace/requests/databases/list_databases.rb +15 -0
- data/lib/fog/rackspace/requests/databases/list_flavors.rb +15 -0
- data/lib/fog/rackspace/requests/databases/list_instances.rb +15 -0
- data/lib/fog/rackspace/requests/databases/list_users.rb +15 -0
- data/lib/fog/rackspace/requests/databases/resize_instance.rb +22 -0
- data/lib/fog/rackspace/requests/databases/resize_instance_volume.rb +24 -0
- data/lib/fog/rackspace/requests/databases/restart_instance.rb +20 -0
- data/lib/fog/rackspace/requests/identity/create_token.rb +25 -0
- data/lib/fog/rackspace/requests/identity/create_user.rb +25 -0
- data/lib/fog/rackspace/requests/identity/delete_user.rb +15 -0
- data/lib/fog/rackspace/requests/identity/get_credentials.rb +15 -0
- data/lib/fog/rackspace/requests/identity/get_user_by_id.rb +15 -0
- data/lib/fog/rackspace/requests/identity/get_user_by_name.rb +15 -0
- data/lib/fog/rackspace/requests/identity/list_credentials.rb +22 -0
- data/lib/fog/rackspace/requests/identity/list_tenants.rb +22 -0
- data/lib/fog/rackspace/requests/identity/list_user_roles.rb +22 -0
- data/lib/fog/rackspace/requests/identity/list_users.rb +22 -0
- data/lib/fog/rackspace/requests/identity/update_user.rb +24 -0
- data/lib/fog/rackspace/requests/load_balancers/get_ssl_termination.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/remove_ssl_termination.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/set_ssl_termination.rb +31 -0
- data/lib/fog/rackspace/storage.rb +1 -1
- data/lib/fog/vsphere/models/compute/server.rb +1 -0
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +2 -2
- data/tests/aws/models/compute/address_tests.rb +2 -1
- data/tests/aws/models/compute/volume_tests.rb +1 -1
- data/tests/aws/models/dns/records_tests.rb +19 -1
- data/tests/aws/models/storage/directory_tests.rb +1 -1
- data/tests/aws/models/storage/url_tests.rb +7 -1
- data/tests/aws/requests/auto_scaling/auto_scaling_tests.rb +4 -2
- data/tests/aws/requests/compute/address_tests.rb +19 -1
- data/tests/aws/requests/elasticache/cache_cluster_tests.rb +4 -4
- data/tests/aws/requests/elb/helper.rb +13 -2
- data/tests/aws/requests/iam/access_key_tests.rb +1 -3
- data/tests/cloudstack/compute/models/security_group_rule_tests.rb +29 -0
- data/tests/cloudstack/compute/models/security_group_tests.rb +16 -0
- data/tests/cloudstack/compute/models/security_groups_tests.rb +19 -0
- data/tests/cloudstack/compute/models/server_tests.rb +18 -0
- data/tests/cloudstack/compute/models/volume_tests.rb +34 -0
- data/tests/cloudstack/compute/models/volumes_tests.rb +17 -0
- data/tests/compute/helper.rb +10 -3
- data/tests/core/current_machine_tests.rb +32 -0
- data/tests/helper.rb +1 -1
- data/tests/helpers/mock_helper.rb +3 -0
- data/tests/hp/requests/compute/address_tests.rb +2 -1
- data/tests/joyent/requests/compute/datasets_tests.rb +12 -3
- data/tests/local/models/file_tests.rb +43 -0
- data/tests/local/storage_tests.rb +40 -0
- data/tests/openstack/requests/compute/flavor_tests.rb +1 -1
- data/tests/openstack/requests/compute/server_tests.rb +3 -3
- data/tests/openstack/requests/compute/volume_tests.rb +1 -1
- data/tests/openstack/requests/identity/role_tests.rb +1 -1
- data/tests/rackspace/databases_tests.rb +26 -0
- data/tests/rackspace/models/databases/database_tests.rb +17 -0
- data/tests/rackspace/models/databases/databases_tests.rb +17 -0
- data/tests/rackspace/models/databases/flavors_tests.rb +20 -0
- data/tests/rackspace/models/databases/instance_tests.rb +43 -0
- data/tests/rackspace/models/databases/instances_tests.rb +14 -0
- data/tests/rackspace/models/databases/user_tests.rb +21 -0
- data/tests/rackspace/models/databases/users_tests.rb +21 -0
- data/tests/rackspace/models/identity/credentials_tests.rb +16 -0
- data/tests/rackspace/models/identity/roles_tests.rb +16 -0
- data/tests/rackspace/models/identity/tenants_tests.rb +21 -0
- data/tests/rackspace/models/identity/user_tests.rb +17 -0
- data/tests/rackspace/models/identity/users_tests.rb +17 -0
- data/tests/rackspace/models/load_balancers/load_balancer_tests.rb +20 -0
- data/tests/rackspace/requests/databases/database_tests.rb +36 -0
- data/tests/rackspace/requests/databases/flavor_tests.rb +16 -0
- data/tests/rackspace/requests/databases/helper.rb +84 -0
- data/tests/rackspace/requests/databases/instance_tests.rb +77 -0
- data/tests/rackspace/requests/databases/user_tests.rb +37 -0
- data/tests/rackspace/requests/identity/tenants_tests.rb +21 -0
- data/tests/rackspace/requests/identity/token_tests.rb +63 -0
- data/tests/rackspace/requests/identity/user_tests.rb +107 -0
- data/tests/rackspace/requests/load_balancers/helper.rb +70 -1
- data/tests/rackspace/requests/load_balancers/ssl_termination_tests.rb +38 -0
- data/tests/storage/models/file_tests.rb +1 -1
- metadata +129 -13
- data/spec/core/current_machine_spec.rb +0 -32
- data/spec/lib/fog/aws/parsers/sqs/receive_message_spec.rb +0 -58
- data/spec/spec_helper.rb +0 -8
@@ -43,16 +43,17 @@ module Fog
|
|
43
43
|
Excon::Response.new.tap do |response|
|
44
44
|
if cidrBlock
|
45
45
|
response.status = 200
|
46
|
+
self.data[:vpcs].push({
|
47
|
+
'vpcId' => Fog::AWS::Mock.request_id,
|
48
|
+
'state' => 'pending',
|
49
|
+
'cidrBlock' => cidrBlock,
|
50
|
+
'dhcpOptionsId' => Fog::AWS::Mock.request_id,
|
51
|
+
'tagSet' => {}
|
46
52
|
|
53
|
+
})
|
47
54
|
response.body = {
|
48
55
|
'requestId' => Fog::AWS::Mock.request_id,
|
49
|
-
'vpcSet' => [
|
50
|
-
'vpcId' => Fog::AWS::Mock.request_id,
|
51
|
-
'state' => 'pending',
|
52
|
-
'cidrBlock' => cidrBlock,
|
53
|
-
'dhcpOptionsId' => Fog::AWS::Mock.request_id,
|
54
|
-
'tagSet' => {}
|
55
|
-
]
|
56
|
+
'vpcSet' => self.data[:vpcs]
|
56
57
|
}
|
57
58
|
else
|
58
59
|
response.status = 400
|
@@ -30,6 +30,7 @@ module Fog
|
|
30
30
|
Excon::Response.new.tap do |response|
|
31
31
|
if internet_gateway_id
|
32
32
|
response.status = 200
|
33
|
+
self.data[:internet_gateways].reject! { |v| v['internetGatewayId'] == internet_gateway_id }
|
33
34
|
|
34
35
|
response.body = {
|
35
36
|
'requestId' => Fog::AWS::Mock.request_id,
|
@@ -50,6 +50,7 @@ module Fog
|
|
50
50
|
{"messageSet" => [], "regionName" => "us-east-1", "zoneName" => "us-east-1b", "zoneState" => "available"},
|
51
51
|
{"messageSet" => [], "regionName" => "us-east-1", "zoneName" => "us-east-1c", "zoneState" => "available"},
|
52
52
|
{"messageSet" => [], "regionName" => "us-east-1", "zoneName" => "us-east-1d", "zoneState" => "available"},
|
53
|
+
{"messageSet" => [], "regionName" => "us-east-1", "zoneName" => "us-east-1e", "zoneState" => "available"},
|
53
54
|
|
54
55
|
{"messageSet" => [], "regionName" => "us-west-1", "zoneName" => "us-west-1a", "zoneState" => "available"},
|
55
56
|
{"messageSet" => [], "regionName" => "us-west-1", "zoneName" => "us-west-1b", "zoneState" => "available"},
|
@@ -45,14 +45,7 @@ module Fog
|
|
45
45
|
response.status = 200
|
46
46
|
response.body = {
|
47
47
|
'requestId' => Fog::AWS::Mock.request_id,
|
48
|
-
'dhcpOptionsSet' => [
|
49
|
-
'dhcpOptionsId' => Fog::AWS::Mock.dhcp_options_id,
|
50
|
-
'dhcpConfigurationSet' => {
|
51
|
-
'key' => 'domain-name',
|
52
|
-
'valueSet' => ["example.com"],
|
53
|
-
},
|
54
|
-
'tagSet' => {}
|
55
|
-
]
|
48
|
+
'dhcpOptionsSet' => self.data[:dhcp_options]
|
56
49
|
}
|
57
50
|
end
|
58
51
|
end
|
@@ -148,6 +148,8 @@ module Fog
|
|
148
148
|
elsif state_reason_key = filter_key.split('state-reason-')[1]
|
149
149
|
aliased_key = state_reason_aliases[state_reason_key]
|
150
150
|
instance_set = instance_set.reject{|instance| ![*filter_value].include?(instance['stateReason'][aliased_key])}
|
151
|
+
elsif filter_key == "group-name"
|
152
|
+
instance_set = instance_set.reject {|instance| !instance['groupSet'].include?(filter_value)}
|
151
153
|
else
|
152
154
|
aliased_key = aliases[filter_key]
|
153
155
|
instance_set = instance_set.reject {|instance| ![*filter_value].include?(instance[aliased_key])}
|
@@ -177,7 +179,7 @@ module Fog
|
|
177
179
|
instance['ipAddress'] = Fog::AWS::Mock.ip_address
|
178
180
|
instance['originalIpAddress'] = instance['ipAddress']
|
179
181
|
instance['dnsName'] = Fog::AWS::Mock.dns_name_for(instance['ipAddress'])
|
180
|
-
instance['privateIpAddress'] = Fog::AWS::Mock.
|
182
|
+
instance['privateIpAddress'] = Fog::AWS::Mock.private_ip_address
|
181
183
|
instance['privateDnsName'] = Fog::AWS::Mock.private_dns_name_for(instance['privateIpAddress'])
|
182
184
|
instance['instanceState'] = { 'code' => 16, 'name' => 'running' }
|
183
185
|
end
|
@@ -44,14 +44,7 @@ module Fog
|
|
44
44
|
response.status = 200
|
45
45
|
response.body = {
|
46
46
|
'requestId' => Fog::AWS::Mock.request_id,
|
47
|
-
'internetGatewaySet' => [
|
48
|
-
'internetGatewayId' => Fog::AWS::Mock.request_id,
|
49
|
-
'attachmentSet' => {
|
50
|
-
'vpcId' => Fog::AWS::Mock.request_id,
|
51
|
-
'state' => 'pending',
|
52
|
-
},
|
53
|
-
'tagSet' => {}
|
54
|
-
]
|
47
|
+
'internetGatewaySet' => self.data[:internet_gateways]
|
55
48
|
}
|
56
49
|
end
|
57
50
|
end
|
@@ -48,15 +48,7 @@ module Fog
|
|
48
48
|
response.status = 200
|
49
49
|
response.body = {
|
50
50
|
'requestId' => Fog::AWS::Mock.request_id,
|
51
|
-
'subnetSet' => [
|
52
|
-
'subnetId' => Fog::AWS::Mock.request_id,
|
53
|
-
'state' => 'pending',
|
54
|
-
'vpcId' => Fog::AWS::Mock.request_id,
|
55
|
-
'cidrBlock' => '10.255.255.0/24',
|
56
|
-
'availableIpAddressCount' => 255,
|
57
|
-
'availabilityZone' => 'us-east-1c',
|
58
|
-
'tagSet' => {}
|
59
|
-
]
|
51
|
+
'subnetSet' => self.data[:subnets]
|
60
52
|
}
|
61
53
|
end
|
62
54
|
end
|
@@ -45,14 +45,7 @@ module Fog
|
|
45
45
|
response.status = 200
|
46
46
|
response.body = {
|
47
47
|
'requestId' => Fog::AWS::Mock.request_id,
|
48
|
-
'vpcSet' => [
|
49
|
-
'vpcId' => Fog::AWS::Mock.request_id,
|
50
|
-
'state' => 'pending',
|
51
|
-
'cidrBlock' => '10.255.255.0/24',
|
52
|
-
'dhcpOptionsId' => Fog::AWS::Mock.request_id,
|
53
|
-
'instanceTenancy' => 'default',
|
54
|
-
'tagSet' => {}
|
55
|
-
]
|
48
|
+
'vpcSet' => self.data[:vpcs]
|
56
49
|
}
|
57
50
|
end
|
58
51
|
end
|
@@ -14,7 +14,7 @@ module Fog
|
|
14
14
|
# * 'return'<~Boolean> - success?
|
15
15
|
#
|
16
16
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ReleaseAddress.html]
|
17
|
-
#
|
17
|
+
#
|
18
18
|
# non-VPC: requires public_ip only
|
19
19
|
# VPC: requires allocation_id only
|
20
20
|
def release_address(ip_or_allocation)
|
@@ -35,9 +35,17 @@ module Fog
|
|
35
35
|
|
36
36
|
class Mock
|
37
37
|
|
38
|
-
def release_address(
|
38
|
+
def release_address(public_ip_or_allocation_id)
|
39
39
|
response = Excon::Response.new
|
40
|
-
|
40
|
+
|
41
|
+
address = self.data[:addresses][public_ip_or_allocation_id] || self.data[:addresses].values.detect {|a| a['allocationId'] == public_ip_or_allocation_id }
|
42
|
+
|
43
|
+
if address
|
44
|
+
if address['allocationId'] && public_ip_or_allocation_id == address['publicIp']
|
45
|
+
raise Fog::Compute::AWS::Error, "InvalidParameterValue => You must specify an allocation id when releasing a VPC elastic IP address"
|
46
|
+
end
|
47
|
+
|
48
|
+
self.data[:addresses].delete(address['publicIp'])
|
41
49
|
response.status = 200
|
42
50
|
response.body = {
|
43
51
|
'requestId' => Fog::AWS::Mock.request_id,
|
@@ -45,7 +53,7 @@ module Fog
|
|
45
53
|
}
|
46
54
|
response
|
47
55
|
else
|
48
|
-
raise Fog::Compute::AWS::Error.new("AuthFailure => The address '#{
|
56
|
+
raise Fog::Compute::AWS::Error.new("AuthFailure => The address '#{public_ip_or_allocation_id}' does not belong to you.")
|
49
57
|
end
|
50
58
|
end
|
51
59
|
|
@@ -34,6 +34,7 @@ module Fog
|
|
34
34
|
|
35
35
|
instance_set = self.data[:instances].values
|
36
36
|
instance_set = apply_tag_filters(instance_set, {'instance_id' => instance_ids}, 'instanceId')
|
37
|
+
instance_set = instance_set.find_all {|x| instance_ids.include?(x["instanceId"]) }
|
37
38
|
|
38
39
|
if instance_set.empty?
|
39
40
|
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_ids.first}' does not exist")
|
@@ -35,6 +35,7 @@ module Fog
|
|
35
35
|
|
36
36
|
instance_set = self.data[:instances].values
|
37
37
|
instance_set = apply_tag_filters(instance_set, {'instance_id' => instance_ids}, 'instanceId')
|
38
|
+
instance_set = instance_set.find_all {|x| instance_ids.include?(x["instanceId"]) }
|
38
39
|
|
39
40
|
if instance_set.empty?
|
40
41
|
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_ids.first}' does not exist")
|
@@ -43,7 +43,7 @@ module Fog
|
|
43
43
|
'AutoMinorVersionUpgrade' => options[:auto_minor_version_upgrade],
|
44
44
|
'CacheParameterGroupName' => options[:parameter_group_name],
|
45
45
|
'EngineVersion' => options[:engine_version],
|
46
|
-
'NotificationTopicArn' =>
|
46
|
+
'NotificationTopicArn' => options[:notification_topic_arn],
|
47
47
|
'Port' => options[:port],
|
48
48
|
'PreferredAvailabilityZone' => options[:preferred_availablility_zone],
|
49
49
|
'PreferredMaintenanceWindow' => options[:preferred_maintenance_window],
|
@@ -54,9 +54,33 @@ module Fog
|
|
54
54
|
|
55
55
|
class Mock
|
56
56
|
def create_cache_cluster(id, options = {})
|
57
|
-
|
57
|
+
response = Excon::Response.new
|
58
|
+
cluster = { # create an in-memory representation of this cluster
|
59
|
+
'CacheClusterId' => id.strip,
|
60
|
+
'NumCacheNodes' => options[:num_nodes] || 1,
|
61
|
+
'CacheNodeType' => options[:node_type] || 'cache.m1.large',
|
62
|
+
'Engine' => options[:engine] || 'memcached',
|
63
|
+
'EngineVersion' => options[:engine_version] || '1.4.5',
|
64
|
+
'CacheClusterStatus' => 'available',
|
65
|
+
'CacheNodes' => create_cache_nodes(id.strip, options[:num_nodes]),
|
66
|
+
'CacheSecurityGroups' => [],
|
67
|
+
'CacheParameterGroup' => { 'CacheParameterGroupName' =>
|
68
|
+
options[:parameter_group_name] || 'default.memcached1.4' },
|
69
|
+
'PendingModifiedValues' => {},
|
70
|
+
'AutoMinorVersionUpgrade' =>
|
71
|
+
options[:auto_minor_version_upgrade] || 'true',
|
72
|
+
'PreferredMaintenanceWindow' =>
|
73
|
+
options[:preferred_maintenance_window] || 'sun:05:00-sun:09:00',
|
74
|
+
}
|
75
|
+
self.data[:clusters][id] = cluster # store the in-memory cluster
|
76
|
+
response.body = {
|
77
|
+
'CacheCluster' => cluster.merge({'CacheClusterStatus' => 'creating'}),
|
78
|
+
'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
|
79
|
+
}
|
80
|
+
response
|
58
81
|
end
|
59
82
|
end
|
83
|
+
|
60
84
|
end
|
61
85
|
end
|
62
86
|
end
|
@@ -24,9 +24,18 @@ module Fog
|
|
24
24
|
|
25
25
|
class Mock
|
26
26
|
def delete_cache_cluster(cluster_id)
|
27
|
-
|
27
|
+
response = Excon::Response.new
|
28
|
+
cluster = self.data[:clusters][cluster_id]
|
29
|
+
cluster['CacheClusterStatus'] = 'deleting'
|
30
|
+
response.body = {
|
31
|
+
'CacheClusters' => self.data[:clusters].values,
|
32
|
+
'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
|
33
|
+
}
|
34
|
+
self.data[:clusters].delete(cluster_id)
|
35
|
+
response
|
28
36
|
end
|
29
37
|
end
|
38
|
+
|
30
39
|
end
|
31
40
|
end
|
32
41
|
end
|
@@ -31,9 +31,24 @@ module Fog
|
|
31
31
|
|
32
32
|
class Mock
|
33
33
|
def describe_cache_clusters(id = nil, options = {})
|
34
|
-
|
34
|
+
response = Excon::Response.new
|
35
|
+
all_clusters = self.data[:clusters].values.map do |cluster|
|
36
|
+
cluster.merge!(options[:show_node_info] ? {
|
37
|
+
'CacheClusterCreateTime' => DateTime.now - 60,
|
38
|
+
'PreferredAvailabilityZone' => 'us-east-1a'
|
39
|
+
} : {})
|
40
|
+
end
|
41
|
+
if (id != nil) && (all_clusters.empty?)
|
42
|
+
raise Fog::AWS::Elasticache::NotFound
|
43
|
+
end
|
44
|
+
response.body = {
|
45
|
+
'CacheClusters' => all_clusters,
|
46
|
+
'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
|
47
|
+
}
|
48
|
+
response
|
35
49
|
end
|
36
50
|
end
|
51
|
+
|
37
52
|
end
|
38
53
|
end
|
39
54
|
end
|
@@ -51,7 +51,7 @@ module Fog
|
|
51
51
|
'AutoMinorVersionUpgrade' => options[:auto_minor_version_upgrade],
|
52
52
|
'CacheParameterGroupName' => options[:parameter_group_name],
|
53
53
|
'EngineVersion' => options[:engine_version],
|
54
|
-
'NotificationTopicArn' =>
|
54
|
+
'NotificationTopicArn' => options[:notification_topic_arn],
|
55
55
|
'NotificationTopicStatus' => options[:notification_topic_status],
|
56
56
|
'PreferredMaintenanceWindow' => options[:preferred_maintenance_window],
|
57
57
|
:parser => Fog::Parsers::AWS::Elasticache::SingleCacheCluster.new
|
@@ -61,10 +61,42 @@ module Fog
|
|
61
61
|
end
|
62
62
|
|
63
63
|
class Mock
|
64
|
-
def modify_cache_cluster
|
65
|
-
|
64
|
+
def modify_cache_cluster(id, options = {})
|
65
|
+
response = Excon::Response.new
|
66
|
+
cluster = self.data[:clusters][id]
|
67
|
+
pending_values = Hash.new
|
68
|
+
# For any given option, update the cluster's corresponding value
|
69
|
+
{ :auto_minor_version_upgrade => 'AutoMinorVersionUpgrade',
|
70
|
+
:preferred_maintenance_window => 'PreferredMaintenanceWindow',
|
71
|
+
:engine_version => 'EngineVersion',
|
72
|
+
:num_nodes => 'NumCacheNodes',
|
73
|
+
}.each do |option, cluster_key|
|
74
|
+
if options[option] != nil
|
75
|
+
cluster[cluster_key] = options[option].to_s
|
76
|
+
pending_values[cluster_key] = options[option]
|
77
|
+
end
|
78
|
+
end
|
79
|
+
cache['CacheParameterGroup'] = {
|
80
|
+
'CacheParameterGroupName' => options[:parameter_group_name]
|
81
|
+
} if options[:parameter_group_name]
|
82
|
+
if options[:num_nodes] || options[:engine_version]
|
83
|
+
cluster['CacheNodes'] =
|
84
|
+
create_cache_nodes(cluster['CacheClusterId'], options[:num_nodes])
|
85
|
+
cluster['NumCacheNodes'] = cluster['CacheNodes'].size
|
86
|
+
end
|
87
|
+
if options[:nodes_to_remove]
|
88
|
+
pending_values['CacheNodeId'] = options[:nodes_to_remove].join(',')
|
89
|
+
end
|
90
|
+
response.body = {
|
91
|
+
'CacheCluster' => cluster.merge({
|
92
|
+
'PendingModifiedValues' => pending_values
|
93
|
+
}),
|
94
|
+
'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
|
95
|
+
}
|
96
|
+
response
|
66
97
|
end
|
67
98
|
end
|
99
|
+
|
68
100
|
end
|
69
101
|
end
|
70
102
|
end
|
@@ -35,10 +35,18 @@ module Fog
|
|
35
35
|
end
|
36
36
|
|
37
37
|
class Mock
|
38
|
-
def reboot_cache_cluster
|
39
|
-
|
38
|
+
def reboot_cache_cluster(id, nodes_to_reboot)
|
39
|
+
response = Excon::Response.new
|
40
|
+
response.body = {
|
41
|
+
'CacheCluster' => self.data[:clusters][id].merge({
|
42
|
+
'CacheClusterStatus' => 'rebooting cache cluster nodes'
|
43
|
+
}),
|
44
|
+
'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
|
45
|
+
}
|
46
|
+
response
|
40
47
|
end
|
41
48
|
end
|
49
|
+
|
42
50
|
end
|
43
51
|
end
|
44
52
|
end
|
@@ -76,7 +76,7 @@ module Fog
|
|
76
76
|
self.data[:load_balancers][lb_name] = {
|
77
77
|
'AvailabilityZones' => availability_zones,
|
78
78
|
'Subnets' => options[:subnet_ids],
|
79
|
-
'Scheme' => options[:scheme],
|
79
|
+
'Scheme' => options[:scheme].nil? ? 'internet-facing' : options[:scheme],
|
80
80
|
'SecurityGroups' => options[:security_groups],
|
81
81
|
'CanonicalHostedZoneName' => '',
|
82
82
|
'CanonicalHostedZoneNameID' => '',
|
@@ -58,7 +58,7 @@ module Fog
|
|
58
58
|
end
|
59
59
|
when "rebooting" # I don't know how to show rebooting just once before it changes to available
|
60
60
|
# it applies pending modified values
|
61
|
-
|
61
|
+
unless server["PendingModifiedValues"].empty?
|
62
62
|
server.merge!(server["PendingModifiedValues"])
|
63
63
|
server["PendingModifiedValues"] = {}
|
64
64
|
self.data[:tmp] ||= Time.now + Fog::Mock.delay * 2
|
@@ -69,13 +69,13 @@ module Fog
|
|
69
69
|
end
|
70
70
|
when "modifying"
|
71
71
|
# TODO there are some fields that only applied after rebooting
|
72
|
-
|
72
|
+
unless server["PendingModifiedValues"].empty?
|
73
73
|
server.merge!(server["PendingModifiedValues"])
|
74
74
|
server["PendingModifiedValues"] = {}
|
75
75
|
server["DBInstanceStatus"] = 'available'
|
76
76
|
end
|
77
77
|
when "available" # I'm not sure if amazon does this
|
78
|
-
|
78
|
+
unless server["PendingModifiedValues"].empty?
|
79
79
|
server["DBInstanceStatus"] = 'modifying'
|
80
80
|
end
|
81
81
|
|
data/lib/fog/aws/sqs.rb
CHANGED
@@ -40,7 +40,7 @@ module Fog
|
|
40
40
|
setup_credentials(options)
|
41
41
|
@region = options[:region] || 'us-east-1'
|
42
42
|
|
43
|
-
unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
|
43
|
+
unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
|
44
44
|
raise ArgumentError, "Unknown region: #{@region.inspect}"
|
45
45
|
end
|
46
46
|
end
|
data/lib/fog/aws/storage.rb
CHANGED
@@ -284,7 +284,7 @@ module Fog
|
|
284
284
|
"s3-#{options[:region]}.amazonaws.com"
|
285
285
|
end
|
286
286
|
@path = options[:path] || '/'
|
287
|
-
@persistent = options.fetch(:persistent,
|
287
|
+
@persistent = options.fetch(:persistent, false)
|
288
288
|
@port = options[:port] || 443
|
289
289
|
@scheme = options[:scheme] || 'https'
|
290
290
|
end
|
data/lib/fog/bin/rackspace.rb
CHANGED
@@ -13,6 +13,10 @@ class Rackspace < Fog::Bin
|
|
13
13
|
Fog::Rackspace::LoadBalancers
|
14
14
|
when :dns
|
15
15
|
Fog::DNS::Rackspace
|
16
|
+
when :identity
|
17
|
+
Fog::Rackspace::Identity
|
18
|
+
when :databases
|
19
|
+
Fog::Rackspace::Databases
|
16
20
|
else
|
17
21
|
raise ArgumentError, "Unrecognized service: #{key}"
|
18
22
|
end
|