fog 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -13,14 +13,56 @@ Shindo.tests('Fog::Compute[:aws] | tag requests', ['aws']) do
|
|
13
13
|
@volume.wait_for { ready? }
|
14
14
|
|
15
15
|
tests('success') do
|
16
|
+
if Fog.mocking?
|
17
|
+
@other_account = Fog::Compute::AWS.new(:aws_access_key_id => 'other', :aws_secret_access_key => 'account')
|
18
|
+
@image_id = Fog::Compute[:aws].register_image('image', 'image', '/dev/sda1').body['imageId']
|
19
|
+
end
|
20
|
+
|
16
21
|
tests("#create_tags('#{@volume.identity}', 'foo' => 'bar')").formats(AWS::Compute::Formats::BASIC) do
|
17
22
|
Fog::Compute[:aws].create_tags(@volume.identity, 'foo' => 'bar').body
|
18
23
|
end
|
19
24
|
|
25
|
+
if Fog.mocking?
|
26
|
+
tests("#create_tags('#{@image_id}', 'foo' => 'baz')").formats(AWS::Compute::Formats::BASIC) do
|
27
|
+
Fog::Compute[:aws].create_tags(@image_id, 'foo' => 'baz').body
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
20
31
|
tests('#describe_tags').formats(@tags_format) do
|
21
32
|
Fog::Compute[:aws].describe_tags.body
|
22
33
|
end
|
23
34
|
|
35
|
+
expected_identities = Fog.mocking? ? [@volume.identity, @image_id] : [@volume.identity]
|
36
|
+
tests('#describe_tags').succeeds do
|
37
|
+
(expected_identities - Fog::Compute[:aws].describe_tags.body['tagSet'].map {|t| t['resourceId'] }).empty?
|
38
|
+
end
|
39
|
+
|
40
|
+
tests("#describe_tags('key' => 'foo', 'value' => 'bar')").returns([@volume.identity]) do
|
41
|
+
Fog::Compute[:aws].describe_tags('key' => 'foo', 'value' => 'bar').body['tagSet'].map {|t| t['resourceId'] }
|
42
|
+
end
|
43
|
+
|
44
|
+
if Fog.mocking?
|
45
|
+
tests("#describe_tags('key' => 'foo', 'value' => 'baz')").returns([@image_id]) do
|
46
|
+
Fog::Compute[:aws].describe_tags('key' => 'foo', 'value' => 'baz').body['tagSet'].map {|t| t['resourceId'] }
|
47
|
+
end
|
48
|
+
|
49
|
+
Fog::Compute[:aws].modify_image_attribute(@image_id, 'Add.UserId' => [@other_account.data[:owner_id]])
|
50
|
+
|
51
|
+
tests("other_account#describe_tags('key' => 'foo', 'value' => 'baz')").returns([]) do
|
52
|
+
@other_account.describe_tags('key' => 'foo', 'value' => 'baz').body['tagSet'].map {|t| t['resourceId'] }
|
53
|
+
end
|
54
|
+
|
55
|
+
tests("other_account#create_tags('#{@image_id}', 'foo' => 'quux')").formats(AWS::Compute::Formats::BASIC) do
|
56
|
+
@other_account.create_tags(@image_id, 'foo' => 'quux').body
|
57
|
+
end
|
58
|
+
|
59
|
+
tests("other_account#describe_tags('key' => 'foo', 'value' => 'quux')").returns([@image_id]) do
|
60
|
+
@other_account.describe_tags('key' => 'foo', 'value' => 'quux').body['tagSet'].map {|t| t['resourceId'] }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
@volume.destroy
|
65
|
+
|
24
66
|
tests("#delete_tags('#{@volume.identity}', 'foo' => 'bar')").formats(AWS::Compute::Formats::BASIC) do
|
25
67
|
Fog::Compute[:aws].delete_tags(@volume.identity, 'foo' => 'bar').body
|
26
68
|
end
|
@@ -32,6 +74,4 @@ Shindo.tests('Fog::Compute[:aws] | tag requests', ['aws']) do
|
|
32
74
|
end
|
33
75
|
|
34
76
|
end
|
35
|
-
|
36
|
-
@volume.destroy
|
37
77
|
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
class AWS
|
2
|
+
|
3
|
+
module EMR
|
4
|
+
|
5
|
+
module Formats
|
6
|
+
BASIC = {
|
7
|
+
'RequestId' => String
|
8
|
+
}
|
9
|
+
|
10
|
+
RUN_JOB_FLOW = BASIC.merge({
|
11
|
+
'JobFlowId' => String
|
12
|
+
})
|
13
|
+
|
14
|
+
ADD_INSTANCE_GROUPS = {
|
15
|
+
'JobFlowId' => String,
|
16
|
+
'InstanceGroupIds' => Array
|
17
|
+
}
|
18
|
+
|
19
|
+
SIMPLE_DESCRIBE_JOB_FLOW = {
|
20
|
+
'JobFlows' => [{
|
21
|
+
'Name' => String,
|
22
|
+
'BootstrapActions' => {
|
23
|
+
'ScriptBootstrapActionConfig' => {
|
24
|
+
'Args' => Array
|
25
|
+
}
|
26
|
+
},
|
27
|
+
'ExecutionStatusDetail' => {
|
28
|
+
'CreationDateTime' => String,
|
29
|
+
'State' => String,
|
30
|
+
'LastStateChangeReason' => String
|
31
|
+
},
|
32
|
+
'Steps' => [{
|
33
|
+
'ActionOnFailure' => String,
|
34
|
+
'Name' => String,
|
35
|
+
'StepConfig' => {
|
36
|
+
'HadoopJarStepConfig' => {
|
37
|
+
'MainClass' => String,
|
38
|
+
'Jar' => String,
|
39
|
+
'Args' => Array,
|
40
|
+
'Properties' => Array
|
41
|
+
}
|
42
|
+
},
|
43
|
+
'ExecutionStatusDetail' => {
|
44
|
+
'CreationDateTime' => String,
|
45
|
+
'State' => String
|
46
|
+
}
|
47
|
+
}],
|
48
|
+
'JobFlowId' => String,
|
49
|
+
'Instances' => {
|
50
|
+
'InstanceCount' => String,
|
51
|
+
'NormalizedInstanceHours' => String,
|
52
|
+
'KeepJobFlowAliveWhenNoSteps' => String,
|
53
|
+
'Placement' => {
|
54
|
+
'AvailabilityZone' => String
|
55
|
+
},
|
56
|
+
'MasterInstanceType' => String,
|
57
|
+
'SlaveInstanceType' => String,
|
58
|
+
'InstanceGroups' => Array,
|
59
|
+
'TerminationProtected' => String,
|
60
|
+
'HadoopVersion' => String
|
61
|
+
}
|
62
|
+
}]
|
63
|
+
}
|
64
|
+
|
65
|
+
JOB_FLOW_WITHOUT_CHANGE = {
|
66
|
+
'JobFlows' => [{
|
67
|
+
'Name' => String,
|
68
|
+
'BootstrapActions' => {
|
69
|
+
'ScriptBootstrapActionConfig' => {
|
70
|
+
'Args' => Array
|
71
|
+
}
|
72
|
+
},
|
73
|
+
'ExecutionStatusDetail' => {
|
74
|
+
'CreationDateTime' => String,
|
75
|
+
'State' => String,
|
76
|
+
'LastStateChangeReason' => NilClass
|
77
|
+
},
|
78
|
+
'Steps' => [{
|
79
|
+
'ActionOnFailure' => String,
|
80
|
+
'Name' => String,
|
81
|
+
'StepConfig' => {
|
82
|
+
'HadoopJarStepConfig' => {
|
83
|
+
'MainClass' => String,
|
84
|
+
'Jar' => String,
|
85
|
+
'Args' => Array,
|
86
|
+
'Properties' => Array
|
87
|
+
}
|
88
|
+
},
|
89
|
+
'ExecutionStatusDetail' => {
|
90
|
+
'CreationDateTime' => String,
|
91
|
+
'State' => String
|
92
|
+
}
|
93
|
+
}],
|
94
|
+
'JobFlowId' => String,
|
95
|
+
'Instances' => {
|
96
|
+
'InstanceCount' => String,
|
97
|
+
'NormalizedInstanceHours' => String,
|
98
|
+
'KeepJobFlowAliveWhenNoSteps' => String,
|
99
|
+
'Placement' => {
|
100
|
+
'AvailabilityZone' => String
|
101
|
+
},
|
102
|
+
'MasterInstanceType' => String,
|
103
|
+
'SlaveInstanceType' => String,
|
104
|
+
'InstanceGroups' => Array,
|
105
|
+
'TerminationProtected' => String,
|
106
|
+
'HadoopVersion' => String
|
107
|
+
}
|
108
|
+
}]
|
109
|
+
}
|
110
|
+
|
111
|
+
DESCRIBE_JOB_FLOW_WITH_INSTANCE_GROUPS = {
|
112
|
+
'JobFlows' => [{
|
113
|
+
'Name' => String,
|
114
|
+
'BootstrapActions' => {
|
115
|
+
'ScriptBootstrapActionConfig' => {
|
116
|
+
'Args' => Array
|
117
|
+
}
|
118
|
+
},
|
119
|
+
'ExecutionStatusDetail' => {
|
120
|
+
'CreationDateTime' => String,
|
121
|
+
'State' => String,
|
122
|
+
'LastStateChangeReason' => NilClass
|
123
|
+
},
|
124
|
+
'Steps' => [{
|
125
|
+
'ActionOnFailure' => String,
|
126
|
+
'Name' => String,
|
127
|
+
'StepConfig' => {
|
128
|
+
'HadoopJarStepConfig' => {
|
129
|
+
'MainClass' => String,
|
130
|
+
'Jar' => String,
|
131
|
+
'Args' => Array,
|
132
|
+
'Properties' => Array
|
133
|
+
}
|
134
|
+
},
|
135
|
+
'ExecutionStatusDetail' => {
|
136
|
+
'CreationDateTime' => String,
|
137
|
+
'State' => String
|
138
|
+
}
|
139
|
+
}],
|
140
|
+
'JobFlowId' => String,
|
141
|
+
'Instances' => {
|
142
|
+
'InstanceCount' => String,
|
143
|
+
'NormalizedInstanceHours' => String,
|
144
|
+
'KeepJobFlowAliveWhenNoSteps' => String,
|
145
|
+
'Placement' => {
|
146
|
+
'AvailabilityZone' => String
|
147
|
+
},
|
148
|
+
'InstanceGroups' => [{
|
149
|
+
'Name' => String,
|
150
|
+
'InstanceRole' => String,
|
151
|
+
'CreationDateTime' => String,
|
152
|
+
'LastStateChangeReason' => nil,
|
153
|
+
'InstanceGroupId' => String,
|
154
|
+
'Market' => String,
|
155
|
+
'InstanceType' => String,
|
156
|
+
'State' => String,
|
157
|
+
'InstanceRunningCount' => String,
|
158
|
+
'InstanceRequestCount' => String
|
159
|
+
}],
|
160
|
+
'MasterInstanceType' => String,
|
161
|
+
'SlaveInstanceType' => String,
|
162
|
+
'InstanceGroups' => Array,
|
163
|
+
'TerminationProtected' => String,
|
164
|
+
'HadoopVersion' => String
|
165
|
+
}
|
166
|
+
}]
|
167
|
+
}
|
168
|
+
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
Shindo.tests('AWS::EMR | instance groups', ['aws', 'emr']) do
|
2
|
+
|
3
|
+
pending if Fog.mocking?
|
4
|
+
|
5
|
+
@job_flow_name = "fog_job_flow_#{Time.now.to_f.to_s.gsub('.','')}"
|
6
|
+
|
7
|
+
@job_flow_options = {
|
8
|
+
'Instances' => {
|
9
|
+
'MasterInstanceType' => 'm1.small',
|
10
|
+
'SlaveInstanceType' => 'm1.small',
|
11
|
+
'InstanceCount' => 2,
|
12
|
+
'Placement' => {
|
13
|
+
'AvailabilityZone' => 'us-east-1a'
|
14
|
+
},
|
15
|
+
'KeepJobFlowAliveWhenNoSteps' => false,
|
16
|
+
'TerminationProtected' => false,
|
17
|
+
'HadoopVersion' => '0.20'
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
@job_flow_steps = {
|
22
|
+
'Steps' => [{
|
23
|
+
'Name' => 'Dummy streaming job',
|
24
|
+
'ActionOnFailure' => 'CONTINUE',
|
25
|
+
'HadoopJarStep' => {
|
26
|
+
'Jar' => '/home/hadoop/contrib/streaming/hadoop-streaming.jar',
|
27
|
+
'MainClass' => nil,
|
28
|
+
'Args' => %w(-input s3n://elasticmapreduce/samples/wordcount/input -output hdfs:///examples/output/2011-11-03T090856 -mapper s3n://elasticmapreduce/samples/wordcount/wordSplitter.py -reducer aggregate)
|
29
|
+
}
|
30
|
+
}]
|
31
|
+
}
|
32
|
+
|
33
|
+
@instance_group_name = "fog_instance_group_#{Time.now.to_f.to_s.gsub('.','')}"
|
34
|
+
@instance_groups = {
|
35
|
+
'InstanceGroups' => [{
|
36
|
+
'Name' => @instance_group_name,
|
37
|
+
'InstanceRole' => 'TASK',
|
38
|
+
'InstanceType' => 'm1.small',
|
39
|
+
'InstanceCount' => 2
|
40
|
+
}]
|
41
|
+
}
|
42
|
+
|
43
|
+
result = AWS[:emr].run_job_flow(@job_flow_name, @job_flow_options).body
|
44
|
+
@job_flow_id = result['JobFlowId']
|
45
|
+
|
46
|
+
tests('success') do
|
47
|
+
|
48
|
+
tests("#add_instance_groups").formats(AWS::EMR::Formats::ADD_INSTANCE_GROUPS) do
|
49
|
+
pending if Fog.mocking?
|
50
|
+
|
51
|
+
result = AWS[:emr].add_instance_groups(@job_flow_id, @instance_groups).body
|
52
|
+
|
53
|
+
@instance_group_id = result['InstanceGroupIds'].first
|
54
|
+
|
55
|
+
result
|
56
|
+
end
|
57
|
+
|
58
|
+
tests("#describe_job_flows_with_instance_groups").formats(AWS::EMR::Formats::DESCRIBE_JOB_FLOW_WITH_INSTANCE_GROUPS) do
|
59
|
+
pending if Fog.mocking?
|
60
|
+
|
61
|
+
result = AWS[:emr].describe_job_flows('JobFlowIds' => [@job_flow_id]).body
|
62
|
+
|
63
|
+
result
|
64
|
+
end
|
65
|
+
|
66
|
+
tests("#modify_instance_groups").formats(AWS::EMR::Formats::BASIC) do
|
67
|
+
pending if Fog.mocking?
|
68
|
+
|
69
|
+
# Add a step so the state doesn't go directly from STARTING to SHUTTING_DOWN
|
70
|
+
AWS[:emr].add_job_flow_steps(@job_flow_id, @job_flow_steps)
|
71
|
+
|
72
|
+
# Wait until job has started before modifying the instance group
|
73
|
+
begin
|
74
|
+
sleep 10
|
75
|
+
|
76
|
+
result = AWS[:emr].describe_job_flows('JobFlowIds' => [@job_flow_id]).body
|
77
|
+
job_flow = result['JobFlows'].first
|
78
|
+
state = job_flow['ExecutionStatusDetail']['State']
|
79
|
+
print "."
|
80
|
+
end while(state == 'STARTING')
|
81
|
+
|
82
|
+
# Check results
|
83
|
+
result = AWS[:emr].modify_instance_groups('InstanceGroups' => [{'InstanceGroupId' => @instance_group_id, 'InstanceCount' => 4}]).body
|
84
|
+
|
85
|
+
# Check the it actually modified the instance count
|
86
|
+
tests("modify worked?") do
|
87
|
+
ig_res = AWS[:emr].describe_job_flows('JobFlowIds' => [@job_flow_id]).body
|
88
|
+
|
89
|
+
matched = false
|
90
|
+
jf = ig_res['JobFlows'].first
|
91
|
+
jf['Instances']['InstanceGroups'].each do | ig |
|
92
|
+
if ig['InstanceGroupId'] == @instance_group_id
|
93
|
+
matched = true if ig['InstanceRequestCount'].to_i == 4
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
matched
|
98
|
+
end
|
99
|
+
|
100
|
+
result
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
AWS[:emr].terminate_job_flows('JobFlowIds' => [@job_flow_id])
|
106
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
Shindo.tests('AWS::EMR | job flows', ['aws', 'emr']) do
|
2
|
+
|
3
|
+
pending if Fog.mocking?
|
4
|
+
|
5
|
+
@job_flow_name = "fog_job_flow_#{Time.now.to_f.to_s.gsub('.','')}"
|
6
|
+
|
7
|
+
@job_flow_options = {
|
8
|
+
'Instances' => {
|
9
|
+
'MasterInstanceType' => 'm1.small',
|
10
|
+
'SlaveInstanceType' => 'm1.small',
|
11
|
+
'InstanceCount' => 2,
|
12
|
+
'Placement' => {
|
13
|
+
'AvailabilityZone' => 'us-east-1a'
|
14
|
+
},
|
15
|
+
'KeepJobFlowAliveWhenNoSteps' => false,
|
16
|
+
'TerminationProtected' => false,
|
17
|
+
'HadoopVersion' => '0.20'
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
@step_name = "fog_job_flow_step_#{Time.now.to_f.to_s.gsub('.','')}"
|
22
|
+
|
23
|
+
@job_flow_steps = {
|
24
|
+
'Steps' => [{
|
25
|
+
'Name' => @step_name,
|
26
|
+
'ActionOnFailure' => 'CONTINUE',
|
27
|
+
'HadoopJarStep' => {
|
28
|
+
'Jar' => 'FakeJar',
|
29
|
+
'MainClass' => 'FakeMainClass',
|
30
|
+
'Args' => ['arg1', 'arg2']
|
31
|
+
}
|
32
|
+
}]
|
33
|
+
}
|
34
|
+
|
35
|
+
@job_flow_id = nil
|
36
|
+
|
37
|
+
tests('success') do
|
38
|
+
|
39
|
+
tests("#run_job_flow").formats(AWS::EMR::Formats::RUN_JOB_FLOW) do
|
40
|
+
pending if Fog.mocking?
|
41
|
+
|
42
|
+
result = AWS[:emr].run_job_flow(@job_flow_name, @job_flow_options).body
|
43
|
+
@job_flow_id = result['JobFlowId']
|
44
|
+
|
45
|
+
result
|
46
|
+
end
|
47
|
+
|
48
|
+
tests("#add_job_flow_steps").formats(AWS::EMR::Formats::BASIC) do
|
49
|
+
pending if Fog.mocking?
|
50
|
+
|
51
|
+
result = AWS[:emr].add_job_flow_steps(@job_flow_id, @job_flow_steps).body
|
52
|
+
|
53
|
+
result
|
54
|
+
end
|
55
|
+
|
56
|
+
tests("#set_termination_protection").formats(AWS::EMR::Formats::BASIC) do
|
57
|
+
|
58
|
+
result = AWS[:emr].set_termination_protection(true, 'JobFlowIds' => [@job_flow_id]).body
|
59
|
+
|
60
|
+
test("protected?") do
|
61
|
+
res = AWS[:emr].describe_job_flows('JobFlowIds' => [@job_flow_id]).body
|
62
|
+
jf = res['JobFlows'].first
|
63
|
+
|
64
|
+
jf['Instances']['TerminationProtected'] == 'true'
|
65
|
+
end
|
66
|
+
|
67
|
+
result
|
68
|
+
end
|
69
|
+
|
70
|
+
tests("#terminate_job_flow").formats(AWS::EMR::Formats::BASIC) do
|
71
|
+
pending if Fog.mocking?
|
72
|
+
AWS[:emr].set_termination_protection(false, 'JobFlowIds' => [@job_flow_id])
|
73
|
+
|
74
|
+
result = AWS[:emr].terminate_job_flows('JobFlowIds' => [@job_flow_id]).body
|
75
|
+
|
76
|
+
result
|
77
|
+
end
|
78
|
+
|
79
|
+
tests("#describe_job_flows").formats(AWS::EMR::Formats::SIMPLE_DESCRIBE_JOB_FLOW) do
|
80
|
+
pending if Fog.mocking?
|
81
|
+
|
82
|
+
result = AWS[:emr].describe_job_flows('JobFlowIds' => [@job_flow_id]).body
|
83
|
+
|
84
|
+
result
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
@@ -1,17 +1,25 @@
|
|
1
1
|
Shindo.tests('AWS::IAM | server certificate requests', ['aws']) do
|
2
2
|
@key_name = 'fog-test'
|
3
|
+
@key_name_chained = 'fog-test-chained'
|
3
4
|
|
4
5
|
@certificate_format = {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
'Arn' => String,
|
7
|
+
'Path' => String,
|
8
|
+
'ServerCertificateId' => String,
|
9
|
+
'ServerCertificateName' => String,
|
10
|
+
'UploadDate' => Time
|
10
11
|
}
|
11
12
|
@upload_format = {
|
12
13
|
'Certificate' => @certificate_format,
|
13
14
|
'RequestId' => String
|
14
15
|
}
|
16
|
+
@get_server_certificate_format = {
|
17
|
+
'Certificate' => @certificate_format,
|
18
|
+
'RequestId' => String
|
19
|
+
}
|
20
|
+
@list_format = {
|
21
|
+
'Certificates' => [@certificate_format]
|
22
|
+
}
|
15
23
|
|
16
24
|
tests('#upload_server_certificate') do
|
17
25
|
public_key = AWS::IAM::SERVER_CERT_PUBLIC_KEY
|
@@ -42,19 +50,22 @@ Shindo.tests('AWS::IAM | server certificate requests', ['aws']) do
|
|
42
50
|
Fog::AWS::IAM.new.upload_server_certificate(public_key, private_key, @key_name).body
|
43
51
|
end
|
44
52
|
|
53
|
+
tests('format with chain').formats(@upload_format) do
|
54
|
+
Fog::AWS::IAM.new.upload_server_certificate(public_key, private_key, @key_name_chained, { 'CertificateChain' => public_key }).body
|
55
|
+
end
|
56
|
+
|
45
57
|
tests('duplicate name').raises(Fog::AWS::IAM::EntityAlreadyExists) do
|
46
58
|
Fog::AWS::IAM.new.upload_server_certificate(public_key, private_key, @key_name)
|
47
59
|
end
|
48
60
|
end
|
49
61
|
|
50
|
-
tests('#get_server_certificate').formats(@
|
62
|
+
tests('#get_server_certificate').formats(@get_server_certificate_format) do
|
51
63
|
tests('raises NotFound').raises(Fog::AWS::IAM::NotFound) do
|
52
64
|
Fog::AWS::IAM.new.get_server_certificate("#{@key_name}fake")
|
53
65
|
end
|
54
66
|
Fog::AWS::IAM.new.get_server_certificate(@key_name).body
|
55
67
|
end
|
56
68
|
|
57
|
-
@list_format = { 'Certificates' => [@certificate_format] }
|
58
69
|
tests('#list_server_certificates').formats(@list_format) do
|
59
70
|
result = Fog::AWS::IAM.new.list_server_certificates.body
|
60
71
|
tests('includes key name') do
|
@@ -74,4 +85,6 @@ Shindo.tests('AWS::IAM | server certificate requests', ['aws']) do
|
|
74
85
|
tests('#delete_server_certificate').formats(AWS::IAM::Formats::BASIC) do
|
75
86
|
Fog::AWS::IAM.new.delete_server_certificate(@key_name).body
|
76
87
|
end
|
88
|
+
|
89
|
+
Fog::AWS::IAM.new.delete_server_certificate(@key_name_chained)
|
77
90
|
end
|