users

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package users provides a programmatic API for interacting with New Relic users. It can be used to retrieve details about the user.

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

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

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)

user, err := client.GetUser()
if err != nil {
	log.Fatal("error retrieving user:", err)
}

log.Printf("User name:  %s", user.Name)
log.Printf("User email: %s", user.Email)
log.Printf("User ID:    %d", user.ID)
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	// The `User` that is associated with the API key used in this request.
	User User `json:"user,omitempty"`
}

Actor - The `Actor` object contains fields that are scoped to the API user's access level.

type User

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

User - The `User` object provides general data about the user.

type UserReference

type UserReference struct {
	//
	Email string `json:"email,omitempty"`
	//
	Gravatar string `json:"gravatar,omitempty"`
	//
	ID int `json:"id,omitempty"`
	//
	Name string `json:"name,omitempty"`
}

UserReference - The `UserReference` object provides basic identifying information about the user.

type Users

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

Users is used to interact with New Relic users.

func New

func New(config config.Config) Users

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

func (*Users) GetUser

func (a *Users) GetUser() (*User, error)

The `User` that is associated with the API key used in this request.

func (*Users) GetUserWithContext

func (a *Users) GetUserWithContext(
	ctx context.Context,
) (*User, error)

The `User` that is associated with the API key used in this request.

Jump to

Keyboard shortcuts

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