Rechercher

Ce contenu n'est pas disponible dans la langue sélectionnée.

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 Connection:initialize.

Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.