Class: OvirtSDK4::DomainService

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

Instance Method Summary (collapse)

Instance Method Details

- (Domain) get(opts = {})

Returns the representation of the object managed by this service.

Parameters:

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

    Additional options.

Returns:



6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
# File 'lib/ovirtsdk4/services.rb', line 6060

def get(opts = {})
  query = {}
  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 DomainReader.read_one(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (DomainGroupsService) groups_service

Locates the groups service.

Returns:



6081
6082
6083
# File 'lib/ovirtsdk4/services.rb', line 6081

def groups_service
  return DomainGroupsService.new(@connection, "#{@path}/groups")
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.

Raises:

  • (Error)


6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
# File 'lib/ovirtsdk4/services.rb', line 6100

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'groups'
    return groups_service
  end
  if path.start_with?('groups/')
    return groups_service.service(path[7..-1])
  end
  if path == 'users'
    return users_service
  end
  if path.start_with?('users/')
    return users_service.service(path[6..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


6124
6125
6126
# File 'lib/ovirtsdk4/services.rb', line 6124

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

- (DomainUsersService) users_service

Locates the users service.

Returns:



6089
6090
6091
# File 'lib/ovirtsdk4/services.rb', line 6089

def users_service
  return DomainUsersService.new(@connection, "#{@path}/users")
end