blob: 41edc021c2dc80f814afb618ecd72c231ab4c27c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package libvirt
import (
"log"
libvirt "github.com/libvirt/libvirt-go"
)
// Config struct for the libvirt-provider
type Config struct {
URI string
}
// Client libvirt
type Client struct {
libvirt *libvirt.Connect
}
// Client libvirt, generate libvirt client given URI
func (c *Config) Client() (*Client, error) {
conn, err := libvirt.NewConnect(c.URI)
if err != nil {
return nil, err
}
client := &Client{
libvirt: conn,
}
log.Println("[INFO] Created libvirt client")
return client, nil
}
|