Search

Chapter 3. Ruby Examples

download PDF

3.1. Connecting to the Red Hat Virtualization Manager

The Connection class is the entry point of the software development kit. It provides access to the services of the Red Hat Virtualization Manager’s REST API.

The parameters of the Connection class are:

  • url - Base URL of the Red Hat Virtualization Manager API
  • username
  • password
  • ca_file - PEM file containing the trusted CA certificates. The ca.pem file is required when connecting to a server protected by TLS. If you do not specify the ca_file, the system-wide CA certificate store is used.

Connecting to the Red Hat Virtualization Manager

connection = OvirtSDK4::Connection.new(
  url: 'https://engine.example.com/ovirt-engine/api',
  username: 'admin@internal',
  password: '...',
  ca_file: 'ca.pem',
)

Important

The connection holds critical resources, including a pool of HTTP connections to the server and an authentication token. You must free these resources when they are no longer in use:

connection.close

The connection, and all the services obtained from it, cannot be used after the connection has been closed.

If the connection fails, the software development kit will raise an Error exception, containing details of the failure.

For more information, see http://www.rubydoc.info/gems/ovirt-engine-sdk/OvirtSDK4/Connection:initialize.

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.