fog 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. data/README.rdoc +2 -9
  2. data/Rakefile +3 -2
  3. data/docs/_layouts/default.html +13 -13
  4. data/docs/about/contributing.markdown +1 -1
  5. data/docs/about/getting_started.markdown +28 -3
  6. data/docs/dns/index.markdown +4 -4
  7. data/docs/index.markdown +2 -10
  8. data/docs/public/css/fog.css +14 -1
  9. data/docs/storage/index.markdown +2 -2
  10. data/fog.gemspec +6 -5
  11. data/lib/fog.rb +1 -1
  12. data/lib/fog/aws.rb +26 -1
  13. data/lib/fog/aws/auto_scaling.rb +3 -1
  14. data/lib/fog/aws/cloud_formation.rb +3 -0
  15. data/lib/fog/aws/cloud_watch.rb +17 -1
  16. data/lib/fog/aws/compute.rb +50 -18
  17. data/lib/fog/aws/elb.rb +4 -2
  18. data/lib/fog/aws/emr.rb +133 -0
  19. data/lib/fog/aws/models/cloud_watch/alarm.rb +12 -0
  20. data/lib/fog/aws/models/cloud_watch/alarm_data.rb +39 -0
  21. data/lib/fog/aws/models/cloud_watch/alarm_datum.rb +66 -0
  22. data/lib/fog/aws/models/cloud_watch/alarm_histories.rb +18 -0
  23. data/lib/fog/aws/models/cloud_watch/alarm_history.rb +16 -0
  24. data/lib/fog/aws/models/cloud_watch/alarms.rb +30 -0
  25. data/lib/fog/aws/models/compute/addresses.rb +1 -1
  26. data/lib/fog/aws/models/compute/key_pairs.rb +1 -1
  27. data/lib/fog/aws/models/compute/security_groups.rb +1 -1
  28. data/lib/fog/aws/models/compute/server.rb +4 -2
  29. data/lib/fog/aws/models/compute/servers.rb +1 -1
  30. data/lib/fog/aws/models/compute/snapshots.rb +1 -1
  31. data/lib/fog/aws/models/compute/spot_request.rb +21 -4
  32. data/lib/fog/aws/models/compute/spot_requests.rb +45 -1
  33. data/lib/fog/aws/models/compute/volumes.rb +1 -1
  34. data/lib/fog/aws/models/elb/load_balancer.rb +2 -0
  35. data/lib/fog/aws/models/storage/file.rb +1 -1
  36. data/lib/fog/aws/parsers/cdn/get_invalidation_list.rb +0 -1
  37. data/lib/fog/aws/parsers/cloud_formation/update_stack.rb +19 -0
  38. data/lib/fog/aws/parsers/cloud_watch/delete_alarms.rb +26 -0
  39. data/lib/fog/aws/parsers/cloud_watch/describe_alarm_history.rb +40 -0
  40. data/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb +73 -0
  41. data/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb +71 -0
  42. data/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb +26 -0
  43. data/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb +26 -0
  44. data/lib/fog/aws/parsers/cloud_watch/get_metric_statistics.rb +1 -0
  45. data/lib/fog/aws/parsers/cloud_watch/put_metric_alarm.rb +26 -0
  46. data/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb +26 -0
  47. data/lib/fog/aws/parsers/compute/spot_instance_requests.rb +2 -2
  48. data/lib/fog/aws/parsers/emr/add_instance_groups.rb +28 -0
  49. data/lib/fog/aws/parsers/emr/add_job_flow_steps.rb +17 -0
  50. data/lib/fog/aws/parsers/emr/describe_job_flows.rb +140 -0
  51. data/lib/fog/aws/parsers/emr/modify_instance_groups.rb +17 -0
  52. data/lib/fog/aws/parsers/emr/run_job_flow.rb +19 -0
  53. data/lib/fog/aws/parsers/emr/set_termination_protection.rb +17 -0
  54. data/lib/fog/aws/parsers/emr/terminate_job_flows.rb +17 -0
  55. data/lib/fog/aws/rds.rb +3 -1
  56. data/lib/fog/aws/requests/cloud_formation/create_stack.rb +6 -0
  57. data/lib/fog/aws/requests/cloud_formation/update_stack.rb +62 -0
  58. data/lib/fog/aws/requests/cloud_watch/delete_alarms.rb +30 -0
  59. data/lib/fog/aws/requests/cloud_watch/describe_alarm_history.rb +33 -0
  60. data/lib/fog/aws/requests/cloud_watch/describe_alarms.rb +38 -0
  61. data/lib/fog/aws/requests/cloud_watch/describe_alarms_for_metric.rb +39 -0
  62. data/lib/fog/aws/requests/cloud_watch/disable_alarm_actions.rb +30 -0
  63. data/lib/fog/aws/requests/cloud_watch/enable_alarm_actions.rb +30 -0
  64. data/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb +84 -0
  65. data/lib/fog/aws/requests/cloud_watch/set_alarm_state.rb +31 -0
  66. data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +141 -36
  67. data/lib/fog/aws/requests/compute/create_snapshot.rb +2 -3
  68. data/lib/fog/aws/requests/compute/create_tags.rb +5 -3
  69. data/lib/fog/aws/requests/compute/create_volume.rb +0 -1
  70. data/lib/fog/aws/requests/compute/delete_security_group.rb +25 -0
  71. data/lib/fog/aws/requests/compute/delete_tags.rb +3 -4
  72. data/lib/fog/aws/requests/compute/describe_addresses.rb +2 -2
  73. data/lib/fog/aws/requests/compute/describe_availability_zones.rb +5 -2
  74. data/lib/fog/aws/requests/compute/describe_images.rb +6 -9
  75. data/lib/fog/aws/requests/compute/describe_instances.rb +17 -8
  76. data/lib/fog/aws/requests/compute/describe_key_pairs.rb +2 -2
  77. data/lib/fog/aws/requests/compute/describe_regions.rb +2 -2
  78. data/lib/fog/aws/requests/compute/describe_reserved_instances.rb +1 -1
  79. data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -2
  80. data/lib/fog/aws/requests/compute/describe_snapshots.rb +7 -5
  81. data/lib/fog/aws/requests/compute/describe_volumes.rb +5 -4
  82. data/lib/fog/aws/requests/compute/modify_image_attribute.rb +32 -0
  83. data/lib/fog/aws/requests/compute/modify_instance_attribute.rb +1 -1
  84. data/lib/fog/aws/requests/compute/purchase_reserved_instances_offering.rb +1 -1
  85. data/lib/fog/aws/requests/compute/register_image.rb +0 -1
  86. data/lib/fog/aws/requests/compute/revoke_security_group_ingress.rb +41 -29
  87. data/lib/fog/aws/requests/compute/run_instances.rb +1 -2
  88. data/lib/fog/aws/requests/elb/create_load_balancer.rb +1 -1
  89. data/lib/fog/aws/requests/elb/create_load_balancer_listeners.rb +1 -1
  90. data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +1 -1
  91. data/lib/fog/aws/requests/elb/describe_instance_health.rb +2 -2
  92. data/lib/fog/aws/requests/elb/describe_load_balancers.rb +3 -3
  93. data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +2 -2
  94. data/lib/fog/aws/requests/emr/add_instance_groups.rb +46 -0
  95. data/lib/fog/aws/requests/emr/add_job_flow_steps.rb +49 -0
  96. data/lib/fog/aws/requests/emr/describe_job_flows.rb +108 -0
  97. data/lib/fog/aws/requests/emr/modify_instance_groups.rb +40 -0
  98. data/lib/fog/aws/requests/emr/run_job_flow.rb +106 -0
  99. data/lib/fog/aws/requests/emr/set_termination_protection.rb +39 -0
  100. data/lib/fog/aws/requests/emr/terminate_job_flows.rb +37 -0
  101. data/lib/fog/aws/requests/iam/get_server_certificate.rb +5 -7
  102. data/lib/fog/aws/requests/iam/upload_server_certificate.rb +1 -0
  103. data/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
  104. data/lib/fog/aws/requests/simpledb/select.rb +1 -1
  105. data/lib/fog/aws/requests/storage/copy_object.rb +1 -1
  106. data/lib/fog/aws/requests/storage/get_object_url.rb +2 -2
  107. data/lib/fog/aws/requests/storage/hash_to_acl.rb +35 -25
  108. data/lib/fog/aws/ses.rb +1 -1
  109. data/lib/fog/aws/simpledb.rb +2 -0
  110. data/lib/fog/aws/sns.rb +3 -1
  111. data/lib/fog/aws/sqs.rb +4 -2
  112. data/lib/fog/aws/storage.rb +12 -3
  113. data/lib/fog/bin.rb +1 -1
  114. data/lib/fog/bin/aws.rb +8 -4
  115. data/lib/fog/bin/bluebox.rb +2 -2
  116. data/lib/fog/bin/brightbox.rb +1 -1
  117. data/lib/fog/bin/dnsimple.rb +1 -1
  118. data/lib/fog/bin/dnsmadeeasy.rb +1 -1
  119. data/lib/fog/bin/ecloud.rb +1 -1
  120. data/lib/fog/bin/glesys.rb +1 -1
  121. data/lib/fog/bin/go_grid.rb +1 -1
  122. data/lib/fog/bin/google.rb +1 -1
  123. data/lib/fog/bin/libvirt.rb +1 -1
  124. data/lib/fog/bin/linode.rb +2 -2
  125. data/lib/fog/bin/local.rb +1 -1
  126. data/lib/fog/bin/new_servers.rb +1 -1
  127. data/lib/fog/bin/ninefold.rb +2 -2
  128. data/lib/fog/bin/openstack.rb +1 -1
  129. data/lib/fog/bin/rackspace.rb +3 -3
  130. data/lib/fog/bin/slicehost.rb +1 -1
  131. data/lib/fog/bin/stormondemand.rb +1 -1
  132. data/lib/fog/bin/virtual_box.rb +1 -1
  133. data/lib/fog/bin/vmfusion.rb +1 -1
  134. data/lib/fog/bin/voxel.rb +1 -1
  135. data/lib/fog/bin/zerigo.rb +1 -1
  136. data/lib/fog/brightbox/models/compute/account.rb +1 -1
  137. data/lib/fog/compute/models/server.rb +1 -2
  138. data/lib/fog/core/attributes.rb +5 -5
  139. data/lib/fog/core/connection.rb +1 -1
  140. data/lib/fog/core/deprecation.rb +2 -2
  141. data/lib/fog/core/logger.rb +8 -3
  142. data/lib/fog/core/mock.rb +4 -0
  143. data/lib/fog/core/provider.rb +7 -2
  144. data/lib/fog/core/service.rb +8 -2
  145. data/lib/fog/dnsmadeeasy/models/dns/record.rb +3 -2
  146. data/lib/fog/dynect/dns.rb +25 -3
  147. data/lib/fog/ecloud/compute.rb +2 -6
  148. data/lib/fog/go_grid/requests/compute/grid_server_power.rb +1 -1
  149. data/lib/fog/google/models/storage/file.rb +1 -1
  150. data/lib/fog/google/requests/storage/get_object_url.rb +2 -2
  151. data/lib/fog/google/storage.rb +1 -1
  152. data/lib/fog/libvirt/models/compute/uri.rb +7 -3
  153. data/lib/fog/linode/models/compute/server.rb +10 -0
  154. data/lib/fog/ninefold/models/storage/file.rb +8 -6
  155. data/lib/fog/ninefold/models/storage/files.rb +3 -2
  156. data/lib/fog/ninefold/requests/storage/head_namespace.rb +20 -0
  157. data/lib/fog/ninefold/storage.rb +4 -2
  158. data/lib/fog/openstack.rb +4 -3
  159. data/lib/fog/openstack/compute.rb +8 -5
  160. data/lib/fog/openstack/models/compute/server.rb +10 -1
  161. data/lib/fog/openstack/requests/compute/create_server.rb +6 -8
  162. data/lib/fog/rackspace/load_balancers.rb +1 -0
  163. data/lib/fog/rackspace/models/dns/callback.rb +1 -1
  164. data/lib/fog/rackspace/models/dns/record.rb +1 -1
  165. data/lib/fog/rackspace/models/dns/zone.rb +1 -1
  166. data/lib/fog/slicehost/dns.rb +1 -0
  167. data/lib/fog/slicehost/models/dns/record.rb +7 -3
  168. data/lib/fog/slicehost/models/dns/zone.rb +1 -1
  169. data/lib/fog/slicehost/parsers/dns/create_record.rb +8 -2
  170. data/lib/fog/slicehost/parsers/dns/get_record.rb +17 -5
  171. data/lib/fog/slicehost/parsers/dns/get_records.rb +10 -2
  172. data/lib/fog/slicehost/requests/dns/get_record.rb +1 -1
  173. data/lib/fog/slicehost/requests/dns/get_records.rb +7 -8
  174. data/lib/fog/slicehost/requests/dns/update_record.rb +43 -0
  175. data/lib/fog/storm_on_demand/models/compute/balancers.rb +1 -1
  176. data/lib/fog/storm_on_demand/models/compute/configs.rb +1 -1
  177. data/lib/fog/storm_on_demand/models/compute/images.rb +1 -1
  178. data/lib/fog/storm_on_demand/models/compute/servers.rb +1 -1
  179. data/lib/fog/storm_on_demand/models/compute/templates.rb +1 -1
  180. data/lib/fog/terremark/vcloud.rb +1 -1
  181. data/lib/fog/vsphere/compute.rb +40 -23
  182. data/lib/fog/vsphere/models/compute/server.rb +1 -0
  183. data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +36 -4
  184. data/lib/fog/zerigo/dns.rb +14 -3
  185. data/lib/fog/zerigo/models/dns/record.rb +1 -1
  186. data/lib/fog/zerigo/models/dns/records.rb +5 -0
  187. data/lib/fog/zerigo/models/dns/zones.rb +2 -2
  188. data/lib/fog/zerigo/requests/dns/count_hosts.rb +20 -1
  189. data/lib/fog/zerigo/requests/dns/count_zones.rb +12 -1
  190. data/lib/fog/zerigo/requests/dns/create_host.rb +67 -1
  191. data/lib/fog/zerigo/requests/dns/create_zone.rb +44 -1
  192. data/lib/fog/zerigo/requests/dns/delete_host.rb +19 -0
  193. data/lib/fog/zerigo/requests/dns/delete_zone.rb +17 -0
  194. data/lib/fog/zerigo/requests/dns/find_hosts.rb +22 -1
  195. data/lib/fog/zerigo/requests/dns/get_host.rb +18 -1
  196. data/lib/fog/zerigo/requests/dns/get_zone.rb +19 -2
  197. data/lib/fog/zerigo/requests/dns/get_zone_stats.rb +23 -0
  198. data/lib/fog/zerigo/requests/dns/list_hosts.rb +20 -1
  199. data/lib/fog/zerigo/requests/dns/list_zones.rb +15 -0
  200. data/lib/fog/zerigo/requests/dns/update_host.rb +20 -1
  201. data/lib/fog/zerigo/requests/dns/update_zone.rb +20 -1
  202. data/tests/aws/models/cloud_watch/alarm_data_tests.rb +42 -0
  203. data/tests/aws/models/cloud_watch/alarm_history_tests.rb +22 -0
  204. data/tests/aws/models/compute/security_group_tests.rb +15 -10
  205. data/tests/aws/models/elb/model_tests.rb +4 -4
  206. data/tests/aws/requests/cloud_formation/stack_tests.rb +14 -0
  207. data/tests/aws/requests/cloud_watch/list_metrics_test.rb +5 -5
  208. data/tests/aws/requests/compute/image_tests.rb +33 -2
  209. data/tests/aws/requests/compute/instance_tests.rb +16 -1
  210. data/tests/aws/requests/compute/security_group_tests.rb +251 -32
  211. data/tests/aws/requests/compute/tag_tests.rb +42 -2
  212. data/tests/aws/requests/emr/helper.rb +172 -0
  213. data/tests/aws/requests/emr/instance_group_tests.rb +106 -0
  214. data/tests/aws/requests/emr/job_flow_tests.rb +88 -0
  215. data/tests/aws/requests/iam/server_certificate_tests.rb +20 -7
  216. data/tests/aws/requests/storage/bucket_tests.rb +82 -54
  217. data/tests/aws/requests/storage/hash_to_acl_tests.rb +173 -0
  218. data/tests/aws/requests/storage/object_tests.rb +44 -24
  219. data/tests/brightbox/requests/compute/helper.rb +15 -6
  220. data/tests/core/attribute_tests.rb +29 -0
  221. data/tests/core/mocking_tests.rb +60 -0
  222. data/tests/dns/models/record_tests.rb +4 -2
  223. data/tests/dns/models/records_tests.rb +4 -2
  224. data/tests/dns/models/zone_tests.rb +3 -1
  225. data/tests/dns/models/zones_tests.rb +4 -2
  226. data/tests/helper.rb +4 -0
  227. data/tests/rackspace/requests/dns/dns_tests.rb +16 -12
  228. data/tests/rackspace/requests/dns/records_tests.rb +13 -11
  229. data/tests/slicehost/requests/dns/dns_tests.rb +58 -11
  230. data/tests/vsphere/compute_tests.rb +18 -10
  231. data/tests/vsphere/requests/compute/vm_clone_tests.rb +1 -1
  232. metadata +214 -221
@@ -34,7 +34,7 @@ module Fog
34
34
  end
35
35
 
36
36
  def modify_instance_attributes(instance_id, attributes)
37
- Fog::Logger.warning("modify_instance_attributes method is deprecated, use 'modify_instance_attribute' instead")
37
+ Fog::Logger.deprecation("modify_instance_attributes method is deprecated, use 'modify_instance_attribute' instead")
38
38
  modify_instance_attribute(instance_id, attributes)
39
39
  end
40
40
 
@@ -37,7 +37,7 @@ module Fog
37
37
 
38
38
  # Need to implement filters in the mock to find this there instead of here
39
39
  # Also there's no information about what to do when the specified reserved_instances_offering_id doesn't exist
40
- raise unless reserved_instance_offering = Compute[:aws].describe_reserved_instances_offerings.body["reservedInstancesOfferingsSet"].find { |offering| offering["reservedInstancesOfferingId"] == reserved_instances_offering_id }
40
+ raise unless reserved_instance_offering = describe_reserved_instances_offerings.body["reservedInstancesOfferingsSet"].find { |offering| offering["reservedInstancesOfferingId"] == reserved_instances_offering_id }
41
41
 
42
42
  reserved_instances_id = Fog::AWS::Mock.reserved_instances_id
43
43
  reserved_instance_offering.delete('reservedInstancesOfferingId')
@@ -86,7 +86,6 @@ module Fog
86
86
  'rootDeviceName' => '',
87
87
  'blockDeviceMapping' => [],
88
88
  'virtualizationType' => 'paravirtual',
89
- 'tagSet' => {},
90
89
  'hypervisor' => 'xen',
91
90
  'registered' => Time.now
92
91
  }
@@ -8,15 +8,28 @@ module Fog
8
8
  # Remove permissions from a security group
9
9
  #
10
10
  # ==== Parameters
11
- # * 'GroupName'<~String> - Name of group
11
+ # * group_name<~String> - Name of group
12
12
  # * options<~Hash>:
13
13
  # * 'SourceSecurityGroupName'<~String> - Name of security group to authorize
14
14
  # * 'SourceSecurityGroupOwnerId'<~String> - Name of owner to authorize
15
15
  # or
16
- # * 'CidrIp' - CIDR range
17
- # * 'FromPort' - Start of port range (or -1 for ICMP wildcard)
18
- # * 'IpProtocol' - Ip protocol, must be in ['tcp', 'udp', 'icmp']
19
- # * 'ToPort' - End of port range (or -1 for ICMP wildcard)
16
+ # * 'CidrIp'<~String> - CIDR range
17
+ # * 'FromPort'<~Integer> - Start of port range (or -1 for ICMP wildcard)
18
+ # * 'IpProtocol'<~String> - Ip protocol, must be in ['tcp', 'udp', 'icmp']
19
+ # * 'ToPort'<~Integer> - End of port range (or -1 for ICMP wildcard)
20
+ # or
21
+ # * 'IpPermissions'<~Array>:
22
+ # * permission<~Hash>:
23
+ # * 'FromPort'<~Integer> - Start of port range (or -1 for ICMP wildcard)
24
+ # * 'Groups'<~Array>:
25
+ # * group<~Hash>:
26
+ # * 'GroupName'<~String> - Name of security group to authorize
27
+ # * 'UserId'<~String> - Name of owner to authorize
28
+ # * 'IpProtocol'<~String> - Ip protocol, must be in ['tcp', 'udp', 'icmp']
29
+ # * 'IpRanges'<~Array>:
30
+ # * ip_range<~Hash>:
31
+ # * 'CidrIp'<~String> - CIDR range
32
+ # * 'ToPort'<~Integer> - End of port range (or -1 for ICMP wildcard)
20
33
  #
21
34
  # === Returns
22
35
  # * response<~Excon::Response>:
@@ -27,10 +40,15 @@ module Fog
27
40
  # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html]
28
41
  def revoke_security_group_ingress(group_name, options = {})
29
42
  if group_name.is_a?(Hash)
30
- Fog::Logger.warning("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
43
+ Fog::Logger.deprecation("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
31
44
  options = group_name
32
- group_name = options['GroupName']
45
+ group_name = options.delete('GroupName')
46
+ end
47
+
48
+ if ip_permissions = options.delete('IpPermissions')
49
+ options.merge!(indexed_ip_permissions_params(ip_permissions))
33
50
  end
51
+
34
52
  request({
35
53
  'Action' => 'RevokeSecurityGroupIngress',
36
54
  'GroupName' => group_name,
@@ -45,36 +63,30 @@ module Fog
45
63
 
46
64
  def revoke_security_group_ingress(group_name, options = {})
47
65
  if group_name.is_a?(Hash)
48
- Fog::Logger.warning("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
66
+ Fog::Logger.deprecation("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]")
49
67
  options = group_name
50
- group_name = options['GroupName']
68
+ group_name = options.delete('GroupName')
51
69
  end
70
+
71
+ verify_permission_options(options)
72
+
52
73
  response = Excon::Response.new
53
74
  group = self.data[:security_groups][group_name]
75
+
54
76
  if group
55
- if source_group_name = options['SourceSecurityGroupName']
56
- group['ipPermissions'].delete_if do |permission|
57
- if source_owner_id = options['SourceSecurityGroupOwnerId']
58
- permission['groups'].first['groupName'] == source_group_name && permission['groups'].first['userId'] == source_owner_id
59
- else
60
- permission['groups'].first['groupName'] == source_group_name
77
+ normalized_permissions = normalize_permissions(options)
78
+
79
+ normalized_permissions.each do |permission|
80
+ if matching_permission = find_matching_permission(group, permission)
81
+ matching_permission['ipRanges'] -= permission['ipRanges']
82
+ matching_permission['groups'] -= permission['groups']
83
+
84
+ if matching_permission['ipRanges'].empty? && matching_permission['groups'].empty?
85
+ group['ipPermissions'].delete(matching_permission)
61
86
  end
62
87
  end
63
- else
64
- ingress = group['ipPermissions'].select {|permission|
65
- permission['fromPort'] == options['FromPort'] &&
66
- permission['ipProtocol'] == options['IpProtocol'] &&
67
- permission['toPort'] == options['ToPort'] &&
68
- (
69
- permission['ipRanges'].empty? ||
70
- (
71
- permission['ipRanges'].first &&
72
- permission['ipRanges'].first['cidrIp'] == options['CidrIp']
73
- )
74
- )
75
- }.first
76
- group['ipPermissions'].delete(ingress)
77
88
  end
89
+
78
90
  response.status = 200
79
91
  response.body = {
80
92
  'requestId' => Fog::AWS::Mock.request_id,
@@ -157,8 +157,7 @@ module Fog
157
157
  'ownerId' => self.data[:owner_id],
158
158
  'privateIpAddress' => nil,
159
159
  'reservationId' => reservation_id,
160
- 'stateReason' => {},
161
- 'tagSet' => {}
160
+ 'stateReason' => {}
162
161
  })
163
162
  end
164
163
  response.body = {
@@ -56,7 +56,7 @@ module Fog
56
56
 
57
57
  raise Fog::AWS::ELB::IdentifierTaken if self.data[:load_balancers].has_key? lb_name
58
58
 
59
- certificate_ids = Fog::AWS::IAM.new.list_server_certificates.body['Certificates'].collect { |c| c['Arn'] }
59
+ certificate_ids = Fog::AWS::IAM::Mock.data[@aws_access_key_id][:server_certificates].map {|n, c| c['Arn'] }
60
60
 
61
61
  listeners = [*listeners].map do |listener|
62
62
  if listener['SSLCertificateId'] and !certificate_ids.include? listener['SSLCertificateId']
@@ -52,7 +52,7 @@ module Fog
52
52
  if load_balancer = self.data[:load_balancers][lb_name]
53
53
  response = Excon::Response.new
54
54
 
55
- certificate_ids = Fog::AWS::IAM.new.list_server_certificates.body['Certificates'].collect { |c| c['Arn'] }
55
+ certificate_ids = Fog::AWS::IAM::Mock.data[@aws_access_key_id][:server_certificates].map {|n, c| c['Arn'] }
56
56
 
57
57
  listeners.each do |listener|
58
58
  if listener['SSLCertificateId'] and !certificate_ids.include? listener['SSLCertificateId']
@@ -37,7 +37,7 @@ module Fog
37
37
  raise Fog::AWS::ELB::NotFound unless load_balancer = self.data[:load_balancers][lb_name]
38
38
  instance_ids = [*instance_ids]
39
39
  instance_ids.each do |instance|
40
- raise Fog::AWS::ELB::InvalidInstance unless Compute[:aws].servers.get(instance)
40
+ raise Fog::AWS::ELB::InvalidInstance unless Fog::Compute::AWS::Mock.data[@region][@aws_access_key_id][:instances][instance]
41
41
  end
42
42
 
43
43
  response = Excon::Response.new
@@ -40,13 +40,13 @@ module Fog
40
40
  instance_ids = [*instance_ids]
41
41
  instance_ids = load_balancer['Instances'].collect { |i| i['InstanceId'] } unless instance_ids.any?
42
42
  data = instance_ids.map do |id|
43
- unless instance = Compute[:aws].servers.get(id)
43
+ unless Fog::Compute::AWS::Mock.data[@region][@aws_access_key_id][:instances][id]
44
44
  raise Fog::AWS::ELB::InvalidInstance
45
45
  end
46
46
 
47
47
  {
48
48
  'Description' => "",
49
- 'InstanceId' => instance.id,
49
+ 'InstanceId' => id,
50
50
  'ReasonCode' => "",
51
51
  'State' => 'OutOfService'
52
52
  }
@@ -59,10 +59,10 @@ module Fog
59
59
  lb_names.map do |lb_name|
60
60
  lb = self.data[:load_balancers].find { |name, data| name == lb_name }
61
61
  raise Fog::AWS::ELB::NotFound unless lb
62
- lb[1]
62
+ lb[1].dup
63
63
  end.compact
64
64
  else
65
- self.data[:load_balancers].values
65
+ self.data[:load_balancers].map { |lb, values| values.dup }
66
66
  end
67
67
 
68
68
  response = Excon::Response.new
@@ -73,7 +73,7 @@ module Fog
73
73
  'RequestId' => Fog::AWS::Mock.request_id
74
74
  },
75
75
  'DescribeLoadBalancersResult' => {
76
- 'LoadBalancerDescriptions' => load_balancers
76
+ 'LoadBalancerDescriptions' => load_balancers.map { |lb| lb['Instances'] = lb['Instances'].map { |i| i['InstanceId'] }; lb }
77
77
  }
78
78
  }
79
79
 
@@ -37,14 +37,14 @@ module Fog
37
37
  raise Fog::AWS::ELB::NotFound unless load_balancer = self.data[:load_balancers][lb_name]
38
38
  instance_ids = [*instance_ids]
39
39
  instances = instance_ids.map do |instance|
40
- raise Fog::AWS::ELB::InvalidInstance unless Compute[:aws].servers.get(instance)
40
+ raise Fog::AWS::ELB::InvalidInstance unless Fog::Compute::AWS::Mock.data[@region][@aws_access_key_id][:instances][instance]
41
41
  {'InstanceId' => instance}
42
42
  end
43
43
 
44
44
  response = Excon::Response.new
45
45
  response.status = 200
46
46
 
47
- load_balancer['Instances'] = instances.dup
47
+ load_balancer['Instances'] = load_balancer['Instances'] | instances.dup
48
48
 
49
49
  response.body = {
50
50
  'ResponseMetadata' => {
@@ -0,0 +1,46 @@
1
+ module Fog
2
+ module AWS
3
+ class EMR
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/emr/add_instance_groups'
7
+
8
+ # adds an instance group to a running cluster
9
+ # http://docs.amazonwebservices.com/ElasticMapReduce/latest/API/API_AddInstanceGroups.html
10
+ # ==== Parameters
11
+ # * JobFlowId <~String> - Job flow in which to add the instance groups
12
+ # * InstanceGroups<~Array> - Instance Groups to add
13
+ # * 'BidPrice'<~String> - Bid price for each Amazon EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD.
14
+ # * 'InstanceCount'<~Integer> - Target number of instances for the instance group
15
+ # * 'InstanceRole'<~String> - MASTER | CORE | TASK The role of the instance group in the cluster
16
+ # * 'InstanceType'<~String> - The Amazon EC2 instance type for all instances in the instance group
17
+ # * 'MarketType'<~String> - ON_DEMAND | SPOT Market type of the Amazon EC2 instances used to create a cluster node
18
+ # * 'Name'<~String> - Friendly name given to the instance group.
19
+ #
20
+ # ==== Returns
21
+ # * response<~Excon::Response>:
22
+ # * body<~Hash>:
23
+ def add_instance_groups(job_flow_id, options={})
24
+
25
+ if instance_groups = options.delete('InstanceGroups')
26
+ options.merge!(Fog::AWS.indexed_param('InstanceGroups.member.%d', [*instance_groups]))
27
+ end
28
+
29
+ request({
30
+ 'Action' => 'AddInstanceGroups',
31
+ 'JobFlowId' => job_flow_id,
32
+ :parser => Fog::Parsers::AWS::EMR::AddInstanceGroups.new,
33
+ }.merge(options))
34
+ end
35
+
36
+ end
37
+
38
+ class Mock
39
+ def add_instance_groups(job_flow_id, options={})
40
+ Fog::Mock.not_implemented
41
+ end
42
+
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,49 @@
1
+ module Fog
2
+ module AWS
3
+ class EMR
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/emr/add_job_flow_steps'
7
+
8
+ # adds new steps to a running job flow.
9
+ # http://docs.amazonwebservices.com/ElasticMapReduce/latest/API/API_AddJobFlowSteps.html
10
+ # ==== Parameters
11
+ # * JobFlowId <~String> - A string that uniquely identifies the job flow
12
+ # * Steps <~Array> - A list of steps to be executed by the job flow
13
+ # * 'ActionOnFailure'<~String> - TERMINATE_JOB_FLOW | CANCEL_AND_WAIT | CONTINUE Specifies the action to take if the job flow step fails
14
+ # * 'HadoopJarStep'<~Array> - Specifies the JAR file used for the job flow step
15
+ # * 'Args'<~String list> - A list of command line arguments passed to the JAR file's main function when executed.
16
+ # * 'Jar'<~String> - A path to a JAR file run during the step.
17
+ # * 'MainClass'<~String> - The name of the main class in the specified Java file. If not specified, the JAR file should specify a Main-Class in its manifest file
18
+ # * 'Properties'<~Array> - A list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function
19
+ # * 'Key'<~String> - The unique identifier of a key value pair
20
+ # * 'Value'<~String> - The value part of the identified key
21
+ # * 'Name'<~String> - The name of the job flow step
22
+ #
23
+ # ==== Returns
24
+ # * response<~Excon::Response>:
25
+ # * body<~Hash>:
26
+ def add_job_flow_steps(job_flow_id, options={})
27
+
28
+ if steps = options.delete('Steps')
29
+ options.merge!(Fog::AWS.serialize_keys('Steps', steps))
30
+ end
31
+
32
+ request({
33
+ 'Action' => 'AddJobFlowSteps',
34
+ 'JobFlowId' => job_flow_id,
35
+ :parser => Fog::Parsers::AWS::EMR::AddJobFlowSteps.new,
36
+ }.merge(options))
37
+ end
38
+ end
39
+
40
+ class Mock
41
+
42
+ def add_job_flow_steps(db_name, options={})
43
+ Fog::Mock.not_implemented
44
+ end
45
+
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,108 @@
1
+ module Fog
2
+ module AWS
3
+ class EMR
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/emr/describe_job_flows'
7
+
8
+ # returns a list of job flows that match all of the supplied parameters.
9
+ # http://docs.amazonwebservices.com/ElasticMapReduce/latest/API/API_DescribeJobFlows.html
10
+ # ==== Parameters
11
+ # * CreatedAfter <~DateTime> - Return only job flows created after this date and time
12
+ # * CreatedBefore <~DateTime> - Return only job flows created before this date and time
13
+ # * JobFlowIds <~String list> - Return only job flows whose job flow ID is contained in this list
14
+ # * JobFlowStates <~String list> - RUNNING | WAITING | SHUTTING_DOWN | STARTING Return only job flows whose state is contained in this list
15
+ #
16
+ # ==== Returns
17
+ # * response<~Excon::Response>:
18
+ # * body<~Hash>:
19
+ # * JobFlows <~Array> - A list of job flows matching the parameters supplied.
20
+ # * AmiVersion <~String> - A list of bootstrap actions that will be run before Hadoop is started on the cluster nodes.
21
+ # * 'BootstrapActions'<~Array> - A list of the bootstrap actions run by the job flow
22
+ # * 'BootstrapConfig <~Array> - A description of the bootstrap action
23
+ # * 'Name' <~String> - The name of the bootstrap action
24
+ # * 'ScriptBootstrapAction' <~Array> - The script run by the bootstrap action.
25
+ # * 'Args' <~String list> - A list of command line arguments to pass to the bootstrap action script.
26
+ # * 'Path' <~String> - Location of the script to run during a bootstrap action.
27
+ # * 'ExecutionStatusDetail'<~Array> - Describes the execution status of the job flow
28
+ # * 'CreationDateTime <~DateTime> - The creation date and time of the job flow.
29
+ # * 'EndDateTime <~DateTime> - The completion date and time of the job flow.
30
+ # * 'LastStateChangeReason <~String> - Description of the job flow last changed state.
31
+ # * 'ReadyDateTime <~DateTime> - The date and time when the job flow was ready to start running bootstrap actions.
32
+ # * 'StartDateTime <~DateTime> - The start date and time of the job flow.
33
+ # * 'State <~DateTime> - COMPLETED | FAILED | TERMINATED | RUNNING | SHUTTING_DOWN | STARTING | WAITING | BOOTSTRAPPING The state of the job flow.
34
+ # * Instances <~Array> - A specification of the number and type of Amazon EC2 instances on which to run the job flow.
35
+ # * 'Ec2KeyName'<~String> - Specifies the name of the Amazon EC2 key pair that can be used to ssh to the master node as the user called "hadoop.
36
+ # * 'HadoopVersion'<~String> - "0.18" | "0.20" Specifies the Hadoop version for the job flow
37
+ # * 'InstanceCount'<~Integer> - The number of Amazon EC2 instances used to execute the job flow
38
+ # * 'InstanceGroups'<~Array> - Configuration for the job flow's instance groups
39
+ # * 'BidPrice' <~String> - Bid price for each Amazon EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD.
40
+ # * 'CreationDateTime' <~DateTime> - The date/time the instance group was created.
41
+ # * 'EndDateTime' <~DateTime> - The date/time the instance group was terminated.
42
+ # * 'InstanceGroupId' <~String> - Unique identifier for the instance group.
43
+ # * 'InstanceRequestCount'<~Integer> - Target number of instances for the instance group
44
+ # * 'InstanceRole'<~String> - MASTER | CORE | TASK The role of the instance group in the cluster
45
+ # * 'InstanceRunningCount'<~Integer> - Actual count of running instances
46
+ # * 'InstanceType'<~String> - The Amazon EC2 instance type for all instances in the instance group
47
+ # * 'LastStateChangeReason'<~String> - Details regarding the state of the instance group
48
+ # * 'Market'<~String> - ON_DEMAND | SPOT Market type of the Amazon EC2 instances used to create a cluster
49
+ # * 'Name'<~String> - Friendly name for the instance group
50
+ # * 'ReadyDateTime'<~DateTime> - The date/time the instance group was available to the cluster
51
+ # * 'StartDateTime'<~DateTime> - The date/time the instance group was started
52
+ # * 'State'<~String> - PROVISIONING | STARTING | BOOTSTRAPPING | RUNNING | RESIZING | ARRESTED | SHUTTING_DOWN | TERMINATED | FAILED | ENDED State of instance group
53
+ # * 'KeepJobFlowAliveWhenNoSteps' <~Boolean> - Specifies whether the job flow should terminate after completing all steps
54
+ # * 'MasterInstanceId'<~String> - The Amazon EC2 instance identifier of the master node
55
+ # * 'MasterInstanceType'<~String> - The EC2 instance type of the master node
56
+ # * 'MasterPublicDnsName'<~String> - The DNS name of the master node
57
+ # * 'NormalizedInstanceHours'<~Integer> - An approximation of the cost of the job flow, represented in m1.small/hours.
58
+ # * 'Placement'<~Array> - Specifies the Availability Zone the job flow will run in
59
+ # * 'AvailabilityZone' <~String> - The Amazon EC2 Availability Zone for the job flow.
60
+ # * 'SlaveInstanceType'<~String> - The EC2 instance type of the slave nodes
61
+ # * 'TerminationProtected'<~Boolean> - Specifies whether to lock the job flow to prevent the Amazon EC2 instances from being terminated by API call, user intervention, or in the event of a job flow error
62
+ # * LogUri <~String> - Specifies the location in Amazon S3 to write the log files of the job flow. If a value is not provided, logs are not created
63
+ # * Name <~String> - The name of the job flow
64
+ # * Steps <~Array> - A list of steps to be executed by the job flow
65
+ # * 'ExecutionStatusDetail'<~Array> - Describes the execution status of the job flow
66
+ # * 'CreationDateTime <~DateTime> - The creation date and time of the job flow.
67
+ # * 'EndDateTime <~DateTime> - The completion date and time of the job flow.
68
+ # * 'LastStateChangeReason <~String> - Description of the job flow last changed state.
69
+ # * 'ReadyDateTime <~DateTime> - The date and time when the job flow was ready to start running bootstrap actions.
70
+ # * 'StartDateTime <~DateTime> - The start date and time of the job flow.
71
+ # * 'State <~DateTime> - COMPLETED | FAILED | TERMINATED | RUNNING | SHUTTING_DOWN | STARTING | WAITING | BOOTSTRAPPING The state of the job flow.
72
+ # * StepConfig <~Array> - The step configuration
73
+ # * 'ActionOnFailure'<~String> - TERMINATE_JOB_FLOW | CANCEL_AND_WAIT | CONTINUE Specifies the action to take if the job flow step fails
74
+ # * 'HadoopJarStep'<~Array> - Specifies the JAR file used for the job flow step
75
+ # * 'Args'<~String list> - A list of command line arguments passed to the JAR file's main function when executed.
76
+ # * 'Jar'<~String> - A path to a JAR file run during the step.
77
+ # * 'MainClass'<~String> - The name of the main class in the specified Java file. If not specified, the JAR file should specify a Main-Class in its manifest file
78
+ # * 'Properties'<~Array> - A list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function
79
+ # * 'Key'<~String> - The unique identifier of a key value pair
80
+ # * 'Value'<~String> - The value part of the identified key
81
+ # * 'Name'<~String> - The name of the job flow step
82
+ def describe_job_flows(options={})
83
+
84
+ if job_ids = options.delete('JobFlowIds')
85
+ options.merge!(Fog::AWS.serialize_keys('JobFlowIds', job_ids))
86
+ end
87
+
88
+ if job_states = options.delete('JobFlowStates')
89
+ options.merge!(Fog::AWS.serialize_keys('JobFlowStates', job_states))
90
+ end
91
+
92
+ request({
93
+ 'Action' => 'DescribeJobFlows',
94
+ :parser => Fog::Parsers::AWS::EMR::DescribeJobFlows.new,
95
+ }.merge(options))
96
+ end
97
+ end
98
+
99
+ class Mock
100
+
101
+ def describe_job_flows(db_name, options={})
102
+ Fog::Mock.not_implemented
103
+ end
104
+
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,40 @@
1
+ module Fog
2
+ module AWS
3
+ class EMR
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/emr/modify_instance_groups'
7
+
8
+ # modifies the number of nodes and configuration settings of an instance group..
9
+ # http://docs.amazonwebservices.com/ElasticMapReduce/latest/API/API_ModifyInstanceGroups.html
10
+ # ==== Parameters
11
+ # * InstanceGroups <~InstanceGroupModifyConfig list> - Instance groups to change
12
+ # * InstanceCount <~Integer> - Target size for instance group
13
+ # * InstanceGroupId <~String> - Unique ID of the instance group to expand or shrink
14
+ #
15
+ # ==== Returns
16
+ # * response<~Excon::Response>:
17
+ # * body<~Hash>
18
+ def modify_instance_groups(options={})
19
+
20
+ if job_ids = options.delete('InstanceGroups')
21
+ options.merge!(Fog::AWS.serialize_keys('InstanceGroups', job_ids))
22
+ end
23
+
24
+ request({
25
+ 'Action' => 'ModifyInstanceGroups',
26
+ :parser => Fog::Parsers::AWS::EMR::ModifyInstanceGroups.new,
27
+ }.merge(options))
28
+ end
29
+ end
30
+
31
+ class Mock
32
+
33
+ def modify_instance_groups(options={})
34
+ Fog::Mock.not_implemented
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+ end