class Ctrl::Commands::Ssh

Public Instance Methods

instances() click to toggle source
# File lib/ctrl/commands/ssh.rb, line 7
def instances
  @instances ||= ListInstances.new(
    attributes.merge(instance_state: 'running')
  ).instances
end
nat_instance() click to toggle source
# File lib/ctrl/commands/ssh.rb, line 17
def nat_instance
  @nat_instance ||= ListInstances.new(
    attributes.merge(instance_state: 'running', instance_name: 'nat')
  ).instances.first
end
perform() click to toggle source
# File lib/ctrl/commands/ssh.rb, line 23
def perform
  cmd = Ctrl::SshCommand.new(
    nat_instance: nat_instance,
    target_instance: selected_instance
  )

  exec cmd.to_s
end
selected_instance() click to toggle source
# File lib/ctrl/commands/ssh.rb, line 13
def selected_instance
  @selected_instance ||= Ctrl::InstanceSelector.new(instances: instances).perform
end