config

package
v0.23.3 Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: Apache-2.0 Imports: 5 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

This section is empty.

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

	// 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

	// 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
	// contains filtered or unexported fields
}

Config contains all the configuration data for the API Client.

func New added in v0.20.0

func New() Config

New creates a default configuration and returns it

func (*Config) GetLogger added in v0.3.0

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

GetLogger returns a logger instance based on the config values.

func (*Config) Region

func (c *Config) Region() *region.Region

Region returns the region configuration struct if one has not been set, use the default region

func (*Config) SetRegion added in v0.20.0

func (c *Config) SetRegion(reg *region.Region) error

SetRegion configures the region

Jump to

Keyboard shortcuts

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