lib/osa/report/terminal_main_list.rb
def build_table_data(security_groups_map)
        rows = []
        security_groups_map.each do |_server|
          name         = _server.name
          status       = _server.status
          public_addr  = _server.addresses.public
          private_addr = _server.addresses.private
          sec_grp      = []
          protocol     = []
          from_port    = []
          to_port      = []
          ip_range     = []
          group        = []
          # server's security group details
          _server.security_groups.map do |sg|
            rules =  sg.rules
            rules.map do |rule|
              protocol     << rule.ip_protocol
              from_port    << rule.from_port
              to_port      << rule.to_port
              ip_range     << rule.ip_range
              # as we need security group to be aligned with its rules we've to
              # add the first label to the first rule then add nil for its other rules to
              # be a space when we .join("\n")
              sec_grp.include?(rule.parent_group_name)?  sec_grp << nil  : sec_grp << rule.parent_group_name
              group << rule.group
            end
          end

          rows << [ name, status, public_addr.join("\n"), private_addr.join("\n"),
                    sec_grp.join("\n"), protocol.join("\n"), from_port.join("\n"),
                    to_port.join("\n"), ip_range.join("\n"), group.join("\n") ]
        end

        rows
      end
# parse the table's  rows
#
# @param [Array <OSA::Servers::Server>]
#
# @return [Array]
#
parse the table's  rows
parse the table ' s rows
def build_table_data(security_groups_map)
        rows = []
        security_groups_map.each do |_server|
          name         = _server.name
          status       = _server.status
          public_addr  = _server.addresses.public
          private_addr = _server.addresses.private
          sec_grp      = []
          protocol     = []
          from_port    = []
          to_port      = []
          ip_range     = []
          group        = []
          _server.security_groups.map do |sg|
            rules =  sg.rules
            rules.map do |rule|
              protocol     << rule.ip_protocol
              from_port    << rule.from_port
              to_port      << rule.to_port
              ip_range     << rule.ip_range
              sec_grp.include?(rule.parent_group_name)?  sec_grp << nil  : sec_grp << rule.parent_group_name
              group << rule.group
            end
          end
          rows << [ name, status, public_addr.join("\n"), private_addr.join("\n"),
                    sec_grp.join("\n"), protocol.join("\n"), from_port.join("\n"),
                    to_port.join("\n"), ip_range.join("\n"), group.join("\n") ]
        end
        rows
      end
def build_table_data ( security_groups_map ) rows = [ ] security_groups_map . each do | _server | name = _server . name status = _server . status public_addr = _server . addresses . public private_addr = _server . addresses . private sec_grp = [ ] protocol = [ ] from_port = [ ] to_port = [ ] ip_range = [ ] group = [ ] _server . security_groups . map do | sg | rules = sg . rules rules . map do | rule | protocol << rule . ip_protocol from_port << rule . from_port to_port << rule . to_port ip_range << rule . ip_range sec_grp . include? ( rule . parent_group_name ) ? sec_grp << nil : sec_grp << rule . parent_group_name group << rule . group end end rows << [ name , status , public_addr . join ( "\n" ) , private_addr . join ( "\n" ) , sec_grp . join ( "\n" ) , protocol . join ( "\n" ) , from_port . join ( "\n" ) , to_port . join ( "\n" ) , ip_range . join ( "\n" ) , group . join ( "\n" ) ] end rows end
parse the table's  rows
parse the table ' s rows
# server's security group details # as we need security group to be aligned with its rules we've to # add the first label to the first rule then add nil for its other rules to # be a space when we .join("\n")
None
Array
security_groups_map
None