Module: Stax::Sg

Defined in:
lib/stax/mixin/sg.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(thor) ⇒ Object



6
7
8
9
# File 'lib/stax/mixin/sg.rb', line 6

def self.included(thor)
  thor.desc(:sg, 'Security group subcommands')
  thor.subcommand(:sg, Cmd::Sg)
end

Instance Method Details

#get_my_ipObject

look up my local public IP



12
13
14
# File 'lib/stax/mixin/sg.rb', line 12

def get_my_ip
  URI.parse('http://v4.ident.me/').read + '/32'
end

#sg_authorize(id, cidr = get_my_ip, port = 22) ⇒ Object



16
17
18
# File 'lib/stax/mixin/sg.rb', line 16

def sg_authorize(id, cidr = get_my_ip, port = 22)
  Aws::Sg.authorize(id, cidr, port)
end

#sg_revoke(id, cidr = get_my_ip, port = 22) ⇒ Object



20
21
22
# File 'lib/stax/mixin/sg.rb', line 20

def sg_revoke(id, cidr = get_my_ip, port = 22)
  Aws::Sg.revoke(id, cidr, port)
end