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 ¶
- Variables
- type CreateInput
- type DuplicateInput
- type EntityRef
- type EntitySearchQuery
- type EntitySearchQueryInput
- type ScopeAccounts
- type ScopeAccountsInput
- type UpdateCollectionEntitySearchQueryInput
- type UpdateInput
- type UserReference
- type Workload
- type Workloads
- func (e *Workloads) CreateWorkload(accountID int, workload CreateInput) (*Workload, error)
- func (e *Workloads) DeleteWorkload(guid string) (*Workload, error)
- func (e *Workloads) DuplicateWorkload(accountID int, sourceGUID string, workload *DuplicateInput) (*Workload, error)
- func (e *Workloads) GetWorkload(accountID int, workloadID int) (*Workload, error)
- func (e *Workloads) ListWorkloads(accountID int) ([]*Workload, error)
- func (e *Workloads) UpdateWorkload(guid string, workload UpdateInput) (*Workload, error)
Constants ¶
This section is empty.
Variables ¶
var BaseURLs = region.NerdGraphBaseURLs
BaseURLs represents the base API URLs for the different environments of the New Relic NerdGraph API.
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"` Name string `json:"name,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 { Name *string `json:"name,omitempty"` 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 (*Workloads) CreateWorkload ¶
func (e *Workloads) CreateWorkload(accountID int, workload CreateInput) (*Workload, error)
CreateWorkload creates a New Relic One workload.
func (*Workloads) DeleteWorkload ¶
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 ¶
GetWorkload retrieve a New Relic One workload by its ID.
func (*Workloads) ListWorkloads ¶
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.