Creates a new implementation of the service.
@param connection [Connection] The connection to be used by this service.
@param path [String] The relative path of this service, for example `vms/123/disks`.
@api private
# File lib/ovirtsdk4/services.rb, line 31219 def initialize(connection, path) @connection = connection @path = path end
Returns the representation of the object managed by this service.
@param opts [Hash] Additional options.
@return [HostNic]
# File lib/ovirtsdk4/services.rb, line 31231 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 HostNicReader.read_one(reader) ensure reader.close end else check_fault(response) end end
Locates the `network_attachments` service.
@return [NetworkAttachmentsService] A reference to `network_attachments` service.
# File lib/ovirtsdk4/services.rb, line 31287 def network_attachments_service return NetworkAttachmentsService.new(@connection, "#{@path}/networkattachments") end
Locates the `network_labels` service.
@return [NetworkLabelsService] A reference to `network_labels` service.
# File lib/ovirtsdk4/services.rb, line 31295 def network_labels_service return NetworkLabelsService.new(@connection, "#{@path}/networklabels") end
Locates the service corresponding to the given path.
@param path [String] The path of the service.
@return [Service] A reference to the service.
# File lib/ovirtsdk4/services.rb, line 31332 def service(path) if path.nil? || path == '' return self end if path == 'networkattachments' return network_attachments_service end if path.start_with?('networkattachments/') return network_attachments_service.service(path[19..-1]) end if path == 'networklabels' return network_labels_service end if path.start_with?('networklabels/') return network_labels_service.service(path[14..-1]) end if path == 'statistics' return statistics_service end if path.start_with?('statistics/') return statistics_service.service(path[11..-1]) end if path == 'virtualfunctionallowedlabels' return virtual_function_allowed_labels_service end if path.start_with?('virtualfunctionallowedlabels/') return virtual_function_allowed_labels_service.service(path[29..-1]) end if path == 'virtualfunctionallowednetworks' return virtual_function_allowed_networks_service end if path.start_with?('virtualfunctionallowednetworks/') return virtual_function_allowed_networks_service.service(path[31..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end
Locates the `statistics` service.
@return [StatisticsService] A reference to `statistics` service.
# File lib/ovirtsdk4/services.rb, line 31303 def statistics_service return StatisticsService.new(@connection, "#{@path}/statistics") end
Returns an string representation of this service.
@return [String]
# File lib/ovirtsdk4/services.rb, line 31374 def to_s return "#<#{HostNicService}:#{@path}>" end
The action updates virtual function configuration in case the current resource represents an SR-IOV enabled NIC. The input should be consisted of at least one of the following properties:
`allNetworksAllowed`
`numberOfVirtualFunctions`
Please see the `HostNicVirtualFunctionsConfiguration` type for the meaning of the properties.
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the update should be performed asynchronously.
@option opts [HostNicVirtualFunctionsConfiguration] :virtual_functions_configuration
# File lib/ovirtsdk4/services.rb, line 31263 def update_virtual_functions_configuration(opts = {}) action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = Request.new({ :method => :POST, :path => "#{@path}/updatevirtualfunctionsconfiguration", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
Retrieves sub-collection resource of network labels that are allowed on an the virtual functions in case that the current resource represents an SR-IOV physical function NIC.
@return [NetworkLabelsService] A reference to `virtual_function_allowed_labels` service.
# File lib/ovirtsdk4/services.rb, line 31312 def virtual_function_allowed_labels_service return NetworkLabelsService.new(@connection, "#{@path}/virtualfunctionallowedlabels") end
Retrieves sub-collection resource of networks that are allowed on an the virtual functions in case that the current resource represents an SR-IOV physical function NIC.
@return [VirtualFunctionAllowedNetworksService] A reference to `virtual_function_allowed_networks` service.
# File lib/ovirtsdk4/services.rb, line 31321 def virtual_function_allowed_networks_service return VirtualFunctionAllowedNetworksService.new(@connection, "#{@path}/virtualfunctionallowednetworks") end