accounts

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package accounts provides a programmatic API for interacting with New Relic accounts.

Package accounts provides a programmatic API for interacting with New Relic accounts. It can be used to retrieve details about all accounts the user is authorized to view.

Authentication

You will need a valid Personal API key to communicate with the backend New Relic API that provides this functionality. 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

Code generated by tutone: DO NOT EDIT

Example (Accounts)
// Initialize the client configuration.  A Personal API key is required to
// communicate with the backend API.
cfg := config.New()
cfg.PersonalAPIKey = os.Getenv("NEW_RELIC_API_KEY")

// Initialize the client.
client := New(cfg)

// List the accounts this user is authorized to view.
params := ListAccountsParams{
	Scope: &RegionScopeTypes.GLOBAL,
}

accounts, err := client.ListAccounts(params)
if err != nil {
	log.Fatal("error retrieving accounts:", err)
}

log.Printf("accounts count: %d", len(accounts))
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var RegionScopeTypes = struct {
	// Do not filter by region
	GLOBAL RegionScope
	// Filter by region
	IN_REGION RegionScope
}{

	GLOBAL: "GLOBAL",

	IN_REGION: "IN_REGION",
}

Functions

This section is empty.

Types

type AccountOutline

type AccountOutline struct {
	//
	ID int `json:"id,omitempty"`
	//
	Name string `json:"name,omitempty"`
	// Returns event types that are currently reporting in the account.
	ReportingEventTypes []string `json:"reportingEventTypes,omitempty"`
}

AccountOutline - The `AccountOutline` object provides basic data about an account.

type AccountReference

type AccountReference struct {
	//
	ID int `json:"id,omitempty"`
	//
	Name string `json:"name,omitempty"`
}

AccountReference - The `AccountReference` object provides basic identifying information about the account.

type Accounts

type Accounts struct {
	// contains filtered or unexported fields
}

Accounts is used to interact with New Relic accounts.

func New

func New(config config.Config) Accounts

New returns a new client for interacting with New Relic accounts.

func (*Accounts) ListAccounts

func (e *Accounts) ListAccounts(params ListAccountsParams) ([]AccountOutline, error)

ListAccounts lists the accounts this user is authorized to view.

func (*Accounts) ListAccountsWithContext

func (e *Accounts) ListAccountsWithContext(ctx context.Context, params ListAccountsParams) ([]AccountOutline, error)

ListAccountsWithContext lists the accounts this user is authorized to view.

type ListAccountsParams

type ListAccountsParams struct {
	Scope *RegionScope
}

ListAccountsParams represents the input parameters for the ListAcounts method.

type RegionScope

type RegionScope string

RegionScope -

Jump to

Keyboard shortcuts

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