workloads

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: 6 Imported by: 3

Documentation

Overview

Package workloads provides a programmatic API for interacting with New Relic One workloads. It can be used to create, read, update, and delete workloads.

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

Package workloads provides a programmatic API for interacting with New Relic One workloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateInput

type CreateInput struct {
	EntityGUIDs         []string                 `json:"entityGuids,omitempty"`
	EntitySearchQueries []EntitySearchQueryInput `json:"entitySearchQueries,omitempty"`
	Name                string                   `json:"name,omitempty"`
	ScopeAccountsInput  *ScopeAccountsInput      `json:"scopeAccounts,omitempty"`
}

CreateInput represents the input parameters used for creating or updating a workload.

type DuplicateInput

type DuplicateInput struct {
	Name string `json:"name,omitempty"`
}

DuplicateInput represents the input object used to identify the workload to be duplicated.

type EntityRef

type EntityRef struct {
	GUID string `json:"guid,omitempty"`
}

EntityRef represents an entity referenced by this workload.

type EntitySearchQuery

type EntitySearchQuery struct {
	CreatedAt serialization.EpochTime  `json:"createdAt,omitempty"`
	CreatedBy UserReference            `json:"createdBy,omitempty"`
	ID        int                      `json:"id,omitempty"`
	Query     string                   `json:"query,omitempty"`
	UpdatedAt *serialization.EpochTime `json:"updatedAt,omitempty"`
}

EntitySearchQuery represents an entity search used by this workload.

type EntitySearchQueryInput

type EntitySearchQueryInput struct {
	Query string `json:"query,omitempty"`
}

EntitySearchQueryInput represents an entity search query for creating or updating a workload.

type ScopeAccounts

type ScopeAccounts struct {
	AccountIDs []int `json:"accountIds,omitempty"`
}

ScopeAccounts represents the accounts used to scope this workload.

type ScopeAccountsInput

type ScopeAccountsInput struct {
	AccountIDs []int `json:"accountIds,omitempty"`
}

ScopeAccountsInput is the input object containing accounts that will be used to get entities from.

type UpdateCollectionEntitySearchQueryInput

type UpdateCollectionEntitySearchQueryInput struct {
	ID int `json:"id,omitempty"`
	EntitySearchQueryInput
}

UpdateCollectionEntitySearchQueryInput represents an entity search query for creating or updating a workload.

type UpdateInput

type UpdateInput struct {
	EntityGUIDs         []string                 `json:"entityGuids,omitempty"`
	EntitySearchQueries []EntitySearchQueryInput `json:"entitySearchQueries,omitempty"`
	Name                string                   `json:"name,omitempty"`
	ScopeAccountsInput  *ScopeAccountsInput      `json:"scopeAccounts,omitempty"`
}

UpdateInput represents the input object used to identify the workload to be updated and its new changes.

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 represents a user referenced by this workload's search query.

type Workload

type Workload struct {
	Account             nerdgraph.AccountReference `json:"account,omitempty"`
	CreatedAt           serialization.EpochTime    `json:"createdAt,omitempty"`
	CreatedBy           UserReference              `json:"createdBy,omitempty"`
	Entities            []EntityRef                `json:"entities,omitempty"`
	EntitySearchQueries []EntitySearchQuery        `json:"entitySearchQueries,omitempty"`
	EntitySearchQuery   string                     `json:"entitySearchQuery,omitempty"`
	GUID                string                     `json:"guid,omitempty"`
	ID                  int                        `json:"id,omitempty"`
	Name                string                     `json:"name,omitempty"`
	Permalink           string                     `json:"permalink,omitempty"`
	ScopeAccounts       ScopeAccounts              `json:"scopeAccounts,omitempty"`
	UpdatedAt           *serialization.EpochTime   `json:"updatedAt,omitempty"`
}

Workload represents a New Relic One workload.

type Workloads

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

Workloads is used to communicate with the New Relic Workloads product.

func New

func New(config config.Config) Workloads

New returns a new client for interacting with New Relic One workloads.

func (*Workloads) CreateWorkload

func (e *Workloads) CreateWorkload(accountID int, workload CreateInput) (*Workload, error)

CreateWorkload creates a New Relic One workload.

func (*Workloads) DeleteWorkload

func (e *Workloads) DeleteWorkload(guid string) (*Workload, error)

DeleteWorkload deletes a New Relic One workload.

func (*Workloads) DuplicateWorkload

func (e *Workloads) DuplicateWorkload(accountID int, sourceGUID string, workload *DuplicateInput) (*Workload, error)

DuplicateWorkload duplicates a New Relic One workload.

func (*Workloads) GetWorkload

func (e *Workloads) GetWorkload(accountID int, workloadGUID string) (*Workload, error)

GetWorkload retrieves a New Relic One workload by its GUID.

func (*Workloads) ListWorkloads

func (e *Workloads) ListWorkloads(accountID int) ([]*Workload, error)

ListWorkloads retrieves a set of New Relic One workloads by their account ID.

func (*Workloads) UpdateWorkload

func (e *Workloads) UpdateWorkload(guid string, workload UpdateInput) (*Workload, error)

UpdateWorkload updates a New Relic One workload.

Jump to

Keyboard shortcuts

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