config

package
v0.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2020 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Overview

Package config provides cross-cutting configuration support for the newrelic-client-go project.

Package config provides a configuration surface area for configuring the underlying client.

Authentication

You will need a valid API key to communicate with the backend New Relic APIs that power the client. Using a Personal API key is the preferred method but an Admin API key is required for several different resource types. Check each package's documentation for more information on which key is required. See the API key documentation below for more information on how to locate these keys:

https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys

Index

Constants

This section is empty.

Variables

View Source
var RegionTypes = struct {
	US RegionType
	EU RegionType
}{
	US: "US",
	EU: "EU",
}

RegionTypes contains the possible values for New Relic region.

Functions

This section is empty.

Types

type Config

type Config struct {
	// PersonalAPIKey to authenticate API requests
	// see: https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#personal-api-key
	PersonalAPIKey string

	// AdminAPIKey to authenticate API requests
	// Note this will be deprecated in the future!
	// see: https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#admin
	AdminAPIKey string

	// Region of the New Relic platform to use
	Region RegionType

	// Timeout is the client timeout for HTTP requests.
	Timeout *time.Duration

	// HTTPTransport allows customization of the client's underlying transport.
	HTTPTransport http.RoundTripper

	// UserAgent updates the default user agent string used by the client.
	UserAgent string

	// BaseURL updates the default base URL used by the client during requests to
	// the V2 REST API.
	BaseURL string

	// SyntheticsBaseURL updates the default base URL used by the client during
	// requests to the Synthetics API.
	SyntheticsBaseURL string

	// InfrastructureBaseURL updates the default base URL used by the client during
	// requests to the Infrastructure API.
	InfrastructureBaseURL string

	// NerdGraph updates the default base URL used by the client during requests
	// to the NerdGraph API.
	NerdGraphBaseURL string

	// ServiceName is for New Relic internal use only.
	ServiceName string

	// LogLevel can be one of the following values:
	// "panic", "fatal", "error", "warn", "info", "debug", "trace"
	LogLevel string

	// LogJSON toggles formatting of log entries in JSON format.
	LogJSON bool

	// Logger allows customization of the client's underlying logger.
	Logger logging.Logger
}

Config contains all the configuration data for the API Client.

func (*Config) GetLogger added in v0.3.0

func (c *Config) GetLogger() logging.Logger

GetLogger returns a logger instance based on the config values.

type RegionType

type RegionType string

RegionType represents a New Relic region.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL