github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/newrelic/config.go (about) 1 package newrelic 2 3 import ( 4 "log" 5 6 "github.com/hashicorp/terraform/helper/logging" 7 newrelic "github.com/paultyng/go-newrelic/api" 8 ) 9 10 // Config contains New Relic provider settings 11 type Config struct { 12 APIKey string 13 APIURL string 14 } 15 16 // Client returns a new client for accessing New Relic 17 func (c *Config) Client() (*newrelic.Client, error) { 18 nrConfig := newrelic.Config{ 19 APIKey: c.APIKey, 20 Debug: logging.IsDebugOrHigher(), 21 BaseURL: c.APIURL, 22 } 23 24 client := newrelic.New(nrConfig) 25 26 log.Printf("[INFO] New Relic client configured") 27 28 return &client, nil 29 }