Class: OvirtSDK4::ExternalHostProviderService

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

Instance Method Summary collapse

Methods inherited from Service

#inspect, #to_s

Instance Method Details

#certificates_serviceExternalProviderCertificatesService

A service to view certificates for this external provider.

Returns:


36100
36101
36102
# File 'lib/ovirtsdk4/services.rb', line 36100

def certificates_service
  @certificates_service ||= ExternalProviderCertificatesService.new(self, 'certificates')
end

#compute_resources_serviceExternalComputeResourcesService

Locates the compute_resources service.

Returns:


36109
36110
36111
# File 'lib/ovirtsdk4/services.rb', line 36109

def compute_resources_service
  @compute_resources_service ||= ExternalComputeResourcesService.new(self, 'computeresources')
end

#discovered_hosts_serviceExternalDiscoveredHostsService

Locates the discovered_hosts service.

Returns:


36118
36119
36120
# File 'lib/ovirtsdk4/services.rb', line 36118

def discovered_hosts_service
  @discovered_hosts_service ||= ExternalDiscoveredHostsService.new(self, 'discoveredhosts')
end

#get(opts = {}) ⇒ ExternalHostProvider

Get external host provider information

Host provider, Foreman or Satellite, can be set as an external provider in ovirt. To see details about specific host providers attached to ovirt use this API.

For example, to get the details of host provider 123, send a request like this:

GET /ovirt-engine/api/externalhostproviders/123

The response will be like this:

<external_host_provider href="/ovirt-engine/api/externalhostproviders/123" id="123">
  <name>mysatellite</name>
  <requires_authentication>true</requires_authentication>
  <url>https://mysatellite.example.com</url>
  <username>admin</username>
</external_host_provider>

Parameters:

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

    Additional options.

Options Hash (opts):

  • :follow (String)

    Indicates which inner links should be followed. The objects referenced by these links will be fetched as part of the current request. See here for details.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:


35979
35980
35981
# File 'lib/ovirtsdk4/services.rb', line 35979

def get(opts = {})
  internal_get(GET, opts)
end

#host_groups_serviceExternalHostGroupsService

Locates the host_groups service.

Returns:


36127
36128
36129
# File 'lib/ovirtsdk4/services.rb', line 36127

def host_groups_service
  @host_groups_service ||= ExternalHostGroupsService.new(self, 'hostgroups')
end

#hosts_serviceExternalHostsService

Locates the hosts service.

Returns:


36136
36137
36138
# File 'lib/ovirtsdk4/services.rb', line 36136

def hosts_service
  @hosts_service ||= ExternalHostsService.new(self, 'hosts')
end

#import_certificates(opts = {}) ⇒ Object

Import the SSL certificates of the external host provider.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :certificates (Array<Certificate>)
  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


36005
36006
36007
# File 'lib/ovirtsdk4/services.rb', line 36005

def import_certificates(opts = {})
  internal_action(:importcertificates, nil, IMPORT_CERTIFICATES, opts)
end

#remove(opts = {}) ⇒ Object

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.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


36030
36031
36032
# File 'lib/ovirtsdk4/services.rb', line 36030

def remove(opts = {})
  internal_remove(REMOVE, opts)
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.

Raises:


36147
36148
36149
36150
36151
36152
36153
36154
36155
36156
36157
36158
36159
36160
36161
36162
36163
36164
36165
36166
36167
36168
36169
36170
36171
36172
36173
36174
36175
36176
36177
36178
36179
36180
36181
36182
# File 'lib/ovirtsdk4/services.rb', line 36147

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 == 'computeresources'
    return compute_resources_service
  end
  if path.start_with?('computeresources/')
    return compute_resources_service.service(path[17..-1])
  end
  if path == 'discoveredhosts'
    return discovered_hosts_service
  end
  if path.start_with?('discoveredhosts/')
    return discovered_hosts_service.service(path[16..-1])
  end
  if path == 'hostgroups'
    return host_groups_service
  end
  if path.start_with?('hostgroups/')
    return host_groups_service.service(path[11..-1])
  end
  if path == 'hosts'
    return hosts_service
  end
  if path.start_with?('hosts/')
    return hosts_service.service(path[6..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

#test_connectivity(opts = {}) ⇒ Object

In order to test connectivity for external provider we need to run following request where 123 is an id of a provider.

POST /ovirt-engine/api/externalhostproviders/123/testconnectivity

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the test should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


36062
36063
36064
# File 'lib/ovirtsdk4/services.rb', line 36062

def test_connectivity(opts = {})
  internal_action(:testconnectivity, nil, TEST_CONNECTIVITY, opts)
end

#update(provider, opts = {}) ⇒ ExternalHostProvider

Update the specified external host provider in the system.

Parameters:

  • provider (ExternalHostProvider)

    The provider to update.

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the update should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:


36091
36092
36093
# File 'lib/ovirtsdk4/services.rb', line 36091

def update(provider, opts = {})
  internal_update(provider, ExternalHostProvider, UPDATE, opts)
end