Module: Shipitron::EcsClient

Instance Method Summary collapse

Instance Method Details

#ecs_client(region:) ⇒ Object



5
6
7
8
# File 'lib/shipitron/ecs_client.rb', line 5

def ecs_client(region:)
  @ecs_clients ||= {}
  @ecs_clients[region] ||= generate_ecs_client(region: region)
end

#generate_ecs_client(region:) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/shipitron/ecs_client.rb', line 10

def generate_ecs_client(region:)
  options = {region: region}
  if Shipitron.config.aws_access_key_id? && Shipitron.config.aws_secret_access_key
    options.merge!(
      access_key_id: Shipitron.config.aws_access_key_id,
      secret_access_key: Shipitron.config.aws_secret_access_key
    )
  end

  Aws::ECS::Client.new(options)
end