Class: Awshark::Ecs::Cluster

Inherits:
Object
  • Object
show all
Defined in:
lib/awshark/ecs/cluster.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arn) ⇒ Cluster

Returns a new instance of Cluster.



8
9
10
# File 'lib/awshark/ecs/cluster.rb', line 8

def initialize(arn)
  @arn = arn
end

Instance Attribute Details

#arnObject (readonly)

Returns the value of attribute arn.



6
7
8
# File 'lib/awshark/ecs/cluster.rb', line 6

def arn
  @arn
end

Instance Method Details

#nameObject



12
13
14
# File 'lib/awshark/ecs/cluster.rb', line 12

def name
  arn.split('/').last
end

#servicesObject



24
25
26
27
28
29
30
# File 'lib/awshark/ecs/cluster.rb', line 24

def services
  @services ||= begin
                  response = client.list_services(cluster: arn)
                  response = client.describe_services(cluster: arn, services: response.service_arns)
                  response.services
                end
end

#tasksObject



16
17
18
19
20
21
22
# File 'lib/awshark/ecs/cluster.rb', line 16

def tasks
  @tasks ||= begin
               response = client.list_tasks(cluster: arn)
               response = client.describe_tasks(cluster: arn, tasks: response.task_arns)
               response.tasks
             end
end