github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/softlayer/config.go (about) 1 package softlayer 2 3 import ( 4 "log" 5 6 slclient "github.com/maximilien/softlayer-go/client" 7 softlayer "github.com/maximilien/softlayer-go/softlayer" 8 ) 9 10 type Config struct { 11 Username string 12 ApiKey string 13 } 14 15 type Client struct { 16 virtualGuestService softlayer.SoftLayer_Virtual_Guest_Service 17 sshKeyService softlayer.SoftLayer_Security_Ssh_Key_Service 18 productOrderService softlayer.SoftLayer_Product_Order_Service 19 } 20 21 func (c *Config) Client() (*Client, error) { 22 slc := slclient.NewSoftLayerClient(c.Username, c.ApiKey) 23 virtualGuestService, err := slc.GetSoftLayer_Virtual_Guest_Service() 24 25 if err != nil { 26 return nil, err 27 } 28 29 sshKeyService, err := slc.GetSoftLayer_Security_Ssh_Key_Service() 30 31 client := &Client{ 32 virtualGuestService: virtualGuestService, 33 sshKeyService: sshKeyService, 34 } 35 36 log.Println("[INFO] Created SoftLayer client") 37 38 return client, nil 39 }