github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/builtin/providers/cobbler/config.go (about) 1 package cobbler 2 3 import ( 4 "net/http" 5 6 cobbler "github.com/jtopjian/cobblerclient" 7 ) 8 9 type Config struct { 10 Url string 11 Username string 12 Password string 13 14 cobblerClient cobbler.Client 15 } 16 17 func (c *Config) loadAndValidate() error { 18 config := cobbler.ClientConfig{ 19 Url: c.Url, 20 Username: c.Username, 21 Password: c.Password, 22 } 23 24 client := cobbler.NewClient(http.DefaultClient, config) 25 _, err := client.Login() 26 if err != nil { 27 return err 28 } 29 30 c.cobblerClient = client 31 32 return nil 33 }