Class: Assh::Core
- Inherits:
-
Object
- Object
- Assh::Core
- Defined in:
- lib/assh.rb
Instance Method Summary collapse
- #connect(name) ⇒ Object
-
#initialize(opts) ⇒ Core
constructor
A new instance of Core.
- #list(name) ⇒ Object
Constructor Details
#initialize(opts) ⇒ Core
Returns a new instance of Core.
6 7 8 |
# File 'lib/assh.rb', line 6 def initialize(opts) @opts = opts end |
Instance Method Details
#connect(name) ⇒ Object
10 11 12 13 14 |
# File 'lib/assh.rb', line 10 def connect(name) ip = name.ip_address puts "connecting to #{ip}" exec "ssh#{@opts.pem ? ' -i ' + @opts.pem : '' } #{@opts.user}@#{ip}" end |
#list(name) ⇒ Object
16 17 18 19 20 |
# File 'lib/assh.rb', line 16 def list(name) c = AWS::EC2.new :access_key_id => @opts.key, :secret_access_key => @opts.secret c.instances.tagged('Name').tagged_values(name) end |