Class: KnuckleCluster::EcsAgentRegistry

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/knuckle_cluster/ecs_agent_registry.rb

Instance Method Summary collapse

Constructor Details

#initialize(aws_client_config:, cluster_name:, hide: {}) ⇒ EcsAgentRegistry

Returns a new instance of EcsAgentRegistry.



10
11
12
13
14
# File 'lib/knuckle_cluster/ecs_agent_registry.rb', line 10

def initialize(aws_client_config:, cluster_name:, hide: {})
  @aws_client_config = aws_client_config
  @cluster_name      = cluster_name
  @hide              = hide
end

Instance Method Details

#agentsObject



16
17
18
# File 'lib/knuckle_cluster/ecs_agent_registry.rb', line 16

def agents
  @agents ||= load_agents
end

#find_by(container_instance_arn:) ⇒ Object



20
21
22
# File 'lib/knuckle_cluster/ecs_agent_registry.rb', line 20

def find_by(container_instance_arn:)
  agents_by_container_instance_arn[container_instance_arn]&.first
end

#output_agentsObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/knuckle_cluster/ecs_agent_registry.rb', line 24

def output_agents
  tp agents,
    :index,
    :instance_id,
    # :public_ip,
    # :private_ip,
    # :availability_zone,
    { task: { display_method: 'tasks.name', width: 999 } },
    { container: { display_method: 'tasks.containers.name', width: 999 } }
end