Class: OvirtSDK4::OpenstackImageProvidersService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::OpenstackImageProvidersService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (OpenStackImageProvider) add(provider, opts = {})
Adds a new
provider
. -
- (Array<OpenStackImageProvider>) list(opts = {})
Returns the representation of the object managed by this service.
-
- (OpenstackImageProviderService) provider_service(id)
Locates the
provider
service. -
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (String) to_s
Returns an string representation of this service.
Instance Method Details
- (OpenStackImageProvider) add(provider, opts = {})
Adds a new provider
.
13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 |
# File 'lib/ovirtsdk4/services.rb', line 13508 def add(provider, opts = {}) if provider.is_a?(Hash) provider = OvirtSDK4::OpenStackImageProvider.new(provider) end request = Request.new(:method => :POST, :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 201, 202 begin reader = XmlReader.new(response.body) return OpenStackImageProviderReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Array<OpenStackImageProvider>) list(opts = {})
Returns the representation of the object managed by this service.
13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 |
# File 'lib/ovirtsdk4/services.rb', line 13543 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 OpenStackImageProviderReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (OpenstackImageProviderService) provider_service(id)
Locates the provider
service.
13572 13573 13574 |
# File 'lib/ovirtsdk4/services.rb', line 13572 def provider_service(id) return OpenstackImageProviderService.new(@connection, "#{@path}/#{id}") end |
- (Service) service(path)
Locates the service corresponding to the given path.
13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 |
# File 'lib/ovirtsdk4/services.rb', line 13583 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return provider_service(path) end return provider_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
13599 13600 13601 |
# File 'lib/ovirtsdk4/services.rb', line 13599 def to_s return "#<#{OpenstackImageProvidersService}:#{@path}>" end |