diff options
Diffstat (limited to 'src/go/collectors/go.d.plugin/modules/vcsa/init.go')
-rw-r--r-- | src/go/collectors/go.d.plugin/modules/vcsa/init.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/vcsa/init.go b/src/go/collectors/go.d.plugin/modules/vcsa/init.go new file mode 100644 index 000000000..112239428 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/vcsa/init.go @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package vcsa + +import ( + "errors" + + "github.com/netdata/netdata/go/go.d.plugin/modules/vcsa/client" + "github.com/netdata/netdata/go/go.d.plugin/pkg/web" +) + +func (vc *VCSA) validateConfig() error { + if vc.URL == "" { + return errors.New("URL not set") + } + if vc.Username == "" || vc.Password == "" { + return errors.New("username or password not set") + } + return nil +} + +func (vc *VCSA) initHealthClient() (*client.Client, error) { + httpClient, err := web.NewHTTPClient(vc.Client) + if err != nil { + return nil, err + } + + return client.New(httpClient, vc.URL, vc.Username, vc.Password), nil +} |