Class: OvirtSDK4::OpenstackVolumeAuthenticationKeyService

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

Instance Method Summary (collapse)

Instance Method Details

- (OpenstackVolumeAuthenticationKey) get(opts = {})

Returns the representation of the object managed by this service.

Parameters:

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

    Additional options.

Returns:



14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
# File 'lib/ovirtsdk4/services.rb', line 14422

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 OpenstackVolumeAuthenticationKeyReader.read_one(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (Object) remove(opts = {})

Deletes the object managed by this service.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the remove should be performed asynchronously.



14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
# File 'lib/ovirtsdk4/services.rb', line 14446

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.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.

Raises:

  • (Error)


14497
14498
14499
14500
14501
14502
# File 'lib/ovirtsdk4/services.rb', line 14497

def service(path)
  if path.nil? || path == ''
    return self
  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)


14509
14510
14511
# File 'lib/ovirtsdk4/services.rb', line 14509

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

- (Object) update(key)

Updates the object managed by this service.



14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
# File 'lib/ovirtsdk4/services.rb', line 14463

def update(key)
  if key.is_a?(Hash)
    key = OvirtSDK4::OpenstackVolumeAuthenticationKey.new(key)
  end
  request = Request.new(:method => :PUT, :path => @path)
  begin
    writer = XmlWriter.new(nil, true)
    OpenstackVolumeAuthenticationKeyWriter.write_one(key, writer, 'key')
    request.body = writer.string
  ensure
    writer.close
  end
  response = @connection.send(request)
  case response.code
  when 200
    begin
      reader = XmlReader.new(response.body)
      return OpenstackVolumeAuthenticationKeyReader.read_one(reader)
    ensure
      reader.close
    end
    return result
  else
    check_fault(response)
  end
end