awspec 0.59.0 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2eef476551d54bd58aff38853d7311e3d62584e5
4
- data.tar.gz: b3ab086ec14329e11efef9eab2d8e2d32c73c2ac
3
+ metadata.gz: deca32adffdfa628b35762a4d68d56f9c734a66c
4
+ data.tar.gz: 961a666bc6bb27c406da5cd13204a19f016d284c
5
5
  SHA512:
6
- metadata.gz: 6a29a0c4c3b66c585f9fc93140feca124cda5ede572b9c0bea97ed6283f99df4aaab86b6095441c47de28085a7d3e04a3657d31c41b76c012fb3687c28ead131
7
- data.tar.gz: da19a2025dec7a0202314b85cbd3c70c2d18a47d01afbcd64bfbdf65a1aee61c3060526dc8a55fb50e20719fb18f21ba17c14b574129cb8c2ab91a32b50dc39b
6
+ metadata.gz: 57da3f4ff92d9ecc26d1a203991e45639e24d3f535d1511bb6e39dd42f180836d2e1a350054d706060c523d7d29bbfcd13f2d0bba254ab92ae6b25ae08c44a41
7
+ data.tar.gz: 7106413e99f13bcbf185d8129770b80fb082e98a4093e42ab85a3e790b02eea22efc722d91a761e8395c3fe2f3aa7eb8e743b0f2f04d552a904f68472dd0205b
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  /spec/secrets.yml
10
+ /.ruby-version
@@ -8,6 +8,11 @@
8
8
  | [directconnect_virtual_interface](#directconnect_virtual_interface)
9
9
  | [ebs](#ebs)
10
10
  | [ec2](#ec2)
11
+ | [ecr_repository](#ecr_repository)
12
+ | [ecs_cluster](#ecs_cluster)
13
+ | [ecs_container_instance](#ecs_container_instance)
14
+ | [ecs_service](#ecs_service)
15
+ | [ecs_task_definition](#ecs_task_definition)
11
16
  | [elasticache](#elasticache)
12
17
  | [elasticache_cache_parameter_group](#elasticache_cache_parameter_group)
13
18
  | [elasticsearch](#elasticsearch)
@@ -455,6 +460,59 @@ describe ec2('my-ec2') do
455
460
  end
456
461
  ```
457
462
 
463
+ ## <a name="ecr_repository">ecr_repository</a>
464
+
465
+ EcrRepository resource type.
466
+
467
+ ### exist
468
+
469
+
470
+ ## <a name="ecs_cluster">ecs_cluster</a>
471
+
472
+ EcsCluster resource type.
473
+
474
+ ### exist
475
+
476
+ ### be_active
477
+
478
+ ### be_inactive
479
+
480
+
481
+ ## <a name="ecs_container_instance">ecs_container_instance</a>
482
+
483
+ EcsContainerInstance resource type.
484
+
485
+ ### exist
486
+
487
+ ### be_active
488
+
489
+ ### be_inactive
490
+
491
+
492
+ ## <a name="ecs_service">ecs_service</a>
493
+
494
+ EcsService resource type.
495
+
496
+ ### exist
497
+
498
+ ### be_active
499
+
500
+ ### be_draining
501
+
502
+ ### be_inactive
503
+
504
+
505
+ ## <a name="ecs_task_definition">ecs_task_definition</a>
506
+
507
+ EcsTaskDefinition resource type.
508
+
509
+ ### exist
510
+
511
+ ### be_active
512
+
513
+ ### be_inactive
514
+
515
+
458
516
  ## <a name="elasticache">elasticache</a>
459
517
 
460
518
  Elasticache resource type.
@@ -0,0 +1,15 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class EcrRepository < Base
5
+ def initialize
6
+ super
7
+ @type = Awspec::Type::EcrRepository.new('my-ecr-repository')
8
+ @matchers = []
9
+ @ignore_matchers = []
10
+ @describes = []
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class EcsCluster < Base
5
+ def initialize
6
+ super
7
+ @type = Awspec::Type::EcsCluster.new('my-ecs-cluster')
8
+ @matchers = []
9
+ @ignore_matchers = []
10
+ @describes = []
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class EcsContainerInstance < Base
5
+ def initialize
6
+ super
7
+ @type = Awspec::Type::EcsContainerInstance.new('my-ecs-container-instance')
8
+ @matchers = []
9
+ @ignore_matchers = []
10
+ @describes = []
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class EcsService < Base
5
+ def initialize
6
+ super
7
+ @type = Awspec::Type::EcsService.new('my-ecs-service')
8
+ @matchers = []
9
+ @ignore_matchers = []
10
+ @describes = []
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class EcsTaskDefinition < Base
5
+ def initialize
6
+ super
7
+ @type = Awspec::Type::EcsTaskDefinition.new('my-ecs-taskdef')
8
+ @matchers = []
9
+ @ignore_matchers = []
10
+ @describes = []
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -2,6 +2,8 @@ require 'aws-sdk'
2
2
  require 'awspec/helper/finder/vpc'
3
3
  require 'awspec/helper/finder/subnet'
4
4
  require 'awspec/helper/finder/ec2'
5
+ require 'awspec/helper/finder/ecr'
6
+ require 'awspec/helper/finder/ecs'
5
7
  require 'awspec/helper/finder/security_group'
6
8
  require 'awspec/helper/finder/rds'
7
9
  require 'awspec/helper/finder/route53'
@@ -29,6 +31,8 @@ module Awspec::Helper
29
31
  include Awspec::Helper::Finder::Vpc
30
32
  include Awspec::Helper::Finder::Subnet
31
33
  include Awspec::Helper::Finder::Ec2
34
+ include Awspec::Helper::Finder::Ecr
35
+ include Awspec::Helper::Finder::Ecs
32
36
  include Awspec::Helper::Finder::SecurityGroup
33
37
  include Awspec::Helper::Finder::Rds
34
38
  include Awspec::Helper::Finder::Route53
@@ -53,6 +57,8 @@ module Awspec::Helper
53
57
 
54
58
  CLIENTS = {
55
59
  ec2_client: Aws::EC2::Client,
60
+ ecr_client: Aws::ECR::Client,
61
+ ecs_client: Aws::ECS::Client,
56
62
  rds_client: Aws::RDS::Client,
57
63
  route53_client: Aws::Route53::Client,
58
64
  s3_client: Aws::S3::Client,
@@ -0,0 +1,10 @@
1
+ module Awspec::Helper
2
+ module Finder
3
+ module Ecr
4
+ def find_ecr_repository(repository_name)
5
+ res = ecr_client.describe_repositories(repository_names: [repository_name])
6
+ res.repositories.first if res.repositories.count == 1
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,37 @@
1
+ module Awspec::Helper
2
+ module Finder
3
+ module Ecs
4
+ def find_ecs_cluster(cluster_name)
5
+ res = ecs_client.describe_clusters(clusters: [cluster_name])
6
+ res.clusters.first if res.clusters.count == 1
7
+ end
8
+
9
+ def list_ecs_container_instances(cluster_name)
10
+ req = { cluster: cluster_name }
11
+ container_instances = []
12
+ loop do
13
+ res = ecs_client.list_container_instances(req)
14
+ container_instances.push(*res.container_instance_arns)
15
+ break if res.next_token.nil?
16
+ req[:next_token] = res.next_token
17
+ end
18
+ container_instances
19
+ end
20
+
21
+ def find_ecs_container_instances(cluster_name, container_instances)
22
+ res = ecs_client.describe_container_instances(cluster: cluster_name, container_instances: container_instances)
23
+ res.container_instances if res.container_instances
24
+ end
25
+
26
+ def find_ecs_task_definition(taskdef)
27
+ res = ecs_client.describe_task_definition(task_definition: taskdef)
28
+ res.task_definition
29
+ end
30
+
31
+ def find_ecs_service(service)
32
+ res = ecs_client.describe_services(services: [service])
33
+ res.services.first if res.services.count == 1
34
+ end
35
+ end
36
+ end
37
+ end
@@ -5,7 +5,8 @@ module Awspec
5
5
 
6
6
  TYPES = %w(
7
7
  ami autoscaling_group cloudtrail cloudwatch_alarm cloudwatch_event directconnect_virtual_interface
8
- ebs ec2 elasticache elasticache_cache_parameter_group elasticsearch elb iam_group
8
+ ebs ec2 ecr_repository ecs_cluster ecs_container_instance ecs_service ecs_task_definition
9
+ elasticache elasticache_cache_parameter_group elasticsearch elb iam_group
9
10
  iam_policy iam_role iam_user kms lambda launch_configuration nat_gateway
10
11
  network_acl network_interface rds rds_db_cluster_parameter_group rds_db_parameter_group route53_hosted_zone
11
12
  route_table s3_bucket security_group ses_identity subnet vpc cloudfront_distribution
@@ -0,0 +1,13 @@
1
+ Aws.config[:ecr] = {
2
+ stub_responses: {
3
+ describe_repositories: {
4
+ repositories: [
5
+ {
6
+ registry_id: '123456789012',
7
+ repository_arn: 'arn:aws:ecr:us-east-1:123456789012:repository/my-ecr-repository',
8
+ repository_name: 'my-ecr-repository'
9
+ }
10
+ ]
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,199 @@
1
+ Aws.config[:ecs] = {
2
+ stub_responses: {
3
+ describe_clusters: {
4
+ clusters: [
5
+ {
6
+ cluster_arn: 'arn:aws:ecs:us-east-1:123456789012:cluster/my-ecs-cluster',
7
+ cluster_name: 'my-ecs-cluster',
8
+ status: 'ACTIVE',
9
+ registered_container_instances_count: 0,
10
+ pending_tasks_count: 0,
11
+ running_tasks_count: 0,
12
+ active_services_count: 0
13
+ }
14
+ ],
15
+ failures: [
16
+ ]
17
+ },
18
+ list_container_instances: {
19
+ container_instance_arns: [
20
+ 'arn:aws:ecs:us-east-1:123456789012:container-instance/f2756532-8f13-4d53-87c9-aed50dc94cd7'
21
+ ]
22
+ },
23
+ describe_container_instances: {
24
+ container_instances: [
25
+ {
26
+ agent_connected: true,
27
+ container_instance_arn:
28
+ 'arn:aws:ecs:us-east-1:123456789012:container-instance/f2756532-8f13-4d53-87c9-aed50dc94cd7',
29
+ ec2_instance_id: 'i-01234567',
30
+ pending_tasks_count: 0,
31
+ registered_resources: [
32
+ {
33
+ name: 'CPU',
34
+ type: 'INTEGER',
35
+ double_value: 0.0,
36
+ integer_value: 2048,
37
+ long_value: 0
38
+ },
39
+ {
40
+ name: 'MEMORY',
41
+ type: 'INTEGER',
42
+ double_value: 0.0,
43
+ integer_value: 3768,
44
+ long_value: 0
45
+ },
46
+ {
47
+ name: 'PORTS',
48
+ type: 'STRINGSET',
49
+ double_value: 0.0,
50
+ integer_value: 0,
51
+ long_value: 0,
52
+ string_set_value: %w[
53
+ '2376',
54
+ '22',
55
+ '51678',
56
+ '2375'
57
+ ]
58
+ }
59
+ ],
60
+ remaining_resources: [
61
+ {
62
+ name: 'CPU',
63
+ type: 'INTEGER',
64
+ double_value: 0.0,
65
+ integer_value: 1948,
66
+ long_value: 0
67
+ },
68
+ {
69
+ name: 'MEMORY',
70
+ type: 'INTEGER',
71
+ double_value: 0.0,
72
+ integer_value: 3668,
73
+ long_value: 0
74
+ },
75
+ {
76
+ name: 'PORTS',
77
+ type: 'STRINGSET',
78
+ double_value: 0.0,
79
+ integer_value: 0,
80
+ long_value: 0,
81
+ string_set_value: %w[
82
+ '2376',
83
+ '22',
84
+ '80',
85
+ '51678',
86
+ '2375'
87
+ ]
88
+ }
89
+ ],
90
+ running_tasks_count: 1,
91
+ status: 'ACTIVE'
92
+ }
93
+ ],
94
+ failures: [
95
+ ]
96
+ },
97
+ describe_task_definition: {
98
+ task_definition: {
99
+ container_definitions: [
100
+ {
101
+ name: 'wordpress',
102
+ cpu: 10,
103
+ environment: [
104
+ ],
105
+ essential: true,
106
+ image: 'wordpress',
107
+ links: [
108
+ 'mysql'
109
+ ],
110
+ memory: 500,
111
+ mount_points: [
112
+ ],
113
+ port_mappings: [
114
+ {
115
+ container_port: 80,
116
+ host_port: 80
117
+ }
118
+ ],
119
+ volumes_from: [
120
+ ]
121
+ },
122
+ {
123
+ name: 'mysql',
124
+ cpu: 10,
125
+ environment: [
126
+ {
127
+ name: 'MYSQL_ROOT_PASSWORD',
128
+ value: 'password'
129
+ }
130
+ ],
131
+ essential: true,
132
+ image: 'mysql',
133
+ memory: 500,
134
+ mount_points: [
135
+ ],
136
+ port_mappings: [
137
+ ],
138
+ volumes_from: [
139
+ ]
140
+ }
141
+ ],
142
+ status: 'ACTIVE',
143
+ family: 'my-ecs-task-definition',
144
+ revision: 8,
145
+ task_definition_arn: 'arn:aws:ecs:us-east-1:123456789012:task-definition/my-ecs-task-definition:8',
146
+ task_role_arn: 'arn:aws:iam::123456789012:role/my-iam-role',
147
+ volumes: [
148
+ ]
149
+ }
150
+ },
151
+ describe_services: {
152
+ failures: [
153
+ ],
154
+ services: [
155
+ {
156
+ cluster_arn: 'arn:aws:ecs:us-east-1:123456789012:cluster/my-ecs-cluster',
157
+ created_at: Time.parse('2016-08-29T16:25:52.130Z'),
158
+ deployment_configuration: {
159
+ maximum_percent: 200,
160
+ minimum_healthy_percent: 100
161
+ },
162
+ deployments: [
163
+ {
164
+ created_at: Time.parse('2016-08-29T16:25:52.130Z'),
165
+ desired_count: 1,
166
+ id: 'ecs-svc/9223370564341623665',
167
+ pending_count: 0,
168
+ running_count: 0,
169
+ status: 'PRIMARY',
170
+ task_definition: 'arn:aws:ecs:us-east-1:123456789012:task-definition/my-ecs-task-definition:8',
171
+ updated_at: Time.parse('2016-08-29T16:25:52.130Z')
172
+ }
173
+ ],
174
+ desired_count: 1,
175
+ events: [
176
+ {
177
+ created_at: Time.parse('2016-08-29T16:25:58.520Z'),
178
+ id: '38c285e5-d335-4b68-8b15-e46dedc8e88d',
179
+ message: '(service my-ecs-service) was unable to place a task ' \
180
+ 'because no container instance met all of its requirements. The ' \
181
+ 'closest matching (container-instance ' \
182
+ '3f4de1c5-ffdd-4954-af7e-75b4be0c8841) is already using a port ' \
183
+ 'required by your task. For more information, see the ' \
184
+ 'Troubleshooting section of the Amazon ECS Developer Guide.'
185
+ }
186
+ ],
187
+ load_balancers: [
188
+ ],
189
+ pending_count: 0,
190
+ running_count: 0,
191
+ service_arn: 'arn:aws:ecs:us-east-1:123456789012:service/my-ecs-service',
192
+ service_name: 'my-ecs-service',
193
+ status: 'ACTIVE',
194
+ task_definition: 'arn:aws:ecs:us-east-1:123456789012:task-definition/my-ecs-task-definition:8'
195
+ }
196
+ ]
197
+ }
198
+ }
199
+ }
@@ -0,0 +1,24 @@
1
+ Aws.config[:ecs] = {
2
+ stub_responses: {
3
+ describe_clusters: {
4
+ clusters: [
5
+ {
6
+ cluster_arn: 'arn:aws:ecs:us-east-1:123456789012:cluster/my-ecs-cluster',
7
+ cluster_name: 'my-ecs-cluster',
8
+ status: 'ACTIVE',
9
+ registered_container_instances_count: 0,
10
+ pending_tasks_count: 0,
11
+ running_tasks_count: 0,
12
+ active_services_count: 0
13
+ }
14
+ ],
15
+ failures: [
16
+ ]
17
+ },
18
+ list_container_instances: {
19
+ container_instance_arns: [
20
+ 'arn:aws:ecs:us-east-1:123456789012:container-instance/f2756532-8f13-4d53-87c9-aed50dc94cd7'
21
+ ]
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,78 @@
1
+ Aws.config[:ecs] = {
2
+ stub_responses: {
3
+ describe_container_instances: {
4
+ container_instances: [
5
+ {
6
+ agent_connected: true,
7
+ container_instance_arn:
8
+ 'arn:aws:ecs:us-east-1:123456789012:container-instance/f2756532-8f13-4d53-87c9-aed50dc94cd7',
9
+ ec2_instance_id: 'i-01234567',
10
+ pending_tasks_count: 0,
11
+ registered_resources: [
12
+ {
13
+ name: 'CPU',
14
+ type: 'INTEGER',
15
+ double_value: 0.0,
16
+ integer_value: 2048,
17
+ long_value: 0
18
+ },
19
+ {
20
+ name: 'MEMORY',
21
+ type: 'INTEGER',
22
+ double_value: 0.0,
23
+ integer_value: 3768,
24
+ long_value: 0
25
+ },
26
+ {
27
+ name: 'PORTS',
28
+ type: 'STRINGSET',
29
+ double_value: 0.0,
30
+ integer_value: 0,
31
+ long_value: 0,
32
+ string_set_value: %w[
33
+ '2376',
34
+ '22',
35
+ '51678',
36
+ '2375'
37
+ ]
38
+ }
39
+ ],
40
+ remaining_resources: [
41
+ {
42
+ name: 'CPU',
43
+ type: 'INTEGER',
44
+ double_value: 0.0,
45
+ integer_value: 1948,
46
+ long_value: 0
47
+ },
48
+ {
49
+ name: 'MEMORY',
50
+ type: 'INTEGER',
51
+ double_value: 0.0,
52
+ integer_value: 3668,
53
+ long_value: 0
54
+ },
55
+ {
56
+ name: 'PORTS',
57
+ type: 'STRINGSET',
58
+ double_value: 0.0,
59
+ integer_value: 0,
60
+ long_value: 0,
61
+ string_set_value: %w[
62
+ '2376',
63
+ '22',
64
+ '80',
65
+ '51678',
66
+ '2375'
67
+ ]
68
+ }
69
+ ],
70
+ running_tasks_count: 1,
71
+ status: 'ACTIVE'
72
+ }
73
+ ],
74
+ failures: [
75
+ ]
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,51 @@
1
+ Aws.config[:ecs] = {
2
+ stub_responses: {
3
+ describe_services: {
4
+ failures: [
5
+ ],
6
+ services: [
7
+ {
8
+ cluster_arn: 'arn:aws:ecs:us-east-1:123456789012:cluster/my-ecs-cluster',
9
+ created_at: Time.parse('2016-08-29T16:25:52.130Z'),
10
+ deployment_configuration: {
11
+ maximum_percent: 200,
12
+ minimum_healthy_percent: 100
13
+ },
14
+ deployments: [
15
+ {
16
+ created_at: Time.parse('2016-08-29T16:25:52.130Z'),
17
+ desired_count: 1,
18
+ id: 'ecs-svc/9223370564341623665',
19
+ pending_count: 0,
20
+ running_count: 0,
21
+ status: 'PRIMARY',
22
+ task_definition: 'arn:aws:ecs:us-east-1:123456789012:task-definition/my-ecs-task-definition:8',
23
+ updated_at: Time.parse('2016-08-29T16:25:52.130Z')
24
+ }
25
+ ],
26
+ desired_count: 1,
27
+ events: [
28
+ {
29
+ created_at: Time.parse('2016-08-29T16:25:58.520Z'),
30
+ id: '38c285e5-d335-4b68-8b15-e46dedc8e88d',
31
+ message: '(service my-ecs-service) was unable to place a task ' \
32
+ 'because no container instance met all of its requirements. The ' \
33
+ 'closest matching (container-instance ' \
34
+ '3f4de1c5-ffdd-4954-af7e-75b4be0c8841) is already using a port ' \
35
+ 'required by your task. For more information, see the ' \
36
+ 'Troubleshooting section of the Amazon ECS Developer Guide.'
37
+ }
38
+ ],
39
+ load_balancers: [
40
+ ],
41
+ pending_count: 0,
42
+ running_count: 0,
43
+ service_arn: 'arn:aws:ecs:us-east-1:123456789012:service/my-ecs-service',
44
+ service_name: 'my-ecs-service',
45
+ status: 'ACTIVE',
46
+ task_definition: 'arn:aws:ecs:us-east-1:123456789012:task-definition/my-ecs-task-definition:8'
47
+ }
48
+ ]
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,58 @@
1
+ Aws.config[:ecs] = {
2
+ stub_responses: {
3
+ describe_task_definition: {
4
+ task_definition: {
5
+ container_definitions: [
6
+ {
7
+ name: 'wordpress',
8
+ cpu: 10,
9
+ environment: [
10
+ ],
11
+ essential: true,
12
+ image: 'wordpress',
13
+ links: [
14
+ 'mysql'
15
+ ],
16
+ memory: 500,
17
+ mount_points: [
18
+ ],
19
+ port_mappings: [
20
+ {
21
+ container_port: 80,
22
+ host_port: 80
23
+ }
24
+ ],
25
+ volumes_from: [
26
+ ]
27
+ },
28
+ {
29
+ name: 'mysql',
30
+ cpu: 10,
31
+ environment: [
32
+ {
33
+ name: 'MYSQL_ROOT_PASSWORD',
34
+ value: 'password'
35
+ }
36
+ ],
37
+ essential: true,
38
+ image: 'mysql',
39
+ memory: 500,
40
+ mount_points: [
41
+ ],
42
+ port_mappings: [
43
+ ],
44
+ volumes_from: [
45
+ ]
46
+ }
47
+ ],
48
+ status: 'ACTIVE',
49
+ family: 'my-ecs-task-definition',
50
+ revision: 8,
51
+ task_definition_arn: 'arn:aws:ecs:us-east-1:123456789012:task-definition/my-ecs-task-definition:8',
52
+ task_role_arn: 'arn:aws:iam::123456789012:role/my-iam-role',
53
+ volumes: [
54
+ ]
55
+ }
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,18 @@
1
+ module Awspec::Type
2
+ class EcrRepository < Base
3
+ aws_resource Aws::ECR::Types::Repository
4
+
5
+ def initialize(repository_name)
6
+ super
7
+ @display_name = repository_name
8
+ end
9
+
10
+ def resource_via_client
11
+ @resource_via_client ||= find_ecr_repository(@display_name)
12
+ end
13
+
14
+ def id
15
+ @id ||= resource_via_client.repository_name if resource_via_client
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,37 @@
1
+ module Awspec::Type
2
+ class EcsCluster < Base
3
+ aws_resource Aws::ECS::Types::Cluster
4
+
5
+ def initialize(name)
6
+ super
7
+ @display_name = name
8
+ end
9
+
10
+ def resource_via_client
11
+ @resource_via_client ||= find_ecs_cluster(@display_name)
12
+ end
13
+
14
+ def id
15
+ @id ||= resource_via_client.cluster_name if resource_via_client
16
+ end
17
+
18
+ def active?
19
+ resource_via_client.status == 'ACTIVE'
20
+ end
21
+
22
+ def inactive?
23
+ resource_via_client.status == 'INACTIVE'
24
+ end
25
+
26
+ def container_instance_arns
27
+ @container_instance_arns ||= list_ecs_container_instances(id)
28
+ end
29
+
30
+ def container_instances
31
+ return @container_instances if @container_instances
32
+ arns = container_instance_arns
33
+ @container_instances ||=
34
+ arns.empty? ? [] : find_ecs_container_instances(id, arns).map! { |ci| EcsContainerInstance.new(id, ci) }
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,32 @@
1
+ module Awspec::Type
2
+ class EcsContainerInstance < Base
3
+ aws_resource Aws::ECS::Types::ContainerInstance
4
+
5
+ attr_accessor :cluster_name
6
+
7
+ def initialize(container_instance)
8
+ super
9
+ @display_name = container_instance.split('/').last
10
+ end
11
+
12
+ def resource_via_client
13
+ @resource_via_client ||= find_ecs_container_instances(@cluster_name, [@display_name]).first
14
+ end
15
+
16
+ def id
17
+ @id ||= resource_via_client.container_instance_arn if resource_via_client
18
+ end
19
+
20
+ def cluster_name
21
+ @cluster_name || 'default'
22
+ end
23
+
24
+ def active?
25
+ resource_via_client.status == 'ACTIVE'
26
+ end
27
+
28
+ def inactive?
29
+ resource_via_client.status == 'INACTIVE'
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,30 @@
1
+ module Awspec::Type
2
+ class EcsService < Base
3
+ aws_resource Aws::ECS::Types::Service
4
+
5
+ def initialize(service)
6
+ super
7
+ @display_name = service
8
+ end
9
+
10
+ def resource_via_client
11
+ @resource_via_client ||= find_ecs_service(@display_name)
12
+ end
13
+
14
+ def id
15
+ @id ||= resource_via_client.service_name if resource_via_client
16
+ end
17
+
18
+ def active?
19
+ resource_via_client.status == 'ACTIVE'
20
+ end
21
+
22
+ def draining?
23
+ resource_via_client.status == 'DRAINING'
24
+ end
25
+
26
+ def inactive?
27
+ resource_via_client.status == 'INACTIVE'
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,26 @@
1
+ module Awspec::Type
2
+ class EcsTaskDefinition < Base
3
+ aws_resource Aws::ECS::Types::TaskDefinition
4
+
5
+ def initialize(taskdef)
6
+ super
7
+ @display_name = taskdef
8
+ end
9
+
10
+ def resource_via_client
11
+ @resource_via_client ||= find_ecs_task_definition(@display_name)
12
+ end
13
+
14
+ def id
15
+ @id ||= "#{resource_via_client.family}:#{resource_via_client.revision}" if resource_via_client
16
+ end
17
+
18
+ def active?
19
+ resource_via_client.status == 'ACTIVE'
20
+ end
21
+
22
+ def inactive?
23
+ resource_via_client.status == 'INACTIVE'
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.59.0'
2
+ VERSION = '0.60.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.59.0
4
+ version: 0.60.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-29 00:00:00.000000000 Z
11
+ date: 2016-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -266,6 +266,11 @@ files:
266
266
  - lib/awspec/generator/doc/type/directconnect_virtual_interface.rb
267
267
  - lib/awspec/generator/doc/type/ebs.rb
268
268
  - lib/awspec/generator/doc/type/ec2.rb
269
+ - lib/awspec/generator/doc/type/ecr_repository.rb
270
+ - lib/awspec/generator/doc/type/ecs_cluster.rb
271
+ - lib/awspec/generator/doc/type/ecs_container_instance.rb
272
+ - lib/awspec/generator/doc/type/ecs_service.rb
273
+ - lib/awspec/generator/doc/type/ecs_task_definition.rb
269
274
  - lib/awspec/generator/doc/type/elasticache.rb
270
275
  - lib/awspec/generator/doc/type/elasticache_cache_parameter_group.rb
271
276
  - lib/awspec/generator/doc/type/elasticsearch.rb
@@ -330,6 +335,8 @@ files:
330
335
  - lib/awspec/helper/finder/directconnect.rb
331
336
  - lib/awspec/helper/finder/ebs.rb
332
337
  - lib/awspec/helper/finder/ec2.rb
338
+ - lib/awspec/helper/finder/ecr.rb
339
+ - lib/awspec/helper/finder/ecs.rb
333
340
  - lib/awspec/helper/finder/elasticache.rb
334
341
  - lib/awspec/helper/finder/elasticsearch.rb
335
342
  - lib/awspec/helper/finder/elastictranscoder.rb
@@ -383,6 +390,12 @@ files:
383
390
  - lib/awspec/stub/duplicated_resource_type.rb
384
391
  - lib/awspec/stub/ebs.rb
385
392
  - lib/awspec/stub/ec2.rb
393
+ - lib/awspec/stub/ecr_repository.rb
394
+ - lib/awspec/stub/ecs.rb
395
+ - lib/awspec/stub/ecs_cluster.rb
396
+ - lib/awspec/stub/ecs_container_instance.rb
397
+ - lib/awspec/stub/ecs_service.rb
398
+ - lib/awspec/stub/ecs_task_definition.rb
386
399
  - lib/awspec/stub/elasticache.rb
387
400
  - lib/awspec/stub/elasticache_cache_parameter_group.rb
388
401
  - lib/awspec/stub/elasticsearch.rb
@@ -423,6 +436,11 @@ files:
423
436
  - lib/awspec/type/directconnect_virtual_interface.rb
424
437
  - lib/awspec/type/ebs.rb
425
438
  - lib/awspec/type/ec2.rb
439
+ - lib/awspec/type/ecr_repository.rb
440
+ - lib/awspec/type/ecs_cluster.rb
441
+ - lib/awspec/type/ecs_container_instance.rb
442
+ - lib/awspec/type/ecs_service.rb
443
+ - lib/awspec/type/ecs_task_definition.rb
426
444
  - lib/awspec/type/elasticache.rb
427
445
  - lib/awspec/type/elasticache_cache_parameter_group.rb
428
446
  - lib/awspec/type/elasticsearch.rb