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 ¶
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"` // Name string `json:"name"` // Returns event types that are currently reporting in the account. ReportingEventTypes []string `json:"reportingEventTypes"` }
AccountOutline - The `AccountOutline` object provides basic data about an account.
type Accounts ¶
type Accounts struct {
// contains filtered or unexported fields
}
Accounts is used to interact 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.
type ListAccountsParams ¶
type ListAccountsParams struct {
Scope *RegionScope
}
ListAccountsParams represents the input parameters for the ListAcounts method.