config

package
v0.67.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 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 Personal API key to communicate with the backend New Relic APIs that power the client. See the API key documentation below for more information on how to locate this key:

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 Compression = struct {
	None CompressionType
	Gzip CompressionType
}{
	None: "",
	Gzip: "gzip",
}

Compression is an Enum of compression types available

Functions

This section is empty.

Types

type CompressionType added in v0.26.0

type CompressionType string

CompressionType to use during transport.

func ParseCompression added in v0.26.0

func ParseCompression(name string) CompressionType

ParseCompression takes a named compression and returns the Type

func (CompressionType) String added in v0.26.0

func (c CompressionType) String() string

String returns the name of the compression type

type Config

type Config struct {
	// LicenseKey to authenticate Log API requests
	// see: https://docs.newrelic.com/docs/accounts/accounts-billing/account-setup/new-relic-license-key
	LicenseKey string

	// 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
	// Deprecated.  Use a Personal API key for authentication.
	// see: https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#admin
	AdminAPIKey string

	// InsightsInsertKey to send custom events to Insights
	InsightsInsertKey string

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

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

	// Compression used in sending data in HTTP requests.
	Compression CompressionType

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