github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/fastly/config.go (about) 1 package fastly 2 3 import ( 4 "fmt" 5 6 gofastly "github.com/sethvargo/go-fastly" 7 ) 8 9 type Config struct { 10 ApiKey string 11 } 12 13 type FastlyClient struct { 14 conn *gofastly.Client 15 } 16 17 func (c *Config) Client() (interface{}, error) { 18 var client FastlyClient 19 20 if c.ApiKey == "" { 21 return nil, fmt.Errorf("[Err] No API key for Fastly") 22 } 23 24 fconn, err := gofastly.NewClient(c.ApiKey) 25 if err != nil { 26 return nil, err 27 } 28 29 client.conn = fconn 30 return &client, nil 31 }