Class: OvirtSDK4::OpenstackVolumeProviderService

Inherits:
ExternalProviderService show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary (collapse)

Instance Method Details

- (OpenstackVolumeAuthenticationKeysService) authentication_keys_service

Locates the authentication_keys service.

Returns:



14776
14777
14778
# File 'lib/ovirtsdk4/services.rb', line 14776

def authentication_keys_service
  return OpenstackVolumeAuthenticationKeysService.new(@connection, "#{@path}/authenticationkeys")
end

- (ExternalProviderCertificatesService) certificates_service

Locates the certificates service.

Returns:



14784
14785
14786
# File 'lib/ovirtsdk4/services.rb', line 14784

def certificates_service
  return ExternalProviderCertificatesService.new(@connection, "#{@path}/certificates")
end

- (OpenStackVolumeProvider) get(opts = {})

Returns the representation of the object managed by this service.

Parameters:

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

    Additional options.

Returns:



14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
# File 'lib/ovirtsdk4/services.rb', line 14658

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

- (Object) import_certificates(opts = {})

Executes the import_certificates method.



14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
# File 'lib/ovirtsdk4/services.rb', line 14678

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.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the remove should be performed asynchronously.



14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
# File 'lib/ovirtsdk4/services.rb', line 14705

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)


14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
# File 'lib/ovirtsdk4/services.rb', line 14803

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'authenticationkeys'
    return authentication_keys_service
  end
  if path.start_with?('authenticationkeys/')
    return authentication_keys_service.service(path[19..-1])
  end
  if path == 'certificates'
    return certificates_service
  end
  if path.start_with?('certificates/')
    return certificates_service.service(path[13..-1])
  end
  if path == 'volumetypes'
    return volume_types_service
  end
  if path.start_with?('volumetypes/')
    return volume_types_service.service(path[12..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

- (Object) test_connectivity(opts = {})

Executes the test_connectivity method.



14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
# File 'lib/ovirtsdk4/services.rb', line 14722

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.

Returns:

  • (String)


14833
14834
14835
# File 'lib/ovirtsdk4/services.rb', line 14833

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

- (Object) update(provider)

Updates the object managed by this service.



14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
# File 'lib/ovirtsdk4/services.rb', line 14745

def update(provider)
  if provider.is_a?(Hash)
    provider = OvirtSDK4::OpenStackVolumeProvider.new(provider)
  end
  request = Request.new(:method => :PUT, :path => @path)
  begin
    writer = XmlWriter.new(nil, true)
    OpenStackVolumeProviderWriter.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 OpenStackVolumeProviderReader.read_one(reader)
    ensure
      reader.close
    end
    return result
  else
    check_fault(response)
  end
end

- (OpenstackVolumeTypesService) volume_types_service

Locates the volume_types service.

Returns:



14792
14793
14794
# File 'lib/ovirtsdk4/services.rb', line 14792

def volume_types_service
  return OpenstackVolumeTypesService.new(@connection, "#{@path}/volumetypes")
end