lib/osa/servers.rb
#
# core parser, it expects Array of Hashes of server details from openstack.servers_detail,
#   parses the retrieved array from openstack.servers_detail then extracts the needed data
#   and build a Server object from this data.
#   currently, the needed data is [Server]:
#   id, name, status, addresses, security_groups, tenant_id
#
# @param servers [Array <Hash>]
#
# @example
#   openstack = OpenStack::Connection.main(connection)
#   servers_details = openstack.servers_detail
#   servers = Servers.parse(server_details)
#
# @return [Server] object
#
core parser, it expects Array of Hashes of server details from openstack.servers_detail,
parses the retrieved array from openstack.servers_detail then extracts the needed data
and build a Server object from this data.
currently, the needed data is [Server]:
id, name, status, addresses, security_groups, tenant_id
core parser it expects Array of Hashes of server details from openstack . servers_detail parses the retrieved array from openstack . servers_detail then extracts the needed data and build a Server object from this data . currently the needed data is [ Server ] : id name status addresses security_groups tenant_id
def parser(servers)
      @servers =
          servers.map do |server|
            Server.new(
                server[:id], server[:name], server[:status],
                parse_addresses(server[:addresses]),
                parse_security_groups(server[:security_groups]),
                server[:tenant_id]
            )
          end
      self
    end
def parser ( servers ) @servers = servers . map do | server | Server . new ( server [ :id ] , server [ :name ] , server [ :status ] , parse_addresses ( server [ :addresses ] ) , parse_security_groups ( server [ :security_groups ] ) , server [ :tenant_id ] ) end self end
core parser, it expects Array of Hashes of server details from openstack.servers_detail,
parses the retrieved array from openstack.servers_detail then extracts the needed data
and build a Server object from this data.
core parser it expects Array of Hashes of server details from openstack . servers_detail parses the retrieved array from openstack . servers_detail then extracts the needed data and build a Server object from this data .
# @!method parse server's addresses # @!method parse server's security_groups
None
Server
servers
None
example
openstack = OpenStack::Connection.main(connection) servers_details = openstack.servers_detail servers = Servers.parse(server_details)
openstack = OpenStack :: Connection . main ( connection ) servers_details = openstack . servers_detail servers = Servers . parse ( server_details )