fog 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +2 -9
- data/Rakefile +3 -2
- data/docs/_layouts/default.html +13 -13
- data/docs/about/contributing.markdown +1 -1
- data/docs/about/getting_started.markdown +28 -3
- data/docs/dns/index.markdown +4 -4
- data/docs/index.markdown +2 -10
- data/docs/public/css/fog.css +14 -1
- data/docs/storage/index.markdown +2 -2
- data/fog.gemspec +6 -5
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +26 -1
- data/lib/fog/aws/auto_scaling.rb +3 -1
- data/lib/fog/aws/cloud_formation.rb +3 -0
- data/lib/fog/aws/cloud_watch.rb +17 -1
- data/lib/fog/aws/compute.rb +50 -18
- data/lib/fog/aws/elb.rb +4 -2
- data/lib/fog/aws/emr.rb +133 -0
- data/lib/fog/aws/models/cloud_watch/alarm.rb +12 -0
- data/lib/fog/aws/models/cloud_watch/alarm_data.rb +39 -0
- data/lib/fog/aws/models/cloud_watch/alarm_datum.rb +66 -0
- data/lib/fog/aws/models/cloud_watch/alarm_histories.rb +18 -0
- data/lib/fog/aws/models/cloud_watch/alarm_history.rb +16 -0
- data/lib/fog/aws/models/cloud_watch/alarms.rb +30 -0
- data/lib/fog/aws/models/compute/addresses.rb +1 -1
- data/lib/fog/aws/models/compute/key_pairs.rb +1 -1
- data/lib/fog/aws/models/compute/security_groups.rb +1 -1
- data/lib/fog/aws/models/compute/server.rb +4 -2
- data/lib/fog/aws/models/compute/servers.rb +1 -1
- data/lib/fog/aws/models/compute/snapshots.rb +1 -1
- data/lib/fog/aws/models/compute/spot_request.rb +21 -4
- data/lib/fog/aws/models/compute/spot_requests.rb +45 -1
- data/lib/fog/aws/models/compute/volumes.rb +1 -1
- data/lib/fog/aws/models/elb/load_balancer.rb +2 -0
- data/lib/fog/aws/models/storage/file.rb +1 -1
- data/lib/fog/aws/parsers/cdn/get_invalidation_list.rb +0 -1
- data/lib/fog/aws/parsers/cloud_formation/update_stack.rb +19 -0
- data/lib/fog/aws/parsers/cloud_watch/delete_alarms.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/describe_alarm_history.rb +40 -0
- data/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb +73 -0
- data/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb +71 -0
- data/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/get_metric_statistics.rb +1 -0
- data/lib/fog/aws/parsers/cloud_watch/put_metric_alarm.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb +26 -0
- data/lib/fog/aws/parsers/compute/spot_instance_requests.rb +2 -2
- data/lib/fog/aws/parsers/emr/add_instance_groups.rb +28 -0
- data/lib/fog/aws/parsers/emr/add_job_flow_steps.rb +17 -0
- data/lib/fog/aws/parsers/emr/describe_job_flows.rb +140 -0
- data/lib/fog/aws/parsers/emr/modify_instance_groups.rb +17 -0
- data/lib/fog/aws/parsers/emr/run_job_flow.rb +19 -0
- data/lib/fog/aws/parsers/emr/set_termination_protection.rb +17 -0
- data/lib/fog/aws/parsers/emr/terminate_job_flows.rb +17 -0
- data/lib/fog/aws/rds.rb +3 -1
- data/lib/fog/aws/requests/cloud_formation/create_stack.rb +6 -0
- data/lib/fog/aws/requests/cloud_formation/update_stack.rb +62 -0
- data/lib/fog/aws/requests/cloud_watch/delete_alarms.rb +30 -0
- data/lib/fog/aws/requests/cloud_watch/describe_alarm_history.rb +33 -0
- data/lib/fog/aws/requests/cloud_watch/describe_alarms.rb +38 -0
- data/lib/fog/aws/requests/cloud_watch/describe_alarms_for_metric.rb +39 -0
- data/lib/fog/aws/requests/cloud_watch/disable_alarm_actions.rb +30 -0
- data/lib/fog/aws/requests/cloud_watch/enable_alarm_actions.rb +30 -0
- data/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb +84 -0
- data/lib/fog/aws/requests/cloud_watch/set_alarm_state.rb +31 -0
- data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +141 -36
- data/lib/fog/aws/requests/compute/create_snapshot.rb +2 -3
- data/lib/fog/aws/requests/compute/create_tags.rb +5 -3
- data/lib/fog/aws/requests/compute/create_volume.rb +0 -1
- data/lib/fog/aws/requests/compute/delete_security_group.rb +25 -0
- data/lib/fog/aws/requests/compute/delete_tags.rb +3 -4
- data/lib/fog/aws/requests/compute/describe_addresses.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +5 -2
- data/lib/fog/aws/requests/compute/describe_images.rb +6 -9
- data/lib/fog/aws/requests/compute/describe_instances.rb +17 -8
- data/lib/fog/aws/requests/compute/describe_key_pairs.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_regions.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_reserved_instances.rb +1 -1
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_snapshots.rb +7 -5
- data/lib/fog/aws/requests/compute/describe_volumes.rb +5 -4
- data/lib/fog/aws/requests/compute/modify_image_attribute.rb +32 -0
- data/lib/fog/aws/requests/compute/modify_instance_attribute.rb +1 -1
- data/lib/fog/aws/requests/compute/purchase_reserved_instances_offering.rb +1 -1
- data/lib/fog/aws/requests/compute/register_image.rb +0 -1
- data/lib/fog/aws/requests/compute/revoke_security_group_ingress.rb +41 -29
- data/lib/fog/aws/requests/compute/run_instances.rb +1 -2
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +1 -1
- data/lib/fog/aws/requests/elb/create_load_balancer_listeners.rb +1 -1
- data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +1 -1
- data/lib/fog/aws/requests/elb/describe_instance_health.rb +2 -2
- data/lib/fog/aws/requests/elb/describe_load_balancers.rb +3 -3
- data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +2 -2
- data/lib/fog/aws/requests/emr/add_instance_groups.rb +46 -0
- data/lib/fog/aws/requests/emr/add_job_flow_steps.rb +49 -0
- data/lib/fog/aws/requests/emr/describe_job_flows.rb +108 -0
- data/lib/fog/aws/requests/emr/modify_instance_groups.rb +40 -0
- data/lib/fog/aws/requests/emr/run_job_flow.rb +106 -0
- data/lib/fog/aws/requests/emr/set_termination_protection.rb +39 -0
- data/lib/fog/aws/requests/emr/terminate_job_flows.rb +37 -0
- data/lib/fog/aws/requests/iam/get_server_certificate.rb +5 -7
- data/lib/fog/aws/requests/iam/upload_server_certificate.rb +1 -0
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
- data/lib/fog/aws/requests/simpledb/select.rb +1 -1
- data/lib/fog/aws/requests/storage/copy_object.rb +1 -1
- data/lib/fog/aws/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/aws/requests/storage/hash_to_acl.rb +35 -25
- data/lib/fog/aws/ses.rb +1 -1
- data/lib/fog/aws/simpledb.rb +2 -0
- data/lib/fog/aws/sns.rb +3 -1
- data/lib/fog/aws/sqs.rb +4 -2
- data/lib/fog/aws/storage.rb +12 -3
- data/lib/fog/bin.rb +1 -1
- data/lib/fog/bin/aws.rb +8 -4
- data/lib/fog/bin/bluebox.rb +2 -2
- data/lib/fog/bin/brightbox.rb +1 -1
- data/lib/fog/bin/dnsimple.rb +1 -1
- data/lib/fog/bin/dnsmadeeasy.rb +1 -1
- data/lib/fog/bin/ecloud.rb +1 -1
- data/lib/fog/bin/glesys.rb +1 -1
- data/lib/fog/bin/go_grid.rb +1 -1
- data/lib/fog/bin/google.rb +1 -1
- data/lib/fog/bin/libvirt.rb +1 -1
- data/lib/fog/bin/linode.rb +2 -2
- data/lib/fog/bin/local.rb +1 -1
- data/lib/fog/bin/new_servers.rb +1 -1
- data/lib/fog/bin/ninefold.rb +2 -2
- data/lib/fog/bin/openstack.rb +1 -1
- data/lib/fog/bin/rackspace.rb +3 -3
- data/lib/fog/bin/slicehost.rb +1 -1
- data/lib/fog/bin/stormondemand.rb +1 -1
- data/lib/fog/bin/virtual_box.rb +1 -1
- data/lib/fog/bin/vmfusion.rb +1 -1
- data/lib/fog/bin/voxel.rb +1 -1
- data/lib/fog/bin/zerigo.rb +1 -1
- data/lib/fog/brightbox/models/compute/account.rb +1 -1
- data/lib/fog/compute/models/server.rb +1 -2
- data/lib/fog/core/attributes.rb +5 -5
- data/lib/fog/core/connection.rb +1 -1
- data/lib/fog/core/deprecation.rb +2 -2
- data/lib/fog/core/logger.rb +8 -3
- data/lib/fog/core/mock.rb +4 -0
- data/lib/fog/core/provider.rb +7 -2
- data/lib/fog/core/service.rb +8 -2
- data/lib/fog/dnsmadeeasy/models/dns/record.rb +3 -2
- data/lib/fog/dynect/dns.rb +25 -3
- data/lib/fog/ecloud/compute.rb +2 -6
- data/lib/fog/go_grid/requests/compute/grid_server_power.rb +1 -1
- data/lib/fog/google/models/storage/file.rb +1 -1
- data/lib/fog/google/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/google/storage.rb +1 -1
- data/lib/fog/libvirt/models/compute/uri.rb +7 -3
- data/lib/fog/linode/models/compute/server.rb +10 -0
- data/lib/fog/ninefold/models/storage/file.rb +8 -6
- data/lib/fog/ninefold/models/storage/files.rb +3 -2
- data/lib/fog/ninefold/requests/storage/head_namespace.rb +20 -0
- data/lib/fog/ninefold/storage.rb +4 -2
- data/lib/fog/openstack.rb +4 -3
- data/lib/fog/openstack/compute.rb +8 -5
- data/lib/fog/openstack/models/compute/server.rb +10 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +6 -8
- data/lib/fog/rackspace/load_balancers.rb +1 -0
- data/lib/fog/rackspace/models/dns/callback.rb +1 -1
- data/lib/fog/rackspace/models/dns/record.rb +1 -1
- data/lib/fog/rackspace/models/dns/zone.rb +1 -1
- data/lib/fog/slicehost/dns.rb +1 -0
- data/lib/fog/slicehost/models/dns/record.rb +7 -3
- data/lib/fog/slicehost/models/dns/zone.rb +1 -1
- data/lib/fog/slicehost/parsers/dns/create_record.rb +8 -2
- data/lib/fog/slicehost/parsers/dns/get_record.rb +17 -5
- data/lib/fog/slicehost/parsers/dns/get_records.rb +10 -2
- data/lib/fog/slicehost/requests/dns/get_record.rb +1 -1
- data/lib/fog/slicehost/requests/dns/get_records.rb +7 -8
- data/lib/fog/slicehost/requests/dns/update_record.rb +43 -0
- data/lib/fog/storm_on_demand/models/compute/balancers.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/configs.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/images.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/servers.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/templates.rb +1 -1
- data/lib/fog/terremark/vcloud.rb +1 -1
- data/lib/fog/vsphere/compute.rb +40 -23
- data/lib/fog/vsphere/models/compute/server.rb +1 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +36 -4
- data/lib/fog/zerigo/dns.rb +14 -3
- data/lib/fog/zerigo/models/dns/record.rb +1 -1
- data/lib/fog/zerigo/models/dns/records.rb +5 -0
- data/lib/fog/zerigo/models/dns/zones.rb +2 -2
- data/lib/fog/zerigo/requests/dns/count_hosts.rb +20 -1
- data/lib/fog/zerigo/requests/dns/count_zones.rb +12 -1
- data/lib/fog/zerigo/requests/dns/create_host.rb +67 -1
- data/lib/fog/zerigo/requests/dns/create_zone.rb +44 -1
- data/lib/fog/zerigo/requests/dns/delete_host.rb +19 -0
- data/lib/fog/zerigo/requests/dns/delete_zone.rb +17 -0
- data/lib/fog/zerigo/requests/dns/find_hosts.rb +22 -1
- data/lib/fog/zerigo/requests/dns/get_host.rb +18 -1
- data/lib/fog/zerigo/requests/dns/get_zone.rb +19 -2
- data/lib/fog/zerigo/requests/dns/get_zone_stats.rb +23 -0
- data/lib/fog/zerigo/requests/dns/list_hosts.rb +20 -1
- data/lib/fog/zerigo/requests/dns/list_zones.rb +15 -0
- data/lib/fog/zerigo/requests/dns/update_host.rb +20 -1
- data/lib/fog/zerigo/requests/dns/update_zone.rb +20 -1
- data/tests/aws/models/cloud_watch/alarm_data_tests.rb +42 -0
- data/tests/aws/models/cloud_watch/alarm_history_tests.rb +22 -0
- data/tests/aws/models/compute/security_group_tests.rb +15 -10
- data/tests/aws/models/elb/model_tests.rb +4 -4
- data/tests/aws/requests/cloud_formation/stack_tests.rb +14 -0
- data/tests/aws/requests/cloud_watch/list_metrics_test.rb +5 -5
- data/tests/aws/requests/compute/image_tests.rb +33 -2
- data/tests/aws/requests/compute/instance_tests.rb +16 -1
- data/tests/aws/requests/compute/security_group_tests.rb +251 -32
- data/tests/aws/requests/compute/tag_tests.rb +42 -2
- data/tests/aws/requests/emr/helper.rb +172 -0
- data/tests/aws/requests/emr/instance_group_tests.rb +106 -0
- data/tests/aws/requests/emr/job_flow_tests.rb +88 -0
- data/tests/aws/requests/iam/server_certificate_tests.rb +20 -7
- data/tests/aws/requests/storage/bucket_tests.rb +82 -54
- data/tests/aws/requests/storage/hash_to_acl_tests.rb +173 -0
- data/tests/aws/requests/storage/object_tests.rb +44 -24
- data/tests/brightbox/requests/compute/helper.rb +15 -6
- data/tests/core/attribute_tests.rb +29 -0
- data/tests/core/mocking_tests.rb +60 -0
- data/tests/dns/models/record_tests.rb +4 -2
- data/tests/dns/models/records_tests.rb +4 -2
- data/tests/dns/models/zone_tests.rb +3 -1
- data/tests/dns/models/zones_tests.rb +4 -2
- data/tests/helper.rb +4 -0
- data/tests/rackspace/requests/dns/dns_tests.rb +16 -12
- data/tests/rackspace/requests/dns/records_tests.rb +13 -11
- data/tests/slicehost/requests/dns/dns_tests.rb +58 -11
- data/tests/vsphere/compute_tests.rb +18 -10
- data/tests/vsphere/requests/compute/vm_clone_tests.rb +1 -1
- metadata +214 -221
|
@@ -33,13 +33,13 @@ module Fog
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
class Mock
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
#
|
|
38
38
|
# Usage
|
|
39
39
|
#
|
|
40
40
|
# AWS[:compute].create_snapshot("vol-f7c23423", "latest snapshot")
|
|
41
41
|
#
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
def create_snapshot(volume_id, description = nil)
|
|
44
44
|
response = Excon::Response.new
|
|
45
45
|
if volume = self.data[:volumes][volume_id]
|
|
@@ -59,7 +59,6 @@ module Fog
|
|
|
59
59
|
response.body = {
|
|
60
60
|
'requestId' => Fog::AWS::Mock.request_id
|
|
61
61
|
}.merge!(data)
|
|
62
|
-
self.data[:snapshots][snapshot_id]['tagSet'] = {}
|
|
63
62
|
else
|
|
64
63
|
response.status = 400
|
|
65
64
|
raise(Excon::Errors.status_error({:expects => 200}, response))
|
|
@@ -53,7 +53,7 @@ module Fog
|
|
|
53
53
|
when /^vol\-[a-z0-9]{8}$/i
|
|
54
54
|
'volume'
|
|
55
55
|
end
|
|
56
|
-
if type && self.data[:"#{type}s"][resource_id]
|
|
56
|
+
if type && ((type == 'image' && visible_images[resource_id]) || self.data[:"#{type}s"][resource_id])
|
|
57
57
|
{ 'resourceId' => resource_id, 'resourceType' => type }
|
|
58
58
|
else
|
|
59
59
|
raise(Fog::Service::NotFound.new("The #{type} ID '#{resource_id}' does not exist"))
|
|
@@ -64,8 +64,10 @@ module Fog
|
|
|
64
64
|
self.data[:tags][key] ||= {}
|
|
65
65
|
self.data[:tags][key][value] ||= []
|
|
66
66
|
self.data[:tags][key][value] |= tagged
|
|
67
|
-
|
|
68
|
-
tagged.each
|
|
67
|
+
|
|
68
|
+
tagged.each do |resource|
|
|
69
|
+
self.data[:tag_sets][resource['resourceId']][key] = value
|
|
70
|
+
end
|
|
69
71
|
end
|
|
70
72
|
|
|
71
73
|
response = Excon::Response.new
|
|
@@ -30,8 +30,33 @@ module Fog
|
|
|
30
30
|
|
|
31
31
|
class Mock
|
|
32
32
|
def delete_security_group(name)
|
|
33
|
+
if name == 'default'
|
|
34
|
+
raise Fog::Compute::AWS::Error.new("InvalidGroup.Reserved => The security group 'default' is reserved")
|
|
35
|
+
end
|
|
36
|
+
|
|
33
37
|
response = Excon::Response.new
|
|
34
38
|
if self.data[:security_groups][name]
|
|
39
|
+
|
|
40
|
+
used_by_groups = []
|
|
41
|
+
self.region_data.each do |access_key, key_data|
|
|
42
|
+
key_data[:security_groups].each do |group_name, group|
|
|
43
|
+
next if group == self.data[:security_groups][name]
|
|
44
|
+
|
|
45
|
+
group['ipPermissions'].each do |group_ip_permission|
|
|
46
|
+
group_ip_permission['groups'].each do |group_group_permission|
|
|
47
|
+
if group_group_permission['groupName'] == name &&
|
|
48
|
+
group_group_permission['userId'] == self.data[:owner_id]
|
|
49
|
+
used_by_groups << "#{key_data[:owner_id]}:#{group_name}"
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
unless used_by_groups.empty?
|
|
57
|
+
raise Fog::Compute::AWS::Error.new("InvalidGroup.InUse => Group #{self.data[:owner_id]}:#{name} is used by groups: #{used_by_groups.uniq.join(" ")}")
|
|
58
|
+
end
|
|
59
|
+
|
|
35
60
|
self.data[:security_groups].delete(name)
|
|
36
61
|
response.status = 200
|
|
37
62
|
response.body = {
|
|
@@ -28,7 +28,7 @@ module Fog
|
|
|
28
28
|
index += 1 # should start at 1 instead of 0
|
|
29
29
|
params.merge!("Tag.#{index}.Key" => key)
|
|
30
30
|
unless tags[key].nil?
|
|
31
|
-
params.merge("Tag.#{index}.Value" => tags[key])
|
|
31
|
+
params.merge!("Tag.#{index}.Value" => tags[key])
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -53,7 +53,7 @@ module Fog
|
|
|
53
53
|
when /^vol\-[a-z0-9]{8}$/i
|
|
54
54
|
'volume'
|
|
55
55
|
end
|
|
56
|
-
if type && self.data[:"#{type}s"][resource_id]
|
|
56
|
+
if type && ((type == 'image' && visible_images[resource_id]) || self.data[:"#{type}s"][resource_id])
|
|
57
57
|
{ 'resourceId' => resource_id, 'resourceType' => type }
|
|
58
58
|
else
|
|
59
59
|
raise(Fog::Service::NotFound.new("The #{type} ID '#{resource_id}' does not exist"))
|
|
@@ -65,9 +65,8 @@ module Fog
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
tagged.each do |resource|
|
|
68
|
-
object = self.data[:"#{resource['resourceType']}s"][resource['resourceId']]
|
|
69
68
|
tags.each do |key, value|
|
|
70
|
-
tagset =
|
|
69
|
+
tagset = self.data[:tag_sets][resource['resourceId']]
|
|
71
70
|
tagset.delete(key) if tagset.has_key?(key) && (value.nil? || tagset[key] == value)
|
|
72
71
|
end
|
|
73
72
|
end
|
|
@@ -21,7 +21,7 @@ module Fog
|
|
|
21
21
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAddresses.html]
|
|
22
22
|
def describe_addresses(filters = {})
|
|
23
23
|
unless filters.is_a?(Hash)
|
|
24
|
-
Fog::Logger.
|
|
24
|
+
Fog::Logger.deprecation("describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead [light_black](#{caller.first})[/]")
|
|
25
25
|
filters = {'public-ip' => [*filters]}
|
|
26
26
|
end
|
|
27
27
|
params = Fog::AWS.indexed_filters(filters)
|
|
@@ -38,7 +38,7 @@ module Fog
|
|
|
38
38
|
|
|
39
39
|
def describe_addresses(filters = {})
|
|
40
40
|
unless filters.is_a?(Hash)
|
|
41
|
-
Fog::Logger.
|
|
41
|
+
Fog::Logger.deprecation("describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead [light_black](#{caller.first})[/]")
|
|
42
42
|
filters = {'public-ip' => [*filters]}
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -22,7 +22,7 @@ module Fog
|
|
|
22
22
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAvailabilityZones.html]
|
|
23
23
|
def describe_availability_zones(filters = {})
|
|
24
24
|
unless filters.is_a?(Hash)
|
|
25
|
-
Fog::Logger.
|
|
25
|
+
Fog::Logger.deprecation("describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead [light_black](#{caller.first})[/]")
|
|
26
26
|
filters = {'public-ip' => [*filters]}
|
|
27
27
|
end
|
|
28
28
|
params = Fog::AWS.indexed_filters(filters)
|
|
@@ -39,7 +39,7 @@ module Fog
|
|
|
39
39
|
|
|
40
40
|
def describe_availability_zones(filters = {})
|
|
41
41
|
unless filters.is_a?(Hash)
|
|
42
|
-
Fog::Logger.
|
|
42
|
+
Fog::Logger.deprecation("describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead [light_black](#{caller.first})[/]")
|
|
43
43
|
filters = {'public-ip' => [*filters]}
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -55,6 +55,9 @@ module Fog
|
|
|
55
55
|
{"messageSet" => [], "regionName" => "us-west-1", "zoneName" => "us-west-1b", "zoneState" => "available"},
|
|
56
56
|
{"messageSet" => [], "regionName" => "us-west-1", "zoneName" => "us-west-1c", "zoneState" => "available"},
|
|
57
57
|
|
|
58
|
+
{"messageSet" => [], "regionName" => "us-west-2", "zoneName" => "us-west-2a", "zoneState" => "available"},
|
|
59
|
+
{"messageSet" => [], "regionName" => "us-west-2", "zoneName" => "us-west-2b", "zoneState" => "available"},
|
|
60
|
+
|
|
58
61
|
{"messageSet" => [], "regionName" => "eu-west-1", "zoneName" => "eu-west-1a", "zoneState" => "available"},
|
|
59
62
|
{"messageSet" => [], "regionName" => "eu-west-1", "zoneName" => "eu-west-1b", "zoneState" => "available"},
|
|
60
63
|
{"messageSet" => [], "regionName" => "eu-west-1", "zoneName" => "eu-west-1c", "zoneState" => "available"},
|
|
@@ -60,7 +60,7 @@ module Fog
|
|
|
60
60
|
|
|
61
61
|
def describe_images(filters = {})
|
|
62
62
|
unless filters.is_a?(Hash)
|
|
63
|
-
Fog::Logger.
|
|
63
|
+
Fog::Logger.deprecation("describe_images with #{filters.class} param is deprecated, use describe_images('image-id' => []) instead [light_black](#{caller.first})[/]")
|
|
64
64
|
filters = {'image-id' => [*filters]}
|
|
65
65
|
end
|
|
66
66
|
|
|
@@ -98,15 +98,12 @@ module Fog
|
|
|
98
98
|
'virtualization-type' => 'virtualizationType'
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
image_set =
|
|
101
|
+
image_set = visible_images.values
|
|
102
|
+
image_set = apply_tag_filters(image_set, filters, 'imageId')
|
|
102
103
|
|
|
103
104
|
for filter_key, filter_value in filters
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
else
|
|
107
|
-
aliased_key = aliases[filter_key]
|
|
108
|
-
image_set = image_set.reject{|image| ![*filter_value].include?(image[aliased_key])}
|
|
109
|
-
end
|
|
105
|
+
aliased_key = aliases[filter_key]
|
|
106
|
+
image_set = image_set.reject{|image| ![*filter_value].include?(image[aliased_key])}
|
|
110
107
|
end
|
|
111
108
|
|
|
112
109
|
image_set = image_set.map do |image|
|
|
@@ -116,7 +113,7 @@ module Fog
|
|
|
116
113
|
image['imageState'] = 'available'
|
|
117
114
|
end
|
|
118
115
|
end
|
|
119
|
-
image.reject { |key, value| ['registered'].include?(key) }
|
|
116
|
+
image.reject { |key, value| ['registered'].include?(key) }.merge('tagSet' => self.data[:tag_sets][image['imageId']])
|
|
120
117
|
end
|
|
121
118
|
|
|
122
119
|
response.status = 200
|
|
@@ -55,7 +55,7 @@ module Fog
|
|
|
55
55
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html]
|
|
56
56
|
def describe_instances(filters = {})
|
|
57
57
|
unless filters.is_a?(Hash)
|
|
58
|
-
Fog::Logger.
|
|
58
|
+
Fog::Logger.deprecation("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
|
|
59
59
|
filters = {'instance-id' => [*filters]}
|
|
60
60
|
end
|
|
61
61
|
params = {}
|
|
@@ -81,14 +81,14 @@ module Fog
|
|
|
81
81
|
|
|
82
82
|
def describe_instances(filters = {})
|
|
83
83
|
unless filters.is_a?(Hash)
|
|
84
|
-
Fog::Logger.
|
|
84
|
+
Fog::Logger.deprecation("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
|
|
85
85
|
filters = {'instance-id' => [*filters]}
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
response = Excon::Response.new
|
|
89
89
|
|
|
90
90
|
instance_set = self.data[:instances].values
|
|
91
|
-
instance_set = apply_tag_filters(instance_set, filters)
|
|
91
|
+
instance_set = apply_tag_filters(instance_set, filters, 'instanceId')
|
|
92
92
|
|
|
93
93
|
aliases = {
|
|
94
94
|
'architecture' => 'architecture',
|
|
@@ -154,16 +154,25 @@ module Fog
|
|
|
154
154
|
end
|
|
155
155
|
end
|
|
156
156
|
|
|
157
|
+
brand_new_instances = instance_set.find_all do |instance|
|
|
158
|
+
instance['instanceState']['name'] == 'pending' &&
|
|
159
|
+
Time.now - instance['launchTime'] < Fog::Mock.delay * 2
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Error if filtering for a brand new instance directly
|
|
163
|
+
if (filters['instance-id'] || filters['instanceId']) && !brand_new_instances.empty?
|
|
164
|
+
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{brand_new_instances.first['instanceId']}' does not exist")
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Otherwise don't include it in the list
|
|
168
|
+
instance_set = instance_set.reject {|instance| brand_new_instances.include?(instance) }
|
|
169
|
+
|
|
157
170
|
response.status = 200
|
|
158
171
|
reservation_set = {}
|
|
159
172
|
|
|
160
173
|
instance_set.each do |instance|
|
|
161
174
|
case instance['instanceState']['name']
|
|
162
175
|
when 'pending'
|
|
163
|
-
if Time.now - instance['launchTime'] < Fog::Mock.delay * 2
|
|
164
|
-
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance['instanceId']}' does not exist")
|
|
165
|
-
end
|
|
166
|
-
|
|
167
176
|
if Time.now - instance['launchTime'] >= Fog::Mock.delay * 2
|
|
168
177
|
instance['ipAddress'] = Fog::AWS::Mock.ip_address
|
|
169
178
|
instance['originalIpAddress'] = instance['ipAddress']
|
|
@@ -196,7 +205,7 @@ module Fog
|
|
|
196
205
|
'ownerId' => instance['ownerId'],
|
|
197
206
|
'reservationId' => instance['reservationId']
|
|
198
207
|
}
|
|
199
|
-
reservation_set[instance['reservationId']]['instancesSet'] << instance.reject{|key,value| !['amiLaunchIndex', 'architecture', 'blockDeviceMapping', 'clientToken', 'dnsName', 'imageId', 'instanceId', 'instanceState', 'instanceType', 'ipAddress', 'kernelId', 'keyName', 'launchTime', 'monitoring', 'placement', 'platform', 'privateDnsName', 'privateIpAddress', 'productCodes', 'ramdiskId', 'reason', 'rootDeviceType', 'stateReason'
|
|
208
|
+
reservation_set[instance['reservationId']]['instancesSet'] << instance.reject{|key,value| !['amiLaunchIndex', 'architecture', 'blockDeviceMapping', 'clientToken', 'dnsName', 'imageId', 'instanceId', 'instanceState', 'instanceType', 'ipAddress', 'kernelId', 'keyName', 'launchTime', 'monitoring', 'placement', 'platform', 'privateDnsName', 'privateIpAddress', 'productCodes', 'ramdiskId', 'reason', 'rootDeviceType', 'stateReason'].include?(key)}.merge('tagSet' => self.data[:tag_sets][instance['instanceId']])
|
|
200
209
|
end
|
|
201
210
|
end
|
|
202
211
|
|
|
@@ -21,7 +21,7 @@ module Fog
|
|
|
21
21
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeKeyPairs.html]
|
|
22
22
|
def describe_key_pairs(filters = {})
|
|
23
23
|
unless filters.is_a?(Hash)
|
|
24
|
-
Fog::Logger.
|
|
24
|
+
Fog::Logger.deprecation("describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead [light_black](#{caller.first})[/]")
|
|
25
25
|
filters = {'key-name' => [*filters]}
|
|
26
26
|
end
|
|
27
27
|
params = Fog::AWS.indexed_filters(filters)
|
|
@@ -38,7 +38,7 @@ module Fog
|
|
|
38
38
|
|
|
39
39
|
def describe_key_pairs(filters = {})
|
|
40
40
|
unless filters.is_a?(Hash)
|
|
41
|
-
Fog::Logger.
|
|
41
|
+
Fog::Logger.deprecation("describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead [light_black](#{caller.first})[/]")
|
|
42
42
|
filters = {'key-name' => [*filters]}
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -21,7 +21,7 @@ module Fog
|
|
|
21
21
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeRegions.html]
|
|
22
22
|
def describe_regions(filters = {})
|
|
23
23
|
unless filters.is_a?(Hash)
|
|
24
|
-
Fog::Logger.
|
|
24
|
+
Fog::Logger.deprecation("describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead [light_black](#{caller.first})[/]")
|
|
25
25
|
filters = {'region-name' => [*filters]}
|
|
26
26
|
end
|
|
27
27
|
params = Fog::AWS.indexed_filters(filters)
|
|
@@ -38,7 +38,7 @@ module Fog
|
|
|
38
38
|
|
|
39
39
|
def describe_regions(filters = {})
|
|
40
40
|
unless filters.is_a?(Hash)
|
|
41
|
-
Fog::Logger.
|
|
41
|
+
Fog::Logger.deprecation("describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead [light_black](#{caller.first})[/]")
|
|
42
42
|
filters = {'region-name' => [*filters]}
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -29,7 +29,7 @@ module Fog
|
|
|
29
29
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeReservedInstances.html]
|
|
30
30
|
def describe_reserved_instances(filters = {})
|
|
31
31
|
unless filters.is_a?(Hash)
|
|
32
|
-
Fog::Logger.
|
|
32
|
+
Fog::Logger.deprecation("describe_reserved_instances with #{filters.class} param is deprecated, use describe_reserved_instances('reserved-instances-id' => []) instead [light_black](#{caller.first})[/]")
|
|
33
33
|
filters = {'reserved-instances-id' => [*filters]}
|
|
34
34
|
end
|
|
35
35
|
params = Fog::AWS.indexed_filters(filters)
|
|
@@ -31,7 +31,7 @@ module Fog
|
|
|
31
31
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSecurityGroups.html]
|
|
32
32
|
def describe_security_groups(filters = {})
|
|
33
33
|
unless filters.is_a?(Hash)
|
|
34
|
-
Fog::Logger.
|
|
34
|
+
Fog::Logger.deprecation("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
|
|
35
35
|
filters = {'group-name' => [*filters]}
|
|
36
36
|
end
|
|
37
37
|
params = Fog::AWS.indexed_filters(filters)
|
|
@@ -48,7 +48,7 @@ module Fog
|
|
|
48
48
|
|
|
49
49
|
def describe_security_groups(filters = {})
|
|
50
50
|
unless filters.is_a?(Hash)
|
|
51
|
-
Fog::Logger.
|
|
51
|
+
Fog::Logger.deprecation("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
|
|
52
52
|
filters = {'group-name' => [*filters]}
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -27,11 +27,11 @@ module Fog
|
|
|
27
27
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html]
|
|
28
28
|
def describe_snapshots(filters = {}, options = {})
|
|
29
29
|
unless filters.is_a?(Hash)
|
|
30
|
-
Fog::Logger.
|
|
30
|
+
Fog::Logger.deprecation("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
|
|
31
31
|
filters = {'snapshot-id' => [*filters]}
|
|
32
32
|
end
|
|
33
33
|
unless options.empty?
|
|
34
|
-
Fog::Logger.
|
|
34
|
+
Fog::Logger.deprecation("describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead [light_black](#{caller.first})[/]")
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
for key in ['ExecutableBy', 'ImageId', 'Owner', 'RestorableBy']
|
|
@@ -54,11 +54,11 @@ module Fog
|
|
|
54
54
|
|
|
55
55
|
def describe_snapshots(filters = {}, options = {})
|
|
56
56
|
unless filters.is_a?(Hash)
|
|
57
|
-
Fog::Logger.
|
|
57
|
+
Fog::Logger.deprecation("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
|
|
58
58
|
filters = {'snapshot-id' => [*filters]}
|
|
59
59
|
end
|
|
60
60
|
unless options.empty?
|
|
61
|
-
Fog::Logger.
|
|
61
|
+
Fog::Logger.deprecation("describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead [light_black](#{caller.first})[/]")
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
response = Excon::Response.new
|
|
@@ -72,7 +72,7 @@ module Fog
|
|
|
72
72
|
Fog::Logger.warning("describe_snapshots with RestorableBy other than 'self' (wanted #{restorable_by.inspect}) is not mocked [light_black](#{caller.first})[/]")
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
snapshot_set = apply_tag_filters(snapshot_set, filters)
|
|
75
|
+
snapshot_set = apply_tag_filters(snapshot_set, filters, 'snapshotId')
|
|
76
76
|
|
|
77
77
|
aliases = {
|
|
78
78
|
'description' => 'description',
|
|
@@ -106,6 +106,8 @@ module Fog
|
|
|
106
106
|
end
|
|
107
107
|
end
|
|
108
108
|
|
|
109
|
+
snapshot_set = snapshot_set.map {|snapshot| snapshot.merge('tagSet' => self.data[:tag_sets][snapshot['snapshotId']]) }
|
|
110
|
+
|
|
109
111
|
response.status = 200
|
|
110
112
|
response.body = {
|
|
111
113
|
'requestId' => Fog::AWS::Mock.request_id,
|
|
@@ -31,7 +31,7 @@ module Fog
|
|
|
31
31
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeVolumes.html]
|
|
32
32
|
def describe_volumes(filters = {})
|
|
33
33
|
unless filters.is_a?(Hash)
|
|
34
|
-
Fog::Logger.
|
|
34
|
+
Fog::Logger.deprecation("describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead [light_black](#{caller.first})[/]")
|
|
35
35
|
filters = {'volume-id' => [*filters]}
|
|
36
36
|
end
|
|
37
37
|
params = Fog::AWS.indexed_filters(filters)
|
|
@@ -48,15 +48,15 @@ module Fog
|
|
|
48
48
|
|
|
49
49
|
def describe_volumes(filters = {})
|
|
50
50
|
unless filters.is_a?(Hash)
|
|
51
|
-
Fog::Logger.
|
|
51
|
+
Fog::Logger.deprecation("describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead [light_black](#{caller.first})[/]")
|
|
52
52
|
filters = {'volume-id' => [*filters]}
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
response = Excon::Response.new
|
|
56
56
|
|
|
57
57
|
volume_set = self.data[:volumes].values
|
|
58
|
-
volume_set = apply_tag_filters(volume_set, filters)
|
|
59
|
-
|
|
58
|
+
volume_set = apply_tag_filters(volume_set, filters, 'volumeId')
|
|
59
|
+
|
|
60
60
|
aliases = {
|
|
61
61
|
'availability-zone' => 'availabilityZone',
|
|
62
62
|
'create-time' => 'createTime',
|
|
@@ -102,6 +102,7 @@ module Fog
|
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
volume_set = volume_set.reject {|volume| !self.data[:volumes][volume['volumeId']]}
|
|
105
|
+
volume_set = volume_set.map {|volume| volume.merge('tagSet' => self.data[:tag_sets][volume['volumeId']]) }
|
|
105
106
|
|
|
106
107
|
response.status = 200
|
|
107
108
|
response.body = {
|
|
@@ -37,6 +37,38 @@ module Fog
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
end
|
|
40
|
+
|
|
41
|
+
class Mock
|
|
42
|
+
|
|
43
|
+
def modify_image_attribute(image_id, attributes)
|
|
44
|
+
raise ArgumentError.new("image_id is required") unless image_id
|
|
45
|
+
|
|
46
|
+
unless self.data[:images][image_id]
|
|
47
|
+
raise Fog::Compute::AWS::NotFound.new("The AMI ID '#{image_id}' does not exist")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
(attributes['Add.UserId'] || []).each do |user_id|
|
|
51
|
+
if image_launch_permissions = self.data[:image_launch_permissions][image_id]
|
|
52
|
+
image_launch_permissions[:users].push(user_id)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
(attributes['Remove.UserId'] || []).each do |user_id|
|
|
57
|
+
if image_launch_permissions = self.data[:image_launch_permissions][image_id]
|
|
58
|
+
image_launch_permissions[:users].delete(user_id)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
response = Excon::Response.new
|
|
63
|
+
response.status = 200
|
|
64
|
+
response.body = {
|
|
65
|
+
'return' => true,
|
|
66
|
+
'requestId' => Fog::AWS::Mock.request_id
|
|
67
|
+
}
|
|
68
|
+
response
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end
|
|
40
72
|
end
|
|
41
73
|
end
|
|
42
74
|
end
|