fog-aws 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fog/aws.rb +2 -0
  3. data/lib/fog/aws/ecs.rb +187 -0
  4. data/lib/fog/aws/models/compute/flavors.rb +10 -0
  5. data/lib/fog/aws/parsers/ecs/base.rb +28 -0
  6. data/lib/fog/aws/parsers/ecs/container_instance.rb +75 -0
  7. data/lib/fog/aws/parsers/ecs/create_cluster.rb +30 -0
  8. data/lib/fog/aws/parsers/ecs/create_service.rb +31 -0
  9. data/lib/fog/aws/parsers/ecs/delete_cluster.rb +30 -0
  10. data/lib/fog/aws/parsers/ecs/delete_service.rb +31 -0
  11. data/lib/fog/aws/parsers/ecs/deregister_container_instance.rb +31 -0
  12. data/lib/fog/aws/parsers/ecs/deregister_task_definition.rb +32 -0
  13. data/lib/fog/aws/parsers/ecs/describe_clusters.rb +55 -0
  14. data/lib/fog/aws/parsers/ecs/describe_container_instances.rb +38 -0
  15. data/lib/fog/aws/parsers/ecs/describe_services.rb +24 -0
  16. data/lib/fog/aws/parsers/ecs/describe_task_definition.rb +32 -0
  17. data/lib/fog/aws/parsers/ecs/describe_tasks.rb +24 -0
  18. data/lib/fog/aws/parsers/ecs/list_clusters.rb +27 -0
  19. data/lib/fog/aws/parsers/ecs/list_container_instances.rb +27 -0
  20. data/lib/fog/aws/parsers/ecs/list_services.rb +27 -0
  21. data/lib/fog/aws/parsers/ecs/list_task_definition_families.rb +27 -0
  22. data/lib/fog/aws/parsers/ecs/list_task_definitions.rb +27 -0
  23. data/lib/fog/aws/parsers/ecs/list_tasks.rb +27 -0
  24. data/lib/fog/aws/parsers/ecs/register_task_definition.rb +32 -0
  25. data/lib/fog/aws/parsers/ecs/run_task.rb +24 -0
  26. data/lib/fog/aws/parsers/ecs/service.rb +82 -0
  27. data/lib/fog/aws/parsers/ecs/start_task.rb +24 -0
  28. data/lib/fog/aws/parsers/ecs/stop_task.rb +23 -0
  29. data/lib/fog/aws/parsers/ecs/task.rb +77 -0
  30. data/lib/fog/aws/parsers/ecs/task_definition.rb +95 -0
  31. data/lib/fog/aws/parsers/ecs/update_service.rb +31 -0
  32. data/lib/fog/aws/requests/compute/create_vpc.rb +1 -1
  33. data/lib/fog/aws/requests/ecs/create_cluster.rb +64 -0
  34. data/lib/fog/aws/requests/ecs/create_service.rb +118 -0
  35. data/lib/fog/aws/requests/ecs/delete_cluster.rb +61 -0
  36. data/lib/fog/aws/requests/ecs/delete_service.rb +72 -0
  37. data/lib/fog/aws/requests/ecs/deregister_container_instance.rb +63 -0
  38. data/lib/fog/aws/requests/ecs/deregister_task_definition.rb +58 -0
  39. data/lib/fog/aws/requests/ecs/describe_clusters.rb +83 -0
  40. data/lib/fog/aws/requests/ecs/describe_container_instances.rb +64 -0
  41. data/lib/fog/aws/requests/ecs/describe_services.rb +76 -0
  42. data/lib/fog/aws/requests/ecs/describe_task_definition.rb +64 -0
  43. data/lib/fog/aws/requests/ecs/describe_tasks.rb +65 -0
  44. data/lib/fog/aws/requests/ecs/list_clusters.rb +45 -0
  45. data/lib/fog/aws/requests/ecs/list_container_instances.rb +46 -0
  46. data/lib/fog/aws/requests/ecs/list_services.rb +59 -0
  47. data/lib/fog/aws/requests/ecs/list_task_definition_families.rb +56 -0
  48. data/lib/fog/aws/requests/ecs/list_task_definitions.rb +55 -0
  49. data/lib/fog/aws/requests/ecs/list_tasks.rb +50 -0
  50. data/lib/fog/aws/requests/ecs/register_task_definition.rb +68 -0
  51. data/lib/fog/aws/requests/ecs/run_task.rb +114 -0
  52. data/lib/fog/aws/requests/ecs/start_task.rb +130 -0
  53. data/lib/fog/aws/requests/ecs/stop_task.rb +64 -0
  54. data/lib/fog/aws/requests/ecs/update_service.rb +81 -0
  55. data/lib/fog/aws/version.rb +1 -1
  56. data/tests/requests/compute/vpc_tests.rb +7 -0
  57. data/tests/requests/ecs/cluster_tests.rb +112 -0
  58. data/tests/requests/ecs/container_instance_tests.rb +119 -0
  59. data/tests/requests/ecs/helper.rb +276 -0
  60. data/tests/requests/ecs/sample_task_definition1.json +56 -0
  61. data/tests/requests/ecs/service_tests.rb +132 -0
  62. data/tests/requests/ecs/task_definitions_tests.rb +97 -0
  63. data/tests/requests/ecs/task_tests.rb +145 -0
  64. metadata +59 -2
@@ -0,0 +1,56 @@
1
+ {
2
+ "family": "console-sample-app-static",
3
+ "containerDefinitions": [
4
+ {
5
+ "name": "simple-app",
6
+ "image": "httpd:2.4",
7
+ "cpu": 10,
8
+ "memory": 300,
9
+ "environment": [],
10
+ "portMappings": [
11
+ {
12
+ "hostPort": 80,
13
+ "containerPort": 80
14
+ }
15
+ ],
16
+ "volumesFrom": [],
17
+ "links": [],
18
+ "mountPoints": [
19
+ {
20
+ "sourceVolume": "my-vol",
21
+ "containerPath": "/usr/local/apache2/htdocs"
22
+ }
23
+ ],
24
+ "essential": true
25
+ },
26
+ {
27
+ "name": "busybox",
28
+ "image": "busybox",
29
+ "cpu": 10,
30
+ "memory": 200,
31
+ "entryPoint": [
32
+ "sh",
33
+ "-c"
34
+ ],
35
+ "environment": [],
36
+ "command": [
37
+ "/bin/sh -c \"while true; do echo '<html> <head> <title>Amazon ECS Sample App</title> <style>body {margin-top: 40px; background-color: #333;} </style> </head><body> <div style=color:white;text-align:center> <h1>Amazon ECS Sample App</h1> <h2>Congratulations!</h2> <p>Your application is now running on a container in Amazon ECS.</p>' > top; /bin/date > date ; echo '</div></body></html>' > bottom; cat top date bottom > /usr/local/apache2/htdocs/index.html ; sleep 1; done\""
38
+ ],
39
+ "portMappings": [],
40
+ "volumesFrom": [
41
+ {
42
+ "sourceContainer": "simple-app"
43
+ }
44
+ ],
45
+ "links": [],
46
+ "mountPoints": [],
47
+ "essential": false
48
+ }
49
+ ],
50
+ "volumes": [
51
+ {
52
+ "name": "my-vol",
53
+ "host": {}
54
+ }
55
+ ]
56
+ }
@@ -0,0 +1,132 @@
1
+ Shindo.tests('AWS::ECS | service requests', ['aws', 'ecs']) do
2
+
3
+ Fog::AWS[:ecs].reset_data
4
+
5
+ cluster = 'arn:aws:ecs:us-east-1:994922842243:cluster/default'
6
+ desired_count = 1
7
+ role = 'arn:aws:iam::806753142346:role/ecsServiceRole'
8
+ service_name = 'sample-webapp'
9
+ task_definition = 'console-sample-app-static:18'
10
+ load_balancers = [{
11
+ 'containerName' => 'simple-app',
12
+ 'containerPort' => 80,
13
+ 'loadBalancerName' => 'ecsunittests-EcsElastic-OI09IAP3PVIP'
14
+ }]
15
+
16
+ tests('success') do
17
+
18
+ tests("#list_services").formats(AWS::ECS::Formats::LIST_SERVICES) do
19
+ result = Fog::AWS[:ecs].list_services('cluster' => cluster).body
20
+ list_services_arns = result['ListServicesResult']['serviceArns']
21
+ returns(true) { list_services_arns.empty? }
22
+ result
23
+ end
24
+
25
+ tests("#create_service").formats(AWS::ECS::Formats::CREATE_SERVICE) do
26
+ params = {
27
+ 'cluster' => cluster,
28
+ 'desiredCount' => desired_count,
29
+ 'loadBalancers' => load_balancers,
30
+ 'role' => role,
31
+ 'serviceName' => service_name,
32
+ 'taskDefinition' => task_definition
33
+ }
34
+ result = Fog::AWS[:ecs].create_service(params).body
35
+ service = result['CreateServiceResult']['service']
36
+ returns('sample-webapp') { service['serviceName'] }
37
+ returns(false) { service['serviceArn'].match(/^arn:aws:ecs:.+:.+:service\/.+$/).nil? }
38
+ result
39
+ end
40
+
41
+ tests("#list_services again").formats(AWS::ECS::Formats::LIST_SERVICES) do
42
+ result = Fog::AWS[:ecs].list_services('cluster' => cluster).body
43
+ list_services_arns = result['ListServicesResult']['serviceArns']
44
+ returns(false) { list_services_arns.empty? }
45
+ returns(true) { !list_services_arns.first.match(/#{service_name}/).nil? }
46
+ result
47
+ end
48
+
49
+ tests("#describe_services").formats(AWS::ECS::Formats::DESCRIBE_SERVICES) do
50
+ result1 = Fog::AWS[:ecs].list_services('cluster' => cluster).body
51
+ service_arn = result1['ListServicesResult']['serviceArns'].first
52
+ result2 = Fog::AWS[:ecs].describe_services(
53
+ 'services' => service_arn,
54
+ 'cluster' => cluster
55
+ ).body
56
+ returns(true) { result2['DescribeServicesResult']['services'].size.eql?(1) }
57
+ service = result2['DescribeServicesResult']['services'].first
58
+ returns(true) { service['serviceName'].eql?(service_name) }
59
+ returns(true) { service['status'].eql?('ACTIVE') }
60
+ returns(false) { service['deployments'].empty? }
61
+ returns(true) { service['desiredCount'].eql?(desired_count) }
62
+ result2
63
+ end
64
+
65
+ tests("#update_service").formats(AWS::ECS::Formats::UPDATE_SERVICE) do
66
+ new_task_def = 'arn:aws:ecs:us-east-1:994922842243:task-definitions/foobar-app:32'
67
+ result1 = Fog::AWS[:ecs].list_services('cluster' => cluster).body
68
+ service_arn = result1['ListServicesResult']['serviceArns'].first
69
+
70
+ result2 = Fog::AWS[:ecs].update_service(
71
+ 'service' => service_arn,
72
+ 'cluster' => cluster,
73
+ 'taskDefinition' => new_task_def
74
+ ).body
75
+ service = result2['UpdateServiceResult']['service']
76
+ returns(true) { service['serviceName'].eql?(service_name) }
77
+ returns(true) { service['taskDefinition'].eql?(new_task_def) }
78
+ result2
79
+ end
80
+
81
+
82
+ tests("#delete_service").formats(AWS::ECS::Formats::DELETE_SERVICE) do
83
+ result1 = Fog::AWS[:ecs].list_services('cluster' => cluster).body
84
+ service_arn = result1['ListServicesResult']['serviceArns'].first
85
+
86
+ result2 = Fog::AWS[:ecs].delete_service(
87
+ 'service' => service_arn,
88
+ 'cluster' => cluster
89
+ ).body
90
+ service = result2['DeleteServiceResult']['service']
91
+ returns(true) { service['serviceName'].eql?(service_name) }
92
+ result2
93
+ end
94
+
95
+ tests("#list_services yet again").formats(AWS::ECS::Formats::LIST_SERVICES) do
96
+ result = Fog::AWS[:ecs].list_services('cluster' => cluster).body
97
+ list_services_arns = result['ListServicesResult']['serviceArns']
98
+ returns(true) { list_services_arns.empty? }
99
+ result
100
+ end
101
+
102
+ end
103
+
104
+ tests('failures') do
105
+
106
+ tests('#describe_services without params').raises(Fog::AWS::ECS::Error) do
107
+ response = Fog::AWS[:ecs].describe_services.body
108
+ end
109
+
110
+ tests('#create_service without params').raises(Fog::AWS::ECS::Error) do
111
+ response = Fog::AWS[:ecs].create_service.body
112
+ end
113
+
114
+ tests('#update_service without params').raises(Fog::AWS::ECS::Error) do
115
+ response = Fog::AWS[:ecs].update_service.body
116
+ end
117
+
118
+ tests('#update_service nonexistent').raises(Fog::AWS::ECS::Error) do
119
+ response = Fog::AWS[:ecs].update_service('service' => 'whatever2329').body
120
+ end
121
+
122
+ tests('#delete_service without params').raises(Fog::AWS::ECS::Error) do
123
+ response = Fog::AWS[:ecs].delete_service.body
124
+ end
125
+
126
+ tests('#delete_service nonexistent').raises(Fog::AWS::ECS::Error) do
127
+ response = Fog::AWS[:ecs].delete_service('service' => 'foobar787383').body
128
+ end
129
+
130
+ end
131
+
132
+ end
@@ -0,0 +1,97 @@
1
+ require 'fog/json'
2
+
3
+ Shindo.tests('AWS::ECS | task definitions requests', ['aws', 'ecs']) do
4
+
5
+ Fog::AWS[:ecs].reset_data
6
+
7
+ tests('success') do
8
+
9
+ tests("#list_task_definitions").formats(AWS::ECS::Formats::LIST_TASK_DEFINITIONS) do
10
+ result = Fog::AWS[:ecs].list_task_definitions.body
11
+ list_task_def_arns = result['ListTaskDefinitionsResult']['taskDefinitionArns']
12
+ returns(true) { list_task_def_arns.empty? }
13
+ result
14
+ end
15
+
16
+ tests("#register_task_definition").formats(AWS::ECS::Formats::REGISTER_TASK_DEFINITION) do
17
+ task_def_params = Fog::JSON.decode(IO.read(AWS::ECS::Samples::TASK_DEFINITION_1))
18
+ result = Fog::AWS[:ecs].register_task_definition(task_def_params).body
19
+ task_def = result['RegisterTaskDefinitionResult']['taskDefinition']
20
+ returns('console-sample-app-static') { task_def['family'] }
21
+ returns(true) { task_def['revision'] > 0 }
22
+ returns(false) { task_def['taskDefinitionArn'].match(/^arn:aws:ecs:.+:.+:task-definition\/.+:\d+$/).nil? }
23
+ result
24
+ end
25
+
26
+ tests("#list_task_definition_families").formats(AWS::ECS::Formats::LIST_TASK_DEFINITION_FAMILIES) do
27
+ result = Fog::AWS[:ecs].list_task_definition_families.body
28
+ families = result['ListTaskDefinitionFamiliesResult']['families']
29
+ returns(false) { families.empty? }
30
+ returns(true) { families.include?('console-sample-app-static') }
31
+ result
32
+ end
33
+
34
+ tests("#list_task_definitions again").formats(AWS::ECS::Formats::LIST_TASK_DEFINITIONS) do
35
+ result = Fog::AWS[:ecs].list_task_definitions.body
36
+ list_task_def_arns = result['ListTaskDefinitionsResult']['taskDefinitionArns']
37
+ returns(true) { list_task_def_arns.size.eql?(1) }
38
+ result
39
+ end
40
+
41
+ tests("#describe_task_definition").formats(AWS::ECS::Formats::DESCRIBE_TASK_DEFINITION) do
42
+ result1 = Fog::AWS[:ecs].list_task_definitions.body
43
+ task_def_arn = result1['ListTaskDefinitionsResult']['taskDefinitionArns'].first
44
+ result2 = Fog::AWS[:ecs].describe_task_definition('taskDefinition' => task_def_arn).body
45
+ task_def = result2['DescribeTaskDefinitionResult']['taskDefinition']
46
+ returns(true) { task_def['taskDefinitionArn'].eql?(task_def_arn) }
47
+ returns(true) { task_def['containerDefinitions'].size > 0 }
48
+ result2
49
+ end
50
+
51
+ tests("#deregister_task_definition").formats(AWS::ECS::Formats::DEREGISTER_TASK_DEFINITION) do
52
+ result1 = Fog::AWS[:ecs].list_task_definitions.body
53
+ task_def_arn = result1['ListTaskDefinitionsResult']['taskDefinitionArns'].first
54
+ result2 = Fog::AWS[:ecs].deregister_task_definition('taskDefinition' => task_def_arn).body
55
+ task_def = result2['DeregisterTaskDefinitionResult']['taskDefinition']
56
+ returns(true) { task_def['taskDefinitionArn'].eql?(task_def_arn) }
57
+ result2
58
+ end
59
+
60
+ tests("#list_task_definitions yet again").formats(AWS::ECS::Formats::LIST_TASK_DEFINITIONS) do
61
+ result = Fog::AWS[:ecs].list_task_definitions.body
62
+ list_task_def_arns = result['ListTaskDefinitionsResult']['taskDefinitionArns']
63
+ returns(true) { list_task_def_arns.empty? }
64
+ result
65
+ end
66
+
67
+ tests("#list_task_definition_families again").formats(AWS::ECS::Formats::LIST_TASK_DEFINITION_FAMILIES) do
68
+ result = Fog::AWS[:ecs].list_task_definition_families.body
69
+ families = result['ListTaskDefinitionFamiliesResult']['families']
70
+ returns(true) { families.empty? }
71
+ returns(false) { families.include?('console-sample-app-static') }
72
+ result
73
+ end
74
+
75
+ end
76
+
77
+ tests('failures') do
78
+
79
+ tests('#describe_task_definition without params').raises(Fog::AWS::ECS::Error) do
80
+ response = Fog::AWS[:ecs].describe_task_definition.body
81
+ end
82
+
83
+ tests('#describe_task_definition nonexistent').raises(Fog::AWS::ECS::Error) do
84
+ response = Fog::AWS[:ecs].describe_task_definition('taskDefinition' => 'foobar').body
85
+ end
86
+
87
+ tests('#deregister_task_definition without params').raises(Fog::AWS::ECS::Error) do
88
+ response = Fog::AWS[:ecs].deregister_task_definition.body
89
+ end
90
+
91
+ tests('#deregister_task_definition nonexistent').raises(Fog::AWS::ECS::NotFound) do
92
+ response = Fog::AWS[:ecs].deregister_task_definition('taskDefinition' => 'foobar:7873287283').body
93
+ end
94
+
95
+ end
96
+
97
+ end
@@ -0,0 +1,145 @@
1
+ require 'fog/json'
2
+
3
+ Shindo.tests('AWS::ECS | task requests', ['aws', 'ecs']) do
4
+
5
+ Fog::AWS[:ecs].reset_data
6
+
7
+ tests('success') do
8
+
9
+ tests("#list_tasks").formats(AWS::ECS::Formats::LIST_TASKS) do
10
+ result = Fog::AWS[:ecs].list_tasks.body
11
+ list_instances_arns = result['ListTasksResult']['taskArns']
12
+ returns(true) { list_instances_arns.empty? }
13
+ result
14
+ end
15
+
16
+ tests("#run_task").formats(AWS::ECS::Formats::RUN_TASK) do
17
+ task_def_params = Fog::JSON.decode(IO.read(AWS::ECS::Samples::TASK_DEFINITION_1))
18
+ result1 = Fog::AWS[:ecs].register_task_definition(task_def_params).body
19
+ task_def = result1['RegisterTaskDefinitionResult']['taskDefinition']
20
+ task_def_arn = task_def['taskDefinitionArn']
21
+
22
+ result2 = Fog::AWS[:ecs].run_task('taskDefinition' => task_def_arn).body
23
+ task = result2['RunTaskResult']['tasks'].first
24
+ returns(true) { task.has_key?('containerInstanceArn') }
25
+ returns(true) { task['containers'].size.eql?(2) }
26
+ returns(true) { task['desiredStatus'].eql?('RUNNING') }
27
+ returns(true) { task['taskDefinitionArn'].eql?(task_def_arn) }
28
+ result2
29
+ end
30
+
31
+ tests("#describe_tasks").formats(AWS::ECS::Formats::DESCRIBE_TASKS) do
32
+ result1 = Fog::AWS[:ecs].list_tasks.body
33
+ task_arn = result1['ListTasksResult']['taskArns'].first
34
+
35
+ result2 = Fog::AWS[:ecs].describe_tasks('tasks' => task_arn).body
36
+ task = result2['DescribeTasksResult']['tasks'].first
37
+ returns(true) { task['taskArn'].eql?(task_arn) }
38
+ returns(true) { task['containers'].size.eql?(2) }
39
+ returns(true) { task['desiredStatus'].eql?('RUNNING') }
40
+ result2
41
+ end
42
+
43
+ tests("#list_tasks").formats(AWS::ECS::Formats::LIST_TASKS) do
44
+ result = Fog::AWS[:ecs].list_tasks.body
45
+ list_instances_arns = result['ListTasksResult']['taskArns']
46
+ returns(false) { list_instances_arns.empty? }
47
+ result
48
+ end
49
+
50
+ tests("#stop_task").formats(AWS::ECS::Formats::STOP_TASK) do
51
+ result1 = Fog::AWS[:ecs].list_tasks.body
52
+ task_arn = result1['ListTasksResult']['taskArns'].first
53
+
54
+ result2 = Fog::AWS[:ecs].stop_task('task' => task_arn).body
55
+ task = result2['StopTaskResult']['task']
56
+ returns(true) { task['taskArn'].eql?(task_arn) }
57
+ returns(true) { task['containers'].size.eql?(2) }
58
+ returns(true) { task['desiredStatus'].eql?('STOPPED') }
59
+ result2
60
+ end
61
+
62
+ tests("#start_task").formats(AWS::ECS::Formats::START_TASK) do
63
+ owner_id = Fog::AWS::Mock.owner_id
64
+ container_instance_path = "container-instance/#{Fog::UUID.uuid}"
65
+ region = "us-east-1"
66
+ container_instance_arn = Fog::AWS::Mock.arn('ecs', owner_id, container_instance_path, region)
67
+
68
+ task_def_params = Fog::JSON.decode(IO.read(AWS::ECS::Samples::TASK_DEFINITION_1))
69
+ result1 = Fog::AWS[:ecs].register_task_definition(task_def_params).body
70
+ task_def = result1['RegisterTaskDefinitionResult']['taskDefinition']
71
+ task_def_arn = task_def['taskDefinitionArn']
72
+
73
+ result2 = Fog::AWS[:ecs].start_task(
74
+ 'taskDefinition' => task_def_arn,
75
+ 'containerInstances' => container_instance_arn
76
+ ).body
77
+ task = result2['StartTaskResult']['tasks'].first
78
+
79
+ returns(true) { task['containerInstanceArn'].eql?(container_instance_arn) }
80
+ returns(true) { task['containers'].size.eql?(2) }
81
+ returns(true) { task['desiredStatus'].eql?('RUNNING') }
82
+ returns(true) { task['taskDefinitionArn'].eql?(task_def_arn) }
83
+
84
+ result2
85
+ end
86
+
87
+ tests("#list_tasks").formats(AWS::ECS::Formats::LIST_TASKS) do
88
+ result = Fog::AWS[:ecs].list_tasks.body
89
+ list_instances_arns = result['ListTasksResult']['taskArns']
90
+ returns(false) { list_instances_arns.empty? }
91
+ result
92
+ end
93
+
94
+ end
95
+
96
+ tests('failures') do
97
+
98
+ tests("#describe_tasks nonexistent") do
99
+ task_arn = "arn:aws:ecs:us-west-2:938269302734:task/6893440f-2165-47aa-8cfa-b2f413a26f00"
100
+ result = Fog::AWS[:ecs].describe_tasks('tasks' => task_arn).body
101
+ end
102
+
103
+ tests('describe_tasks without params').raises(Fog::AWS::ECS::Error) do
104
+ response = Fog::AWS[:ecs].describe_tasks.body
105
+ end
106
+
107
+ tests('#run_task without params').raises(Fog::AWS::ECS::Error) do
108
+ response = Fog::AWS[:ecs].run_task.body
109
+ end
110
+
111
+ tests('#run_task nonexistent').raises(Fog::AWS::ECS::Error) do
112
+ task_def_arn = "arn:aws:ecs:us-west-2:539573770077:task-definition/foo-xanadu-app-static:33"
113
+ response = Fog::AWS[:ecs].run_task('taskDefinition' => task_def_arn).body
114
+ end
115
+
116
+ tests('#start_task without params').raises(Fog::AWS::ECS::Error) do
117
+ response = Fog::AWS[:ecs].start_task.body
118
+ end
119
+
120
+ tests('#start_task with missing params').raises(Fog::AWS::ECS::Error) do
121
+ task_def_arn = "arn:aws:ecs:us-west-2:539573770077:task-definition/foo-xanadu-app-static:33"
122
+ response = Fog::AWS[:ecs].start_task('taskDefinition' => task_def_arn).body
123
+ end
124
+
125
+ tests('#start_task nonexistent').raises(Fog::AWS::ECS::Error) do
126
+ task_def_arn = "arn:aws:ecs:us-west-2:539573770077:task-definition/foo-xanadu-app-static:33"
127
+ container_instance_arn = "arn:aws:ecs:us-west-2:938269302734:container-instance/6893440f-2165-47aa-8cfa-b2f413a26f00"
128
+ response = Fog::AWS[:ecs].start_task(
129
+ 'taskDefinition' => task_def_arn,
130
+ 'containerInstances' => container_instance_arn
131
+ ).body
132
+ end
133
+
134
+ tests('#stop_task without params').raises(Fog::AWS::ECS::Error) do
135
+ response = Fog::AWS[:ecs].stop_task.body
136
+ end
137
+
138
+ tests('#stop_task nonexistent params').raises(Fog::AWS::ECS::Error) do
139
+ task_arn = "arn:aws:ecs:us-west-2:938269302734:task/6893440f-2165-47aa-8cfa-b2f413a26f00"
140
+ response = Fog::AWS[:ecs].stop_task('task' => task_arn).body
141
+ end
142
+
143
+ end
144
+
145
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lane
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-15 00:00:00.000000000 Z
12
+ date: 2015-06-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -141,6 +141,7 @@ files:
141
141
  - lib/fog/aws/data_pipeline.rb
142
142
  - lib/fog/aws/dns.rb
143
143
  - lib/fog/aws/dynamodb.rb
144
+ - lib/fog/aws/ecs.rb
144
145
  - lib/fog/aws/elasticache.rb
145
146
  - lib/fog/aws/elb.rb
146
147
  - lib/fog/aws/elb/policy_types.rb
@@ -443,6 +444,33 @@ files:
443
444
  - lib/fog/aws/parsers/dns/list_health_checks.rb
444
445
  - lib/fog/aws/parsers/dns/list_hosted_zones.rb
445
446
  - lib/fog/aws/parsers/dns/list_resource_record_sets.rb
447
+ - lib/fog/aws/parsers/ecs/base.rb
448
+ - lib/fog/aws/parsers/ecs/container_instance.rb
449
+ - lib/fog/aws/parsers/ecs/create_cluster.rb
450
+ - lib/fog/aws/parsers/ecs/create_service.rb
451
+ - lib/fog/aws/parsers/ecs/delete_cluster.rb
452
+ - lib/fog/aws/parsers/ecs/delete_service.rb
453
+ - lib/fog/aws/parsers/ecs/deregister_container_instance.rb
454
+ - lib/fog/aws/parsers/ecs/deregister_task_definition.rb
455
+ - lib/fog/aws/parsers/ecs/describe_clusters.rb
456
+ - lib/fog/aws/parsers/ecs/describe_container_instances.rb
457
+ - lib/fog/aws/parsers/ecs/describe_services.rb
458
+ - lib/fog/aws/parsers/ecs/describe_task_definition.rb
459
+ - lib/fog/aws/parsers/ecs/describe_tasks.rb
460
+ - lib/fog/aws/parsers/ecs/list_clusters.rb
461
+ - lib/fog/aws/parsers/ecs/list_container_instances.rb
462
+ - lib/fog/aws/parsers/ecs/list_services.rb
463
+ - lib/fog/aws/parsers/ecs/list_task_definition_families.rb
464
+ - lib/fog/aws/parsers/ecs/list_task_definitions.rb
465
+ - lib/fog/aws/parsers/ecs/list_tasks.rb
466
+ - lib/fog/aws/parsers/ecs/register_task_definition.rb
467
+ - lib/fog/aws/parsers/ecs/run_task.rb
468
+ - lib/fog/aws/parsers/ecs/service.rb
469
+ - lib/fog/aws/parsers/ecs/start_task.rb
470
+ - lib/fog/aws/parsers/ecs/stop_task.rb
471
+ - lib/fog/aws/parsers/ecs/task.rb
472
+ - lib/fog/aws/parsers/ecs/task_definition.rb
473
+ - lib/fog/aws/parsers/ecs/update_service.rb
446
474
  - lib/fog/aws/parsers/elasticache/authorize_cache_security_group_ingress.rb
447
475
  - lib/fog/aws/parsers/elasticache/base.rb
448
476
  - lib/fog/aws/parsers/elasticache/cache_cluster_parser.rb
@@ -891,6 +919,28 @@ files:
891
919
  - lib/fog/aws/requests/dynamodb/scan.rb
892
920
  - lib/fog/aws/requests/dynamodb/update_item.rb
893
921
  - lib/fog/aws/requests/dynamodb/update_table.rb
922
+ - lib/fog/aws/requests/ecs/create_cluster.rb
923
+ - lib/fog/aws/requests/ecs/create_service.rb
924
+ - lib/fog/aws/requests/ecs/delete_cluster.rb
925
+ - lib/fog/aws/requests/ecs/delete_service.rb
926
+ - lib/fog/aws/requests/ecs/deregister_container_instance.rb
927
+ - lib/fog/aws/requests/ecs/deregister_task_definition.rb
928
+ - lib/fog/aws/requests/ecs/describe_clusters.rb
929
+ - lib/fog/aws/requests/ecs/describe_container_instances.rb
930
+ - lib/fog/aws/requests/ecs/describe_services.rb
931
+ - lib/fog/aws/requests/ecs/describe_task_definition.rb
932
+ - lib/fog/aws/requests/ecs/describe_tasks.rb
933
+ - lib/fog/aws/requests/ecs/list_clusters.rb
934
+ - lib/fog/aws/requests/ecs/list_container_instances.rb
935
+ - lib/fog/aws/requests/ecs/list_services.rb
936
+ - lib/fog/aws/requests/ecs/list_task_definition_families.rb
937
+ - lib/fog/aws/requests/ecs/list_task_definitions.rb
938
+ - lib/fog/aws/requests/ecs/list_tasks.rb
939
+ - lib/fog/aws/requests/ecs/register_task_definition.rb
940
+ - lib/fog/aws/requests/ecs/run_task.rb
941
+ - lib/fog/aws/requests/ecs/start_task.rb
942
+ - lib/fog/aws/requests/ecs/stop_task.rb
943
+ - lib/fog/aws/requests/ecs/update_service.rb
894
944
  - lib/fog/aws/requests/elasticache/authorize_cache_security_group_ingress.rb
895
945
  - lib/fog/aws/requests/elasticache/create_cache_cluster.rb
896
946
  - lib/fog/aws/requests/elasticache/create_cache_parameter_group.rb
@@ -1376,6 +1426,13 @@ files:
1376
1426
  - tests/requests/dns/helper.rb
1377
1427
  - tests/requests/dynamodb/item_tests.rb
1378
1428
  - tests/requests/dynamodb/table_tests.rb
1429
+ - tests/requests/ecs/cluster_tests.rb
1430
+ - tests/requests/ecs/container_instance_tests.rb
1431
+ - tests/requests/ecs/helper.rb
1432
+ - tests/requests/ecs/sample_task_definition1.json
1433
+ - tests/requests/ecs/service_tests.rb
1434
+ - tests/requests/ecs/task_definitions_tests.rb
1435
+ - tests/requests/ecs/task_tests.rb
1379
1436
  - tests/requests/elasticache/cache_cluster_tests.rb
1380
1437
  - tests/requests/elasticache/describe_events.rb
1381
1438
  - tests/requests/elasticache/describe_reserved_cache_nodes.rb