-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclient.go
42 lines (35 loc) · 1.28 KB
/
client.go
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
34
35
36
37
38
39
40
41
42
// Package gowindows provides a Go library for interacting remotely with Windows-based systems.
package gowindows
import (
"github.com/d-strobel/gowindows/connection"
"github.com/d-strobel/gowindows/windows/dhcp"
"github.com/d-strobel/gowindows/windows/dns"
"github.com/d-strobel/gowindows/windows/local/accounts"
)
// Mockery generates mocks for the gowindows interfaces.
// Use "go generate" to update the mocks.
//go:generate go run github.com/vektra/mockery/v2
// Client represents a client object for interacting with Windows systems.
type Client struct {
Connection connection.Connection
LocalAccounts *accounts.Client
Dns *dns.Client
Dhcp *dhcp.Client
}
// NewClient returns a new instance of the Client object, initialized with the provided configuration.
// Use this client to execute functions within the Windows subpackages.
func NewClient(conn connection.Connection) *Client {
// Initialize a new client with the provided connection.
c := &Client{
Connection: conn,
}
// Build the client with the subpackages.
c.LocalAccounts = accounts.NewClient(c.Connection)
c.Dns = dns.NewClient(c.Connection)
c.Dhcp = dhcp.NewClient(c.Connection)
return c
}
// Close closes any open connection.
func (c *Client) Close() error {
return c.Connection.Close()
}