Class: OvirtSDK4::UnmanagedNetworksService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary (collapse)

Instance Method Details

- (Array<UnmanagedNetwork>) list(opts = {})

Returns the representation of the object managed by this service.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :max (Integer)

    Sets the maximum number of networks to return. If not specified all the networks are returned.

Returns:



22797
22798
22799
22800
22801
22802
22803
22804
22805
22806
22807
22808
22809
22810
22811
22812
22813
22814
22815
22816
22817
# File 'lib/ovirtsdk4/services.rb', line 22797

def list(opts = {})
  query = {}
  value = opts[:max]
  unless value.nil?
    value = Writer.render_integer(value)
    query['max'] = value
  end
  request = Request.new(:method => :GET, :path => @path, :query => query)
  response = @connection.send(request)
  case response.code
  when 200
    begin
      reader = XmlReader.new(response.body)
      return UnmanagedNetworkReader.read_many(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (Service) service(path)

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.



22837
22838
22839
22840
22841
22842
22843
22844
22845
22846
# File 'lib/ovirtsdk4/services.rb', line 22837

def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return unmanaged_network_service(path)
  end
  return unmanaged_network_service(path[0..(index - 1)]).service(path[(index +1)..-1])
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


22853
22854
22855
# File 'lib/ovirtsdk4/services.rb', line 22853

def to_s
  return "#<#{UnmanagedNetworksService}:#{@path}>"
end

- (UnmanagedNetworkService) unmanaged_network_service(id)

Locates the unmanaged_network service.

Parameters:

  • id (String)

    The identifier of the unmanaged_network.

Returns:



22826
22827
22828
# File 'lib/ovirtsdk4/services.rb', line 22826

def unmanaged_network_service(id)
  return UnmanagedNetworkService.new(@connection, "#{@path}/#{id}")
end