Class: Inventory::Ecs::Service
- Inherits:
-
Base
- Object
- Base
- Inventory::Ecs::Service
show all
- Defined in:
- lib/inventory/ecs/service.rb
Instance Method Summary
collapse
Methods inherited from Base
eager_load!, inherited, #initialize, #report, #show, #sort, subclasses, #test_mode
#acm, #cfn, #cw, #eb, #ec2, #ecs, #elbv1, #elbv2, #iam, #pricing, #rds, #route53
Methods included from Shared
#instances, #security_groups
Instance Method Details
#cluster_name(cluster_arn) ⇒ Object
16
17
18
19
|
# File 'lib/inventory/ecs/service.rb', line 16
def cluster_name(cluster_arn)
resp = ecs.describe_clusters(clusters: [cluster_arn]) resp.clusters.first.cluster_name
end
|
#data ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/inventory/ecs/service.rb', line 6
def data
ecs_services.map do |service|
[
service.service_name,
cluster_name(service.cluster_arn),
service.running_count,
]
end
end
|
#ecs_services ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/inventory/ecs/service.rb', line 21
def ecs_services
cluster_arns = ecs.list_clusters.cluster_arns
@ecs_services ||= cluster_arns.map do |cluster_arn|
service_arns = ecs.list_services(cluster: cluster_arn).service_arns
resp = ecs.describe_services(services: service_arns, cluster: cluster_arn)
resp.services
end.flatten
end
|
2
3
4
|
# File 'lib/inventory/ecs/service.rb', line 2
def
["Service", "Cluster", "Running Tasks"]
end
|