terraform/vendor/github.com/paultyng/go-newrelic/api/types.go

121 lines
4.8 KiB
Go

package api
import "errors"
var (
ErrNotFound = errors.New("newrelic: Resource not found")
)
// LabelLinks represents external references on the Label.
type LabelLinks struct {
Applications []int `json:"applications"`
Servers []int `json:"servers"`
}
// Label represents a New Relic label.
type Label struct {
Key string `json:"key,omitempty"`
Category string `json:"category,omitempty"`
Name string `json:"name,omitempty"`
Links LabelLinks `json:"links,omitempty"`
}
// AlertPolicy represents a New Relic alert policy.
type AlertPolicy struct {
ID int `json:"id,omitempty"`
IncidentPreference string `json:"incident_preference,omitempty"`
Name string `json:"name,omitempty"`
CreatedAt int `json:"created_at,omitempty"`
UpdatedAt int `json:"updated_at,omitempty"`
}
// AlertConditionUserDefined represents user defined metrics for the New Relic alert condition.
type AlertConditionUserDefined struct {
Metric string `json:"metric,omitempty"`
ValueFunction string `json:"value_function,omitempty"`
}
// AlertConditionTerm represents the terms of a New Relic alert condition.
type AlertConditionTerm struct {
Duration int `json:"duration,string,omitempty"`
Operator string `json:"operator,omitempty"`
Priority string `json:"priority,omitempty"`
Threshold float64 `json:"threshold,string,omitempty"`
TimeFunction string `json:"time_function,omitempty"`
}
// AlertCondition represents a New Relic alert condition.
// TODO: custom unmarshal entities to ints?
// TODO: handle unmarshaling .75 for float (not just 0.75)
type AlertCondition struct {
PolicyID int `json:"-"`
ID int `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Enabled bool `json:"enabled,omitempty"`
Entities []string `json:"entities,omitempty"`
Metric string `json:"metric,omitempty"`
RunbookURL string `json:"runbook_url,omitempty"`
Terms []AlertConditionTerm `json:"terms,omitempty"`
UserDefined AlertConditionUserDefined `json:"uder_defined,omitempty"`
}
// AlertChannelLinks represent the links between policies and alert channels
type AlertChannelLinks struct {
PolicyIDs []int `json:"policy_ids,omitempty"`
}
// AlertChannel represents a New Relic alert notification channel
type AlertChannel struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Configuration map[string]interface{} `json:"configuration,omitempty"`
Links AlertChannelLinks `json:"links,omitempty"`
}
type ApplicationSummary struct {
ResponseTime float64 `json:"response_time"`
Throughput float64 `json:"throughput"`
ErrorRate float64 `json:"error_rate"`
ApdexTarget float64 `json:"apdex_target"`
ApdexScore float64 `json:"apdex_score"`
HostCount int `json:"host_count"`
InstanceCount int `json:"instance_count"`
ConcurrentInstanceCount int `json:"concurrent_instance_count"`
}
type ApplicationEndUserSummary struct {
ResponseTime float64 `json:"response_time"`
Throughput float64 `json:"throughput"`
ApdexTarget float64 `json:"apdex_target"`
ApdexScore float64 `json:"apdex_score"`
}
type ApplicationSettings struct {
AppApdexThreshold float64 `json:"app_apdex_threshold,omitempty"`
EndUserApdexThreshold float64 `json:"end_user_apdex_threshold,omitempty"`
EnableRealUserMonitoring bool `json:"enable_real_user_monitoring,omitempty"`
UseServerSideConfig bool `json:"use_server_side_config,omitempty"`
}
type ApplicationLinks struct {
ServerIDs []int `json:"servers,omitempty"`
HostIDs []int `json:"application_hosts,omitempty"`
InstanceIDs []int `json:"application_instances,omitempty"`
AlertPolicyID int `json:"alert_policy"`
}
type Application struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Language string `json:"language,omitempty"`
HealthStatus string `json:"health_status,omitempty"`
Reporting bool `json:"reporting,omitempty"`
LastReportedAt string `json:"last_reported_at,omitempty"`
Summary ApplicationSummary `json:"application_summary,omitempty"`
EndUserSummary ApplicationEndUserSummary `json:"end_user_summary,omitempty"`
Settings ApplicationSettings `json:"settings,omitempty"`
Links ApplicationLinks `json:"links,omitempty"`
}