github.com/GoogleCloudPlatform/terraformer@v0.8.18/providers/newrelic/newrelic_service.go (about) 1 // Copyright 2019 The Terraformer Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package newrelic 16 17 import ( 18 "github.com/GoogleCloudPlatform/terraformer/terraformutils" 19 synthetics "github.com/dollarshaveclub/new-relic-synthetics-go" 20 newrelic "github.com/paultyng/go-newrelic/v4/api" 21 ) 22 23 type NewRelicService struct { //nolint 24 terraformutils.Service 25 } 26 27 func (s *NewRelicService) Client() (*newrelic.Client, error) { 28 client := newrelic.New(newrelic.Config{APIKey: s.GetArgs()["apiKey"].(string)}) 29 return &client, nil 30 } 31 32 func (s *NewRelicService) InfraClient() (*newrelic.InfraClient, error) { 33 client := newrelic.NewInfraClient(newrelic.Config{APIKey: s.GetArgs()["apiKey"].(string), Debug: s.Verbose}) 34 return &client, nil 35 } 36 37 func (s *NewRelicService) SyntheticsClient() (*synthetics.Client, error) { 38 conf := func(c *synthetics.Client) { 39 c.APIKey = s.GetArgs()["apiKey"].(string) 40 } 41 return synthetics.NewClient(conf) 42 }