Class: OvirtSDK4::SnapshotNicsService

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

Instance Method Summary (collapse)

Instance Method Details

- (Array<Nic>) 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 NICs to return. If not specified all the NICs are returned.

Returns:



17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
# File 'lib/ovirtsdk4/services.rb', line 17756

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 NicReader.read_many(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (SnapshotNicService) nic_service(id)

Locates the nic service.

Parameters:

  • id (String)

    The identifier of the nic.

Returns:



17785
17786
17787
# File 'lib/ovirtsdk4/services.rb', line 17785

def nic_service(id)
  return SnapshotNicService.new(@connection, "#{@path}/#{id}")
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.



17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
# File 'lib/ovirtsdk4/services.rb', line 17796

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

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


17812
17813
17814
# File 'lib/ovirtsdk4/services.rb', line 17812

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