Class: Stax::Cmd::Sg

Inherits:
SubCommand show all
Defined in:
lib/stax/mixin/sg.rb

Instance Method Summary collapse

Methods inherited from SubCommand

#info, stax_info, stax_info_tasks

Instance Method Details

#authorize(id) ⇒ Object



82
83
84
# File 'lib/stax/mixin/sg.rb', line 82

def authorize(id)
  Aws::Sg.authorize(get_id(id), options.fetch(:cidr, get_my_ip), options[:port])
end

#inboundObject



64
65
66
67
68
69
# File 'lib/stax/mixin/sg.rb', line 64

def inbound
  stack_security_groups.each do |s|
    debug("Inbound permissions for #{s.logical_resource_id} #{s.physical_resource_id}")
    print_table sg_permissions(stack_security_group(s.physical_resource_id).first.ip_permissions)
  end
end

#lsObject



57
58
59
60
61
# File 'lib/stax/mixin/sg.rb', line 57

def ls
  print_table Aws::Sg.describe(stack_security_groups.map(&:physical_resource_id)).map { |s|
    [s.group_name, s.group_id, s.vpc_id, s.description]
  }
end

#outboundObject



72
73
74
75
76
77
# File 'lib/stax/mixin/sg.rb', line 72

def outbound
  stack_security_groups.each do |s|
    debug("Outbound permissions for #{s.logical_resource_id} #{s.physical_resource_id}")
    print_table sg_permissions(stack_security_group(s.physical_resource_id).first.ip_permissions_egress)
  end
end

#revoke(id) ⇒ Object



89
90
91
# File 'lib/stax/mixin/sg.rb', line 89

def revoke(id)
  Aws::Sg.revoke(get_id(id), options.fetch(:cidr, get_my_ip), options[:port])
end