class OvirtSDK4::ExternalHostProviderReader
Public Class Methods
read_link(reader, object)
click to toggle source
# File lib/ovirtsdk4/readers.rb, line 5434 def self.read_link(reader, object) # Process the attributes: rel = reader.get_attribute('rel') href = reader.get_attribute('href') if rel && href list = List.new list.href = href case rel when 'certificates' object.certificates = list when 'computeresources' object.compute_resources = list when 'discoveredhosts' object.discovered_hosts = list when 'hostgroups' object.host_groups = list when 'hosts' object.hosts = list end end # Discard the rest of the element: reader.next_element end
read_many(reader)
click to toggle source
# File lib/ovirtsdk4/readers.rb, line 5410 def self.read_many(reader) # Do nothing if there aren't more tags: list = List.new return list unless reader.forward # Process the attributes: list.href = reader.get_attribute('href') # Discard the start tag: empty = reader.empty_element? reader.read return list if empty # Process the inner elements: while reader.forward do list << read_one(reader) end # Discard the end tag: reader.read return list end
read_one(reader)
click to toggle source
# File lib/ovirtsdk4/readers.rb, line 5330 def self.read_one(reader) # Do nothing if there aren't more tags: return nil unless reader.forward # Create the object: object = ExternalHostProvider.new # Process the attributes: object.href = reader.get_attribute('href') value = reader.get_attribute('authentication_url') object.authentication_url = value if not value.nil? value = reader.get_attribute('comment') object.comment = value if not value.nil? value = reader.get_attribute('description') object.description = value if not value.nil? value = reader.get_attribute('id') object.id = value if not value.nil? value = reader.get_attribute('name') object.name = value if not value.nil? value = reader.get_attribute('password') object.password = value if not value.nil? value = reader.get_attribute('requires_authentication') object.requires_authentication = value if not value.nil? value = reader.get_attribute('url') object.url = value if not value.nil? value = reader.get_attribute('username') object.username = value if not value.nil? # Discard the start tag: empty = reader.empty_element? reader.read return object if empty # Process the inner elements: while reader.forward do case reader.node_name when 'authentication_url' object.authentication_url = Reader.read_string(reader) when 'comment' object.comment = Reader.read_string(reader) when 'description' object.description = Reader.read_string(reader) when 'id' object.id = Reader.read_string(reader) when 'name' object.name = Reader.read_string(reader) when 'password' object.password = Reader.read_string(reader) when 'properties' object.properties = PropertyReader.read_many(reader) when 'requires_authentication' object.requires_authentication = Reader.read_boolean(reader) when 'url' object.url = Reader.read_string(reader) when 'username' object.username = Reader.read_string(reader) when 'certificates' object.certificates = CertificateReader.read_many(reader) when 'compute_resources' object.compute_resources = ExternalComputeResourceReader.read_many(reader) when 'discovered_hosts' object.discovered_hosts = ExternalDiscoveredHostReader.read_many(reader) when 'host_groups' object.host_groups = ExternalHostGroupReader.read_many(reader) when 'hosts' object.hosts = HostReader.read_many(reader) when 'link' read_link(reader, object) else reader.next_element end end # Discard the end tag: reader.read return object end