NAME
Sys::Async::Virt::Connection::Factory - Class for instantiation of connection objects
VERSION
v0.0.11
SYNOPSIS
use v5.26;
use Future::AsyncAwait;
use Sys::Async::Virt::Connection::Factory;
my $factory = Sys::Async::Virt::Connection::Factory->new(
drivers => [
{ transport => '', class => 'Local', host => 0 },
{ transport => 'unix', class => 'Local', host => 0 },
]
);
my $conn = $factory->create_connection( 'qemu+unix:///system' );
DESCRIPTION
This module provides a central entrypoint to instantiate connections to LibVirt servers for configured means of transport.
VARIABLES
@default_drivers
push @Sys::Async::Virt::Connection::Factory::default_drivers,
{ transport => 'tls', class => 'TCP' };
List of drivers to be used when no drivers have been provided to the factory's new
constructor.
CONSTRUCTOR
new
Accepts the following named parameters:
drivers
An array mapping URLs to driver classes. Each array entry is a hash with the following keys:
transport
An empty string if no transport is specified; the part after the '+' in the URL protocol (i.e.
ssh
inqemu+ssh://
).host
A boolean indicating if a host value is allowed (
undef
), prohibited (0) or required (1).class
The (shortened) name of the driver class: Values not starting with a
+
, will haveSys::Async::Virt::Connection::
prepended; those which are starting with a+
will have it removed.E.g.
Local
will resolve toSys::Async::Virt::Connection::Local
and+YourPackage::Local
resolves toYourPackage::Local
.
The default value maps the following transports:
''
,unix
.
METHODS
create_connection
my $conn = $factory->create_connection( $url );
Instantiates the connection driver configured to service the given $url
.
SEE ALSO
LICENSE AND COPYRIGHT
Copyright (C) 2024 Erik Huelsmann
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.