lib/osa/security_groups.rb
def find_by(type, data)
      case type
      when :id   then @sec_grp_objs.select {|security_group| security_group.id == data}
      when :name then @sec_grp_objs.select {|security_group| security_group.name == data}
      else
        raise "[+] Unknown search type '#{type}'. Only :id, :name allowed" unless (type == :id || type == :name)
      end
    end
# searches for a security group by id
#
# @param type [Symbol]
#   type id or name
#   the id format expected to be as open stack id format. (eg. "3d453836-1a44-44dc-a709-ea607a4ac462")
#
# @return [SecurityGroup] object
#
searches for a security group by id
searches for a security group by id
def find_by(type, data)
      case type
      when :id   then @sec_grp_objs.select {|security_group| security_group.id == data}
      when :name then @sec_grp_objs.select {|security_group| security_group.name == data}
      else
        raise "[+] Unknown search type '#{type}'. Only :id, :name allowed" unless (type == :id || type == :name)
      end
    end
def find_by ( type , data ) case type when :id then @sec_grp_objs . select { | security_group | security_group . id == data } when :name then @sec_grp_objs . select { | security_group | security_group . name == data } else raise "[+] Unknown search type '#{type}'. Only :id, :name allowed" unless ( type == :id || type == :name ) end end
searches for a security group by id
searches for a security group by id
None
SecurityGroup
type
type id or name the id format expected to be as open stack id format.
type id or name the id format expected to be as open stack id format .
data