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,31 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/container_instance'
6
+
7
+ class DeregisterContainerInstance < Fog::Parsers::AWS::ECS::ContainerInstance
8
+ def reset
9
+ super
10
+ @result = 'DeregisterContainerInstanceResult'
11
+ @response[@result] = {}
12
+ @contexts = %w(registeredResources remainingResources stringSetValue)
13
+ @context = []
14
+ @container_instance = {}
15
+ @registered_resource = {}
16
+ @remaining_resource = {}
17
+ @string_set = []
18
+ end
19
+
20
+ def end_element(name)
21
+ super
22
+ case name
23
+ when 'containerInstance'
24
+ @response[@result][name] = @container_instance
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,32 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/task_definition'
6
+
7
+ class DeregisterTaskDefinition < Fog::Parsers::AWS::ECS::TaskDefinition
8
+ def reset
9
+ @response = {}
10
+ @result = 'DeregisterTaskDefinitionResult'
11
+ @definition = 'taskDefinition'
12
+ @response[@result] = {
13
+ @definition => {
14
+ 'volumes' => [],
15
+ 'containerDefinitions' => []
16
+ }
17
+ }
18
+ @contexts = %w(volumes containerDefinitions command entryPoint environment links mountPoints portMappings volumesFrom)
19
+ @context = []
20
+ @volume = {}
21
+ @host = {}
22
+ @container = {}
23
+ @environment = {}
24
+ @mountpoint = {}
25
+ @portmapping = {}
26
+ @volume_from = {}
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,55 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/base'
6
+
7
+ class DescribeClusters < Fog::Parsers::AWS::ECS::Base
8
+ def reset
9
+ super
10
+ @result = 'DescribeClustersResult'
11
+ @response[@result] = {}
12
+ @contexts = %w(failures clusters)
13
+ @context = []
14
+ @clusters = []
15
+ @failures = []
16
+ @cluster = {}
17
+ @failure = {}
18
+ end
19
+
20
+ def start_element(name, attrs = [])
21
+ super
22
+ if @contexts.include?(name)
23
+ @context.push(name)
24
+ end
25
+ end
26
+
27
+ def end_element(name)
28
+ super
29
+ case name
30
+ when 'clusterName', 'clusterArn', 'status'
31
+ @cluster[name] = value
32
+ when 'arn', 'reason'
33
+ @failure[name] = value
34
+ when 'member'
35
+ case @context.last
36
+ when 'clusters'
37
+ @clusters << @cluster unless @cluster.empty?
38
+ @cluster = {}
39
+ when 'failures'
40
+ @failures << @failure unless @failure.empty?
41
+ @failure = {}
42
+ end
43
+ when 'clusters'
44
+ @response[@result][name] = @clusters
45
+ @context.pop
46
+ when 'failures'
47
+ @response[@result][name] = @failures
48
+ @context.pop
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,38 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/container_instance'
6
+
7
+ class DescribeContainerInstances < Fog::Parsers::AWS::ECS::ContainerInstance
8
+ def reset
9
+ super
10
+ @result = 'DescribeContainerInstancesResult'
11
+ @response[@result] = {
12
+ 'containerInstances' => [],
13
+ 'failures' => []
14
+ }
15
+ @contexts = %w(containerInstances registeredResources remainingResources stringSetValue)
16
+ @context = []
17
+ @container_instance = {}
18
+ @registered_resource = {}
19
+ @remaining_resource = {}
20
+ @string_set = []
21
+ end
22
+
23
+ def end_element(name)
24
+ super
25
+ case name
26
+ when 'member'
27
+ case @context.last
28
+ when 'containerInstances'
29
+ @response[@result]['containerInstances'] << @container_instance
30
+ @container_instance = {}
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,24 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/service'
6
+
7
+ class DescribeServices < Fog::Parsers::AWS::ECS::Service
8
+ def reset
9
+ super
10
+ @result = 'DescribeServicesResult'
11
+ @response[@result] = { 'services' => [], 'failures' => [] }
12
+ @service = {}
13
+ @failure = {}
14
+ @contexts = %w(failures services loadBalancers events deployments)
15
+ @context = []
16
+ @deployment = {}
17
+ @load_balancer = {}
18
+ @event = {}
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,32 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/task_definition'
6
+
7
+ class DescribeTaskDefinition < Fog::Parsers::AWS::ECS::TaskDefinition
8
+ def reset
9
+ super
10
+ @result = 'DescribeTaskDefinitionResult'
11
+ @definition = 'taskDefinition'
12
+ @response[@result] = {
13
+ @definition => {
14
+ 'volumes' => [],
15
+ 'containerDefinitions' => []
16
+ }
17
+ }
18
+ @contexts = %w(volumes containerDefinitions command entryPoint environment links mountPoints portMappings volumesFrom)
19
+ @context = []
20
+ @volume = {}
21
+ @host = {}
22
+ @container = {}
23
+ @environment = {}
24
+ @mountpoint = {}
25
+ @portmapping = {}
26
+ @volume_from = {}
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,24 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/task'
6
+
7
+ class DescribeTasks < Fog::Parsers::AWS::ECS::Task
8
+ def reset
9
+ super
10
+ @result = 'DescribeTasksResult'
11
+ @response[@result] = {'failures' => [], 'tasks' => []}
12
+ @contexts = %w(failures tasks containers overrides networkBindings containerOverrides)
13
+ @context = []
14
+ @task = {}
15
+ @failure = {}
16
+ @container = {}
17
+ @net_binding = {}
18
+ @container_overrides = []
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/base'
6
+
7
+ class ListClusters < Fog::Parsers::AWS::ECS::Base
8
+ def reset
9
+ super
10
+ @result = 'ListClustersResult'
11
+ @response[@result] = {'clusterArns' => []}
12
+ end
13
+
14
+ def end_element(name)
15
+ super
16
+ case name
17
+ when 'member'
18
+ @response[@result]['clusterArns'] << value
19
+ when 'NextToken'
20
+ @response[@result][name] = value
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/base'
6
+
7
+ class ListContainerInstances < Fog::Parsers::AWS::ECS::Base
8
+ def reset
9
+ super
10
+ @result = 'ListContainerInstancesResult'
11
+ @response[@result] = {'containerInstanceArns' => []}
12
+ end
13
+
14
+ def end_element(name)
15
+ super
16
+ case name
17
+ when 'member'
18
+ @response[@result]['containerInstanceArns'] << value
19
+ when 'NextToken'
20
+ @response[@result][name] = value
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/base'
6
+
7
+ class ListServices < Fog::Parsers::AWS::ECS::Base
8
+ def reset
9
+ super
10
+ @result = 'ListServicesResult'
11
+ @response[@result] = {'serviceArns' => []}
12
+ end
13
+
14
+ def end_element(name)
15
+ super
16
+ case name
17
+ when 'member'
18
+ @response[@result]['serviceArns'] << value
19
+ when 'NextToken'
20
+ @response[@result][name] = value
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/base'
6
+
7
+ class ListTaskDefinitionFamilies < Fog::Parsers::AWS::ECS::Base
8
+ def reset
9
+ super
10
+ @result = 'ListTaskDefinitionFamiliesResult'
11
+ @response[@result] = {'families' => []}
12
+ end
13
+
14
+ def end_element(name)
15
+ super
16
+ case name
17
+ when 'member'
18
+ @response[@result]['families'] << value
19
+ when 'NextToken'
20
+ @response[@result][name] = value
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/base'
6
+
7
+ class ListTaskDefinitions < Fog::Parsers::AWS::ECS::Base
8
+ def reset
9
+ super
10
+ @result = 'ListTaskDefinitionsResult'
11
+ @response[@result] = {'taskDefinitionArns' => []}
12
+ end
13
+
14
+ def end_element(name)
15
+ super
16
+ case name
17
+ when 'member'
18
+ @response[@result]['taskDefinitionArns'] << value
19
+ when 'NextToken'
20
+ @response[@result][name] = value
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/base'
6
+
7
+ class ListTasks < Fog::Parsers::AWS::ECS::Base
8
+ def reset
9
+ super
10
+ @result = 'ListTasksResult'
11
+ @response[@result] = {'taskArns' => []}
12
+ end
13
+
14
+ def end_element(name)
15
+ super
16
+ case name
17
+ when 'member'
18
+ @response[@result]['taskArns'] << value
19
+ when 'NextToken'
20
+ @response[@result][name] = value
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ECS
5
+ require 'fog/aws/parsers/ecs/task_definition'
6
+
7
+ class RegisterTaskDefinition < Fog::Parsers::AWS::ECS::TaskDefinition
8
+ def reset
9
+ super
10
+ @result = 'RegisterTaskDefinitionResult'
11
+ @definition = 'taskDefinition'
12
+ @response[@result] = {
13
+ @definition => {
14
+ 'volumes' => [],
15
+ 'containerDefinitions' => []
16
+ }
17
+ }
18
+ @contexts = %w(volumes containerDefinitions command entryPoint environment links mountPoints portMappings volumesFrom)
19
+ @context = []
20
+ @volume = {}
21
+ @host = {}
22
+ @container = {}
23
+ @environment = {}
24
+ @mountpoint = {}
25
+ @portmapping = {}
26
+ @volume_from = {}
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end