github.com/netdata/go.d.plugin@v0.58.1/modules/vcsa/init.go (about) 1 // SPDX-License-Identifier: GPL-3.0-or-later 2 3 package vcsa 4 5 import ( 6 "errors" 7 8 "github.com/netdata/go.d.plugin/modules/vcsa/client" 9 "github.com/netdata/go.d.plugin/pkg/web" 10 ) 11 12 func (vc *VCSA) validateConfig() error { 13 if vc.URL == "" { 14 return errors.New("URL not set") 15 } 16 if vc.Username == "" || vc.Password == "" { 17 return errors.New("username or password not set") 18 } 19 return nil 20 } 21 22 func (vc *VCSA) initHealthClient() (*client.Client, error) { 23 httpClient, err := web.NewHTTPClient(vc.Client) 24 if err != nil { 25 return nil, err 26 } 27 28 return client.New(httpClient, vc.URL, vc.Username, vc.Password), nil 29 }