Class: OvirtSDK4::NetworkService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::NetworkService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (Network) get(opts = {})
Returns the representation of the object managed by this service.
-
- (NetworkLabelsService) network_labels_service
Locates the
network_labels
service. -
- (AssignedPermissionsService) permissions_service
Locates the
permissions
service. -
- (Object) remove(opts = {})
Deletes the object managed by this service.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (String) to_s
Returns an string representation of this service.
-
- (Object) update(network)
Updates the object managed by this service.
-
- (AssignedVnicProfilesService) vnic_profiles_service
Locates the
vnic_profiles
service.
Instance Method Details
- (Network) get(opts = {})
Returns the representation of the object managed by this service.
12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 |
# File 'lib/ovirtsdk4/services.rb', line 12350 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 NetworkReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (NetworkLabelsService) network_labels_service
Locates the network_labels
service.
12422 12423 12424 |
# File 'lib/ovirtsdk4/services.rb', line 12422 def network_labels_service return NetworkLabelsService.new(@connection, "#{@path}/networklabels") end |
- (AssignedPermissionsService) permissions_service
Locates the permissions
service.
12430 12431 12432 |
# File 'lib/ovirtsdk4/services.rb', line 12430 def return AssignedPermissionsService.new(@connection, "#{@path}/permissions") end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 |
# File 'lib/ovirtsdk4/services.rb', line 12374 def remove(opts = {}) query = {} value = opts[:async] unless value.nil? value = Writer.render_boolean(value) query['async'] = value end request = Request.new(:method => :DELETE, :path => @path, :query => query) response = @connection.send(request) unless response.code == 200 check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 |
# File 'lib/ovirtsdk4/services.rb', line 12449 def service(path) if path.nil? || path == '' return self 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 == 'permissions' return end if path.start_with?('permissions/') return .service(path[12..-1]) end if path == 'vnicprofiles' return vnic_profiles_service end if path.start_with?('vnicprofiles/') return vnic_profiles_service.service(path[13..-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.
12479 12480 12481 |
# File 'lib/ovirtsdk4/services.rb', line 12479 def to_s return "#<#{NetworkService}:#{@path}>" end |
- (Object) update(network)
Updates the object managed by this service.
12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 |
# File 'lib/ovirtsdk4/services.rb', line 12391 def update(network) if network.is_a?(Hash) network = OvirtSDK4::Network.new(network) end request = Request.new(:method => :PUT, :path => @path) begin writer = XmlWriter.new(nil, true) NetworkWriter.write_one(network, writer, 'network') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return NetworkReader.read_one(reader) ensure reader.close end return result else check_fault(response) end end |
- (AssignedVnicProfilesService) vnic_profiles_service
Locates the vnic_profiles
service.
12438 12439 12440 |
# File 'lib/ovirtsdk4/services.rb', line 12438 def vnic_profiles_service return AssignedVnicProfilesService.new(@connection, "#{@path}/vnicprofiles") end |