Class: OvirtSDK4::OpenstackImageProviderService
- Inherits:
-
ExternalProviderService
- Object
- Service
- ExternalProviderService
- OvirtSDK4::OpenstackImageProviderService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (ExternalProviderCertificatesService) certificates_service
Locates the
certificates
service. -
- (OpenStackImageProvider) get(opts = {})
Returns the representation of the object managed by this service.
-
- (OpenstackImagesService) images_service
Locates the
images
service. -
- (Object) import_certificates(opts = {})
Executes the
import_certificates
method. -
- (Object) remove(opts = {})
Deletes the object managed by this service.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (Object) test_connectivity(opts = {})
Executes the
test_connectivity
method. -
- (String) to_s
Returns an string representation of this service.
-
- (Object) update(provider)
Updates the object managed by this service.
Instance Method Details
- (ExternalProviderCertificatesService) certificates_service
Locates the certificates
service.
13436 13437 13438 |
# File 'lib/ovirtsdk4/services.rb', line 13436 def certificates_service return ExternalProviderCertificatesService.new(@connection, "#{@path}/certificates") end |
- (OpenStackImageProvider) get(opts = {})
Returns the representation of the object managed by this service.
13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 |
# File 'lib/ovirtsdk4/services.rb', line 13318 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 OpenStackImageProviderReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (OpenstackImagesService) images_service
Locates the images
service.
13444 13445 13446 |
# File 'lib/ovirtsdk4/services.rb', line 13444 def images_service return OpenstackImagesService.new(@connection, "#{@path}/images") end |
- (Object) import_certificates(opts = {})
Executes the import_certificates
method.
13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 |
# File 'lib/ovirtsdk4/services.rb', line 13338 def import_certificates(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}/importcertificates", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 |
# File 'lib/ovirtsdk4/services.rb', line 13365 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.
13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 13469 13470 13471 13472 |
# File 'lib/ovirtsdk4/services.rb', line 13455 def service(path) if path.nil? || path == '' return self end if path == 'certificates' return certificates_service end if path.start_with?('certificates/') return certificates_service.service(path[13..-1]) end if path == 'images' return images_service end if path.start_with?('images/') return images_service.service(path[7..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
- (Object) test_connectivity(opts = {})
Executes the test_connectivity
method.
13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 |
# File 'lib/ovirtsdk4/services.rb', line 13382 def test_connectivity(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}/testconnectivity", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (String) to_s
Returns an string representation of this service.
13479 13480 13481 |
# File 'lib/ovirtsdk4/services.rb', line 13479 def to_s return "#<#{OpenstackImageProviderService}:#{@path}>" end |
- (Object) update(provider)
Updates the object managed by this service.
13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 |
# File 'lib/ovirtsdk4/services.rb', line 13405 def update(provider) if provider.is_a?(Hash) provider = OvirtSDK4::OpenStackImageProvider.new(provider) end request = Request.new(:method => :PUT, :path => @path) begin writer = XmlWriter.new(nil, true) OpenStackImageProviderWriter.write_one(provider, writer, 'provider') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return OpenStackImageProviderReader.read_one(reader) ensure reader.close end return result else check_fault(response) end end |