Documentation ¶
Overview ¶
Package alerts provides a programmatic API for interacting with the New Relic Alerts product. It can be used for a variety of operations, including:
- Creating, reading, updating, and deleting alert policies
- Creating, reading, updating, and deleting alert notification channels
- Associating one or more notification channels with an alert policy
- Creating, reading, updating, and deleting APM alert conditions
- Creating, reading, updating, and deleting NRQL alert conditions
- Creating, reading, updating, and deleting Synthetics alert conditions
- Creating, reading, updating, and deleting multi-location Synthetics conditions
- Creating, reading, updating, and deleting Infrastructure alert conditions
- Creating, reading, updating, and deleting Plugins alert conditions
- Associating one or more alert conditions with a policy
Authentication ¶
You will need a valid API key to communicate with the backend New Relic APIs that provide this functionality. Use a Personal API key for authentication. 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 (Policy) ¶
// Initialize the client configuration. A Personal API key is required to // communicate with the backend API. // is deprecated. cfg := config.New() cfg.PersonalAPIKey = os.Getenv("NEW_RELIC_API_KEY") // Initialize the client. client := New(cfg) // Create a new alert policy. p := Policy{ Name: "Example alert policy", IncidentPreference: IncidentPreferenceTypes.PerCondition, } policy, err := client.CreatePolicy(p) if err != nil { log.Fatal("error creating policy:", err) } // Create a new alert notification channel. ec := Channel{ Name: "Example email notification channel", Type: ChannelTypes.Email, Configuration: ChannelConfiguration{ Recipients: "test@newrelic.com", IncludeJSONAttachment: "1", }, } emailChannel, err := client.CreateChannel(ec) if err != nil { log.Fatal("error creating notification channel:", err) } // Associate the new alert channel with the created policy. _, err = client.UpdatePolicyChannels(policy.ID, []int{emailChannel.ID}) if err != nil { log.Fatal("error associating policy with channel:", err) } // Create a new NRQL alert condition. nc := &NrqlCondition{ Name: "Example NRQL condition", Type: "static", RunbookURL: "https://www.example.com/myrunbook", Enabled: true, ValueFunction: ValueFunctionTypes.SingleValue, Nrql: NrqlQuery{ Query: "FROM Transaction SELECT average(duration) WHERE appName = 'Example Application'", SinceValue: "3", }, Terms: []ConditionTerm{ { Duration: 5, Operator: OperatorTypes.Above, Priority: PriorityTypes.Warning, Threshold: 3, TimeFunction: TimeFunctionTypes.All, }, { Duration: 5, Operator: OperatorTypes.Above, Priority: PriorityTypes.Critical, Threshold: 1, TimeFunction: TimeFunctionTypes.All, }, }, } _, err = client.CreateNrqlCondition(policy.ID, *nc) if err != nil { log.Fatal("error creating NRQL condition:", err) }
Output:
Index ¶
- Variables
- type AlertEvent
- type AlertPlugin
- type Alerts
- func (a *Alerts) AcknowledgeIncident(id int) (*Incident, error)
- func (a *Alerts) AcknowledgeIncidentWithContext(ctx context.Context, id int) (*Incident, error)
- func (a *Alerts) CloseIncident(id int) (*Incident, error)
- func (a *Alerts) CloseIncidentWithContext(ctx context.Context, id int) (*Incident, error)
- func (a *Alerts) CreateChannel(channel Channel) (*Channel, error)
- func (a *Alerts) CreateChannelWithContext(ctx context.Context, channel Channel) (*Channel, error)
- func (a *Alerts) CreateCondition(policyID int, condition Condition) (*Condition, error)
- func (a *Alerts) CreateConditionWithContext(ctx context.Context, policyID int, condition Condition) (*Condition, error)
- func (a *Alerts) CreateInfrastructureCondition(condition InfrastructureCondition) (*InfrastructureCondition, error)
- func (a *Alerts) CreateInfrastructureConditionWithContext(ctx context.Context, condition InfrastructureCondition) (*InfrastructureCondition, error)
- func (a *Alerts) CreateMultiLocationSyntheticsCondition(condition MultiLocationSyntheticsCondition, policyID int) (*MultiLocationSyntheticsCondition, error)
- func (a *Alerts) CreateMultiLocationSyntheticsConditionWithContext(ctx context.Context, condition MultiLocationSyntheticsCondition, policyID int) (*MultiLocationSyntheticsCondition, error)
- func (a *Alerts) CreateMutingRule(accountID int, rule MutingRuleCreateInput) (*MutingRule, error)
- func (a *Alerts) CreateMutingRuleWithContext(ctx context.Context, accountID int, rule MutingRuleCreateInput) (*MutingRule, error)
- func (a *Alerts) CreateNrqlCondition(policyID int, condition NrqlCondition) (*NrqlCondition, error)
- func (a *Alerts) CreateNrqlConditionBaselineMutation(accountID int, policyID string, nrqlCondition NrqlConditionCreateInput) (*NrqlAlertCondition, error)
- func (a *Alerts) CreateNrqlConditionBaselineMutationWithContext(ctx context.Context, accountID int, policyID string, ...) (*NrqlAlertCondition, error)
- func (a *Alerts) CreateNrqlConditionStaticMutation(accountID int, policyID string, nrqlCondition NrqlConditionCreateInput) (*NrqlAlertCondition, error)
- func (a *Alerts) CreateNrqlConditionStaticMutationWithContext(ctx context.Context, accountID int, policyID string, ...) (*NrqlAlertCondition, error)
- func (a *Alerts) CreateNrqlConditionWithContext(ctx context.Context, policyID int, condition NrqlCondition) (*NrqlCondition, error)
- func (a *Alerts) CreatePluginsCondition(policyID int, condition PluginsCondition) (*PluginsCondition, error)
- func (a *Alerts) CreatePluginsConditionWithContext(ctx context.Context, policyID int, condition PluginsCondition) (*PluginsCondition, error)
- func (a *Alerts) CreatePolicy(policy Policy) (*Policy, error)
- func (a *Alerts) CreatePolicyMutation(accountID int, policy AlertsPolicyInput) (*AlertsPolicy, error)
- func (a *Alerts) CreatePolicyMutationWithContext(ctx context.Context, accountID int, policy AlertsPolicyInput) (*AlertsPolicy, error)
- func (a *Alerts) CreatePolicyWithContext(ctx context.Context, policy Policy) (*Policy, error)
- func (a *Alerts) CreateSyntheticsCondition(policyID int, condition SyntheticsCondition) (*SyntheticsCondition, error)
- func (a *Alerts) CreateSyntheticsConditionWithContext(ctx context.Context, policyID int, condition SyntheticsCondition) (*SyntheticsCondition, error)
- func (a *Alerts) DeleteChannel(id int) (*Channel, error)
- func (a *Alerts) DeleteChannelWithContext(ctx context.Context, id int) (*Channel, error)
- func (a *Alerts) DeleteCondition(id int) (*Condition, error)
- func (a *Alerts) DeleteConditionMutation(accountID int, conditionID string) (string, error)
- func (a *Alerts) DeleteConditionMutationWithContext(ctx context.Context, accountID int, conditionID string) (string, error)
- func (a *Alerts) DeleteConditionWithContext(ctx context.Context, id int) (*Condition, error)
- func (a *Alerts) DeleteInfrastructureCondition(conditionID int) error
- func (a *Alerts) DeleteInfrastructureConditionWithContext(ctx context.Context, conditionID int) error
- func (a *Alerts) DeleteMultiLocationSyntheticsCondition(conditionID int) (*MultiLocationSyntheticsCondition, error)
- func (a *Alerts) DeleteMultiLocationSyntheticsConditionWithContext(ctx context.Context, conditionID int) (*MultiLocationSyntheticsCondition, error)
- func (a *Alerts) DeleteMutingRule(accountID int, ruleID int) error
- func (a *Alerts) DeleteMutingRuleWithContext(ctx context.Context, accountID int, ruleID int) error
- func (a *Alerts) DeleteNrqlCondition(id int) (*NrqlCondition, error)
- func (a *Alerts) DeleteNrqlConditionMutation(accountID int, conditionID string) (string, error)
- func (a *Alerts) DeleteNrqlConditionMutationWithContext(ctx context.Context, accountID int, conditionID string) (string, error)
- func (a *Alerts) DeleteNrqlConditionWithContext(ctx context.Context, id int) (*NrqlCondition, error)
- func (a *Alerts) DeletePluginsCondition(id int) (*PluginsCondition, error)
- func (a *Alerts) DeletePluginsConditionWithContext(ctx context.Context, id int) (*PluginsCondition, error)
- func (a *Alerts) DeletePolicy(id int) (*Policy, error)
- func (a *Alerts) DeletePolicyChannel(policyID int, channelID int) (*Channel, error)
- func (a *Alerts) DeletePolicyChannelWithContext(ctx context.Context, policyID int, channelID int) (*Channel, error)
- func (a *Alerts) DeletePolicyMutation(accountID int, id string) (*AlertsPolicy, error)
- func (a *Alerts) DeletePolicyMutationWithContext(ctx context.Context, accountID int, id string) (*AlertsPolicy, error)
- func (a *Alerts) DeletePolicyWithContext(ctx context.Context, id int) (*Policy, error)
- func (a *Alerts) DeleteSyntheticsCondition(conditionID int) (*SyntheticsCondition, error)
- func (a *Alerts) DeleteSyntheticsConditionWithContext(ctx context.Context, conditionID int) (*SyntheticsCondition, error)
- func (a *Alerts) GetChannel(id int) (*Channel, error)
- func (a *Alerts) GetChannelWithContext(ctx context.Context, id int) (*Channel, error)
- func (a *Alerts) GetCondition(policyID int, id int) (*Condition, error)
- func (a *Alerts) GetConditionWithContext(ctx context.Context, policyID int, id int) (*Condition, error)
- func (a *Alerts) GetInfrastructureCondition(conditionID int) (*InfrastructureCondition, error)
- func (a *Alerts) GetInfrastructureConditionWithContext(ctx context.Context, conditionID int) (*InfrastructureCondition, error)
- func (a *Alerts) GetMultiLocationSyntheticsCondition(policyID int, conditionID int) (*MultiLocationSyntheticsCondition, error)
- func (a *Alerts) GetMultiLocationSyntheticsConditionWithContext(ctx context.Context, policyID int, conditionID int) (*MultiLocationSyntheticsCondition, error)
- func (a *Alerts) GetMutingRule(accountID, ruleID int) (*MutingRule, error)
- func (a *Alerts) GetMutingRuleWithContext(ctx context.Context, accountID, ruleID int) (*MutingRule, error)
- func (a *Alerts) GetNrqlCondition(policyID int, id int) (*NrqlCondition, error)
- func (a *Alerts) GetNrqlConditionQuery(accountID int, conditionID string) (*NrqlAlertCondition, error)
- func (a *Alerts) GetNrqlConditionQueryWithContext(ctx context.Context, accountID int, conditionID string) (*NrqlAlertCondition, error)
- func (a *Alerts) GetNrqlConditionWithContext(ctx context.Context, policyID int, id int) (*NrqlCondition, error)
- func (a *Alerts) GetPluginsCondition(policyID int, pluginID int) (*PluginsCondition, error)
- func (a *Alerts) GetPluginsConditionWithContext(ctx context.Context, policyID int, pluginID int) (*PluginsCondition, error)
- func (a *Alerts) GetPolicy(id int) (*Policy, error)
- func (a *Alerts) GetPolicyWithContext(ctx context.Context, id int) (*Policy, error)
- func (a *Alerts) GetSyntheticsCondition(policyID int, conditionID int) (*SyntheticsCondition, error)
- func (a *Alerts) GetSyntheticsConditionWithContext(ctx context.Context, policyID int, conditionID int) (*SyntheticsCondition, error)
- func (a *Alerts) ListAlertEvents(params *ListAlertEventsParams) ([]*AlertEvent, error)
- func (a *Alerts) ListAlertEventsWithContext(ctx context.Context, params *ListAlertEventsParams) ([]*AlertEvent, error)
- func (a *Alerts) ListChannels() ([]*Channel, error)
- func (a *Alerts) ListChannelsWithContext(ctx context.Context) ([]*Channel, error)
- func (a *Alerts) ListConditions(policyID int) ([]*Condition, error)
- func (a *Alerts) ListConditionsWithContext(ctx context.Context, policyID int) ([]*Condition, error)
- func (a *Alerts) ListIncidents(onlyOpen bool, excludeViolations bool) ([]*Incident, error)
- func (a *Alerts) ListIncidentsWithContext(ctx context.Context, onlyOpen bool, excludeViolations bool) ([]*Incident, error)
- func (a *Alerts) ListInfrastructureConditions(policyID int) ([]InfrastructureCondition, error)
- func (a *Alerts) ListInfrastructureConditionsWithContext(ctx context.Context, policyID int) ([]InfrastructureCondition, error)
- func (a *Alerts) ListMultiLocationSyntheticsConditions(policyID int) ([]*MultiLocationSyntheticsCondition, error)
- func (a *Alerts) ListMultiLocationSyntheticsConditionsWithContext(ctx context.Context, policyID int) ([]*MultiLocationSyntheticsCondition, error)
- func (a *Alerts) ListMutingRules(accountID int) ([]MutingRule, error)
- func (a *Alerts) ListMutingRulesWithContext(ctx context.Context, accountID int) ([]MutingRule, error)
- func (a *Alerts) ListNrqlConditions(policyID int) ([]*NrqlCondition, error)
- func (a *Alerts) ListNrqlConditionsWithContext(ctx context.Context, policyID int) ([]*NrqlCondition, error)
- func (a *Alerts) ListPluginsConditions(policyID int) ([]*PluginsCondition, error)
- func (a *Alerts) ListPluginsConditionsWithContext(ctx context.Context, policyID int) ([]*PluginsCondition, error)
- func (a *Alerts) ListPolicies(params *ListPoliciesParams) ([]Policy, error)
- func (a *Alerts) ListPoliciesWithContext(ctx context.Context, params *ListPoliciesParams) ([]Policy, error)
- func (a *Alerts) ListSyntheticsConditions(policyID int) ([]*SyntheticsCondition, error)
- func (a *Alerts) ListSyntheticsConditionsWithContext(ctx context.Context, policyID int) ([]*SyntheticsCondition, error)
- func (a *Alerts) NerdGraphQueryWithContext(ctx context.Context, query string, vars map[string]interface{}, ...) error
- func (a *Alerts) QueryPolicy(accountID int, id string) (*AlertsPolicy, error)
- func (a *Alerts) QueryPolicySearch(accountID int, params AlertsPoliciesSearchCriteriaInput) ([]*AlertsPolicy, error)
- func (a *Alerts) QueryPolicySearchWithContext(ctx context.Context, accountID int, params AlertsPoliciesSearchCriteriaInput) ([]*AlertsPolicy, error)
- func (a *Alerts) QueryPolicyWithContext(ctx context.Context, accountID int, id string) (*AlertsPolicy, error)
- func (a *Alerts) SearchNrqlConditionsQuery(accountID int, searchCriteria NrqlConditionsSearchCriteria) ([]*NrqlAlertCondition, error)
- func (a *Alerts) SearchNrqlConditionsQueryWithContext(ctx context.Context, accountID int, ...) ([]*NrqlAlertCondition, error)
- func (a *Alerts) UpdateCondition(condition Condition) (*Condition, error)
- func (a *Alerts) UpdateConditionWithContext(ctx context.Context, condition Condition) (*Condition, error)
- func (a *Alerts) UpdateInfrastructureCondition(condition InfrastructureCondition) (*InfrastructureCondition, error)
- func (a *Alerts) UpdateInfrastructureConditionWithContext(ctx context.Context, condition InfrastructureCondition) (*InfrastructureCondition, error)
- func (a *Alerts) UpdateMultiLocationSyntheticsCondition(condition MultiLocationSyntheticsCondition) (*MultiLocationSyntheticsCondition, error)
- func (a *Alerts) UpdateMultiLocationSyntheticsConditionWithContext(ctx context.Context, condition MultiLocationSyntheticsCondition) (*MultiLocationSyntheticsCondition, error)
- func (a *Alerts) UpdateMutingRule(accountID int, ruleID int, rule MutingRuleUpdateInput) (*MutingRule, error)
- func (a *Alerts) UpdateMutingRuleWithContext(ctx context.Context, accountID int, ruleID int, rule MutingRuleUpdateInput) (*MutingRule, error)
- func (a *Alerts) UpdateNrqlCondition(condition NrqlCondition) (*NrqlCondition, error)
- func (a *Alerts) UpdateNrqlConditionBaselineMutation(accountID int, conditionID string, nrqlCondition NrqlConditionUpdateInput) (*NrqlAlertCondition, error)
- func (a *Alerts) UpdateNrqlConditionBaselineMutationWithContext(ctx context.Context, accountID int, conditionID string, ...) (*NrqlAlertCondition, error)
- func (a *Alerts) UpdateNrqlConditionStaticMutation(accountID int, conditionID string, nrqlCondition NrqlConditionUpdateInput) (*NrqlAlertCondition, error)
- func (a *Alerts) UpdateNrqlConditionStaticMutationWithContext(ctx context.Context, accountID int, conditionID string, ...) (*NrqlAlertCondition, error)
- func (a *Alerts) UpdateNrqlConditionWithContext(ctx context.Context, condition NrqlCondition) (*NrqlCondition, error)
- func (a *Alerts) UpdatePluginsCondition(condition PluginsCondition) (*PluginsCondition, error)
- func (a *Alerts) UpdatePluginsConditionWithContext(ctx context.Context, condition PluginsCondition) (*PluginsCondition, error)
- func (a *Alerts) UpdatePolicy(policy Policy) (*Policy, error)
- func (a *Alerts) UpdatePolicyChannels(policyID int, channelIDs []int) (*PolicyChannels, error)
- func (a *Alerts) UpdatePolicyChannelsWithContext(ctx context.Context, policyID int, channelIDs []int) (*PolicyChannels, error)
- func (a *Alerts) UpdatePolicyMutation(accountID int, policyID string, policy AlertsPolicyUpdateInput) (*AlertsPolicy, error)
- func (a *Alerts) UpdatePolicyMutationWithContext(ctx context.Context, accountID int, policyID string, ...) (*AlertsPolicy, error)
- func (a *Alerts) UpdatePolicyWithContext(ctx context.Context, policy Policy) (*Policy, error)
- func (a *Alerts) UpdateSyntheticsCondition(condition SyntheticsCondition) (*SyntheticsCondition, error)
- func (a *Alerts) UpdateSyntheticsConditionWithContext(ctx context.Context, condition SyntheticsCondition) (*SyntheticsCondition, error)
- type AlertsDayOfWeek
- type AlertsFillOption
- type AlertsIncidentPreference
- type AlertsMutingRuleConditionGroupInput
- type AlertsMutingRuleConditionGroupOperator
- type AlertsMutingRuleConditionInput
- type AlertsMutingRuleConditionOperator
- type AlertsMutingRuleInput
- type AlertsMutingRuleScheduleInput
- type AlertsMutingRuleScheduleRepeat
- type AlertsNRQLConditionTermsOperator
- type AlertsNrqlConditionCreateSignal
- type AlertsNrqlConditionExpiration
- type AlertsNrqlConditionSignal
- type AlertsNrqlConditionUpdateSignal
- type AlertsPoliciesSearchCriteriaInput
- type AlertsPoliciesSearchResultSet
- type AlertsPolicy
- type AlertsPolicyInput
- type AlertsPolicyUpdateInput
- type ByUser
- type Channel
- type ChannelConfiguration
- type ChannelLinks
- type ChannelType
- type Condition
- type ConditionTerm
- type ConditionType
- type ConditionUserDefined
- type DayOfWeek
- type GraphQLErrorResponse
- type Incident
- type IncidentLink
- type IncidentPreferenceType
- type InfrastructureCondition
- type InfrastructureConditionThreshold
- type ListAlertEventsParams
- type ListPoliciesParams
- type MetricType
- type MultiLocationSyntheticsCondition
- type MultiLocationSyntheticsConditionTerm
- type MutingRule
- type MutingRuleCondition
- type MutingRuleConditionGroup
- type MutingRuleCreateInput
- type MutingRuleSchedule
- type MutingRuleScheduleCreateInput
- type MutingRuleScheduleRepeat
- type MutingRuleScheduleUpdateInput
- type MutingRuleUpdateInput
- type NaiveDateTime
- type NrqlAlertCondition
- type NrqlBaselineDirection
- type NrqlCondition
- type NrqlConditionAggregationMethod
- type NrqlConditionBase
- type NrqlConditionCreateBase
- type NrqlConditionCreateInput
- type NrqlConditionCreateQuery
- type NrqlConditionOperator
- type NrqlConditionPriority
- type NrqlConditionQuery
- type NrqlConditionTerm
- type NrqlConditionType
- type NrqlConditionUpdateBase
- type NrqlConditionUpdateInput
- type NrqlConditionUpdateQuery
- type NrqlConditionValueFunction
- type NrqlConditionViolationTimeLimit
- type NrqlConditionsSearchCriteria
- type NrqlQuery
- type OperatorType
- type PluginsCondition
- type Policy
- type PolicyChannels
- type PriorityType
- type SyntheticsCondition
- type ThresholdOccurrence
- type TimeFunctionType
- type ValueFunctionType
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var AlertsDayOfWeekTypes = struct { // Friday FRIDAY AlertsDayOfWeek // Monday MONDAY AlertsDayOfWeek // Saturday SATURDAY AlertsDayOfWeek // Sunday SUNDAY AlertsDayOfWeek // Thursday THURSDAY AlertsDayOfWeek // Tuesday TUESDAY AlertsDayOfWeek // Wednesday WEDNESDAY AlertsDayOfWeek }{ FRIDAY: "FRIDAY", MONDAY: "MONDAY", SATURDAY: "SATURDAY", SUNDAY: "SUNDAY", THURSDAY: "THURSDAY", TUESDAY: "TUESDAY", WEDNESDAY: "WEDNESDAY", }
var AlertsFillOptionTypes = struct { // Fill using the last known value. LAST_VALUE AlertsFillOption // nolint:golint // Do not fill data. NONE AlertsFillOption // Fill using a static value. STATIC AlertsFillOption }{ LAST_VALUE: "LAST_VALUE", NONE: "NONE", STATIC: "STATIC", }
nolint:revive
var AlertsIncidentPreferenceTypes = struct { // A condition will create a condition-level incident when it violates its critical threshold. // Other violating conditions will create their own incidents. PER_CONDITION AlertsIncidentPreference // Each target of each condition will create an entity-level incident upon critical violation. // Other violating targets will create their own incidents (even on the same condition). PER_CONDITION_AND_TARGET AlertsIncidentPreference // A condition will create a policy-level incident when it violates its critical threshold. // Other violating conditions will be grouped into this incident. PER_POLICY AlertsIncidentPreference }{ PER_CONDITION: "PER_CONDITION", PER_CONDITION_AND_TARGET: "PER_CONDITION_AND_TARGET", PER_POLICY: "PER_POLICY", }
var AlertsMutingRuleConditionGroupOperatorTypes = struct { // Match conditions by AND AND AlertsMutingRuleConditionGroupOperator // Match conditions by OR OR AlertsMutingRuleConditionGroupOperator }{ AND: "AND", OR: "OR", }
var AlertsMutingRuleConditionOperatorTypes = struct { // Where attribute is any. ANY AlertsMutingRuleConditionOperator // Where attribute contains value. CONTAINS AlertsMutingRuleConditionOperator // Where attribute ends with value. ENDS_WITH AlertsMutingRuleConditionOperator // Where attribute equals value. EQUALS AlertsMutingRuleConditionOperator // Where attribute in values. (Limit 500) IN AlertsMutingRuleConditionOperator // Where attribute is blank. IS_BLANK AlertsMutingRuleConditionOperator // Where attribute is not blank. IS_NOT_BLANK AlertsMutingRuleConditionOperator // Where attribute does not contain value. NOT_CONTAINS AlertsMutingRuleConditionOperator // Where attribute does not end with value. NOT_ENDS_WITH AlertsMutingRuleConditionOperator // Where attribute does not equal value. NOT_EQUALS AlertsMutingRuleConditionOperator // Where attribute not in values. (Limit 500) NOT_IN AlertsMutingRuleConditionOperator // Where attribute does not start with value. NOT_STARTS_WITH AlertsMutingRuleConditionOperator // Where attribute starts with value. STARTS_WITH AlertsMutingRuleConditionOperator }{ ANY: "ANY", CONTAINS: "CONTAINS", ENDS_WITH: "ENDS_WITH", EQUALS: "EQUALS", IN: "IN", IS_BLANK: "IS_BLANK", IS_NOT_BLANK: "IS_NOT_BLANK", NOT_CONTAINS: "NOT_CONTAINS", NOT_ENDS_WITH: "NOT_ENDS_WITH", NOT_EQUALS: "NOT_EQUALS", NOT_IN: "NOT_IN", NOT_STARTS_WITH: "NOT_STARTS_WITH", STARTS_WITH: "STARTS_WITH", }
var AlertsMutingRuleScheduleRepeatTypes = struct { // Schedule repeats once per calendar day DAILY AlertsMutingRuleScheduleRepeat // Schedule repeats once per calendar month MONTHLY AlertsMutingRuleScheduleRepeat // Schedule repeats once per specified day per calendar week WEEKLY AlertsMutingRuleScheduleRepeat }{ DAILY: "DAILY", MONTHLY: "MONTHLY", WEEKLY: "WEEKLY", }
var AlertsNRQLConditionTermsOperatorTypes = struct { // For comparing values above a threshold. ABOVE AlertsNRQLConditionTermsOperator // For comparing values above or equal to a threshold. ABOVE_OR_EQUALS AlertsNRQLConditionTermsOperator // For comparing values below a threshold. BELOW AlertsNRQLConditionTermsOperator // For comparing values below or equal to a threshold. BELOW_OR_EQUALS AlertsNRQLConditionTermsOperator // For comparing values equal to a threshold. EQUALS AlertsNRQLConditionTermsOperator // For comparing values that do not equal a threshold. NOT_EQUALS AlertsNRQLConditionTermsOperator }{ ABOVE: "ABOVE", ABOVE_OR_EQUALS: "ABOVE_OR_EQUALS", BELOW: "BELOW", BELOW_OR_EQUALS: "BELOW_OR_EQUALS", EQUALS: "EQUALS", NOT_EQUALS: "NOT_EQUALS", }
var ( // ChannelTypes enumerates the possible channel types for an alert channel. ChannelTypes = struct { Email ChannelType OpsGenie ChannelType PagerDuty ChannelType Slack ChannelType User ChannelType VictorOps ChannelType Webhook ChannelType }{ Email: "email", OpsGenie: "opsgenie", PagerDuty: "pagerduty", Slack: "slack", User: "user", VictorOps: "victorops", Webhook: "webhook", } )
var ( // ConditionTypes enumerates the possible condition types for an alert condition. ConditionTypes = struct { APMApplicationMetric ConditionType APMKeyTransactionMetric ConditionType ServersMetric ConditionType BrowserMetric ConditionType MobileMetric ConditionType }{ APMApplicationMetric: "apm_app_metric", APMKeyTransactionMetric: "apm_kt_metric", ServersMetric: "servers_metric", BrowserMetric: "browser_metric", MobileMetric: "mobile_metric", } )
var DayOfWeekTypes = struct { MONDAY DayOfWeek TUESDAY DayOfWeek WEDNESDAY DayOfWeek THURSDAY DayOfWeek FRIDAY DayOfWeek SATURDAY DayOfWeek SUNDAY DayOfWeek }{ MONDAY: "MONDAY", TUESDAY: "TUESDAY", WEDNESDAY: "WEDNESDAY", THURSDAY: "THURSDAY", FRIDAY: "FRIDAY", SATURDAY: "SATURDAY", SUNDAY: "SUNDAY", }
DayOfWeekTypes are days of the week for DayOfWeek.
var ( // IncidentPreferenceTypes specifies the possible incident preferenece types for an alert policy. IncidentPreferenceTypes = struct { PerPolicy IncidentPreferenceType PerCondition IncidentPreferenceType PerConditionAndTarget IncidentPreferenceType }{ PerPolicy: "PER_POLICY", PerCondition: "PER_CONDITION", PerConditionAndTarget: "PER_CONDITION_AND_TARGET", } )
var ( // MetricTypes enumerates the possible metric types for an alert condition. // Not all metric types are valid for all condition types. See the docuentation for more details. MetricTypes = struct { AjaxResponseTime MetricType AjaxThroughput MetricType Apdex MetricType CPUPercentage MetricType Database MetricType DiskIOPercentage MetricType DomProcessing MetricType EndUserApdex MetricType ErrorCount MetricType ErrorPercentage MetricType FullestDiskPercentage MetricType Images MetricType JSON MetricType LoadAverageOneMinute MetricType MemoryPercentage MetricType MobileCrashRate MetricType Network MetricType NetworkErrorPercentage MetricType PageRendering MetricType PageViewThroughput MetricType PageViewsWithJsErrors MetricType RequestQueuing MetricType ResponseTime MetricType ResponseTimeBackground MetricType ResponseTimeWeb MetricType StatusErrorPercentage MetricType Throughput MetricType ThroughputBackground MetricType ThroughputWeb MetricType TotalPageLoad MetricType UserDefined MetricType ViewLoading MetricType WebApplication MetricType }{ AjaxResponseTime: "ajax_response_time", AjaxThroughput: "ajax_throughput", Apdex: "apdex", CPUPercentage: "cpu_percentage", Database: "database", DiskIOPercentage: "disk_io_percentage", DomProcessing: "dom_processing", EndUserApdex: "end_user_apdex", ErrorCount: "error_count", ErrorPercentage: "error_percentage", FullestDiskPercentage: "fullest_disk_percentage", Images: "images", JSON: "json", LoadAverageOneMinute: "load_average_one_minute", MemoryPercentage: "memory_percentage", MobileCrashRate: "mobile_crash_rate", Network: "network", NetworkErrorPercentage: "network_error_percentage", PageRendering: "page_rendering", PageViewThroughput: "page_view_throughput", PageViewsWithJsErrors: "page_views_with_js_errors", RequestQueuing: "request_queuing", ResponseTime: "response_time", ResponseTimeBackground: "response_time_background", ResponseTimeWeb: "response_time_web", StatusErrorPercentage: "status_error_percentage", Throughput: "throughput", ThroughputBackground: "throughput_background", ThroughputWeb: "throughput_web", TotalPageLoad: "total_page_load", UserDefined: "user_defined", ViewLoading: "view_loading", WebApplication: "web_application", } )
var MutingRuleScheduleRepeatTypes = struct { // DAILY - Schedule repeats once per calendar day. DAILY MutingRuleScheduleRepeat // WEEKLY - Schedule repeats once per specified day per calendar week. WEEKLY MutingRuleScheduleRepeat // MONTHLY - Schedule repeats once per calendar month. MONTHLY MutingRuleScheduleRepeat }{ DAILY: "DAILY", WEEKLY: "WEEKLY", MONTHLY: "MONTHLY", }
MutingRuleScheduleRepeatTypes are intervals for MutingRulesScheduleRepeat.
var ( // NrqlBaselineDirections enumerates the possible baseline direction values for a baseline NRQL alert condition. NrqlBaselineDirections = struct { LowerOnly NrqlBaselineDirection UpperAndLower NrqlBaselineDirection UpperOnly NrqlBaselineDirection }{ LowerOnly: "LOWER_ONLY", UpperAndLower: "UPPER_AND_LOWER", UpperOnly: "UPPER_ONLY", } )
var NrqlConditionAggregationMethodTypes = struct { // Streams data points as the clocks at New Relic advance past the end of their window. This ensures a rigorous evaluation cadence, // but does not take into account extraneous data latency. Cadence NrqlConditionAggregationMethod // Streams data points for evaluation as data for newer time windows arrive. Whenever data is received, // any data points older than the specified delay will be evaluated. EventFlow NrqlConditionAggregationMethod // Streams data points after the specified timer elapses since data last arrived for that window. Special measures are // taken to make sure data points flow in order. EventTimer NrqlConditionAggregationMethod }{ Cadence: "CADENCE", EventFlow: "EVENT_FLOW", EventTimer: "EVENT_TIMER", }
var ( // NrqlConditionOperators enumerates the possible operator values for alert condition terms. NrqlConditionOperators = struct { Above NrqlConditionOperator Below NrqlConditionOperator Equal NrqlConditionOperator }{ Above: "ABOVE", Below: "BELOW", Equal: "EQUAL", } )
var ( // NrqlConditionPriorities enumerates the possible priority values for alert condition terms. NrqlConditionPriorities = struct { Critical NrqlConditionPriority Warning NrqlConditionPriority }{ Critical: "CRITICAL", Warning: "WARNING", } )
var ( // NrqlConditionTypes enumerates the possible NRQL condition type values for NRQL alert conditions. NrqlConditionTypes = struct { Baseline NrqlConditionType Static NrqlConditionType }{ Baseline: "BASELINE", Static: "STATIC", } )
var ( // NrqlConditionValueFunctions enumerates the possible NRQL condition value function values for NRQL alert conditions. NrqlConditionValueFunctions = struct { SingleValue NrqlConditionValueFunction Sum NrqlConditionValueFunction }{ SingleValue: "SINGLE_VALUE", Sum: "SUM", } )
var ( // NrqlConditionViolationTimeLimits enumerates the possible NRQL condition violation time limit values for NRQL alert conditions. NrqlConditionViolationTimeLimits = struct { OneHour NrqlConditionViolationTimeLimit TwoHours NrqlConditionViolationTimeLimit FourHours NrqlConditionViolationTimeLimit EightHours NrqlConditionViolationTimeLimit TwelveHours NrqlConditionViolationTimeLimit TwentyFourHours NrqlConditionViolationTimeLimit }{ OneHour: "ONE_HOUR", TwoHours: "TWO_HOURS", FourHours: "FOUR_HOURS", EightHours: "EIGHT_HOURS", TwelveHours: "TWELVE_HOURS", TwentyFourHours: "TWENTY_FOUR_HOURS", } )
var ( // OperatorTypes enumerates the possible operator values for alert condition terms. OperatorTypes = struct { Above OperatorType Below OperatorType Equal OperatorType }{ Above: "above", Below: "below", Equal: "equal", } )
var ( // PriorityTypes enumerates the possible priority values for alert condition terms. PriorityTypes = struct { Critical PriorityType Warning PriorityType }{ Critical: "critical", Warning: "warning", } )
var ( // ThresholdOccurrences enumerates the possible threshold occurrence values for NRQL alert condition terms. ThresholdOccurrences = struct { All ThresholdOccurrence AtLeastOnce ThresholdOccurrence }{ All: "ALL", AtLeastOnce: "AT_LEAST_ONCE", } )
var ( // TimeFunctionTypes enumerates the possible time function types for alert condition terms. TimeFunctionTypes = struct { All TimeFunctionType Any TimeFunctionType }{ All: "all", Any: "any", } )
var ( // ValueFunctionTypes enumerates the possible value function types for custom metrics. ValueFunctionTypes = struct { Average ValueFunctionType Min ValueFunctionType Max ValueFunctionType Total ValueFunctionType SampleSize ValueFunctionType SingleValue ValueFunctionType Rate ValueFunctionType Percent ValueFunctionType }{ Average: "average", Min: "min", Max: "max", Total: "total", SampleSize: "sample_size", SingleValue: "single_value", Rate: "rate", Percent: "percent", } )
Functions ¶
This section is empty.
Types ¶
type AlertEvent ¶
type AlertEvent struct { ID int `json:"id"` EventType string `json:"event_type"` Product string `json:"product"` EntityType string `json:"entity_type"` EntityGroupID int `json:"entity_group_id"` EntityID int `json:"entity_id"` Priority string `json:"priority"` Description string `json:"description"` Timestamp *serialization.EpochTime `json:"timestamp"` IncidentID int `json:"incident_id"` }
AlertEvent response struct
type AlertPlugin ¶
AlertPlugin represents a plugin to use with a Plugin alert condition.
type Alerts ¶
type Alerts struct {
// contains filtered or unexported fields
}
Alerts is used to communicate with New Relic Alerts.
func (*Alerts) AcknowledgeIncident ¶
AcknowledgeIncident acknowledges an existing incident.
func (*Alerts) AcknowledgeIncidentWithContext ¶
AcknowledgeIncidentWithContext acknowledges an existing incident.
func (*Alerts) CloseIncident ¶
CloseIncident closes an existing open incident.
func (*Alerts) CloseIncidentWithContext ¶
CloseIncidentWithContext closes an existing open incident.
func (*Alerts) CreateChannel ¶
CreateChannel creates an alert channel within a given account. The configuration options different based on channel type. For more information on the different configurations, please view the New Relic API documentation for this endpoint. Docs: https://docs.newrelic.com/docs/alerts/rest-api-alerts/new-relic-alerts-rest-api/rest-api-calls-new-relic-alerts#channels
func (*Alerts) CreateChannelWithContext ¶
CreateChannelWithContext creates an alert channel within a given account. The configuration options different based on channel type. For more information on the different configurations, please view the New Relic API documentation for this endpoint. Docs: https://docs.newrelic.com/docs/alerts/rest-api-alerts/new-relic-alerts-rest-api/rest-api-calls-new-relic-alerts#channels
func (*Alerts) CreateCondition ¶
CreateCondition creates an alert condition for a specified policy.
func (*Alerts) CreateConditionWithContext ¶
func (a *Alerts) CreateConditionWithContext(ctx context.Context, policyID int, condition Condition) (*Condition, error)
CreateConditionWithContext creates an alert condition for a specified policy.
func (*Alerts) CreateInfrastructureCondition ¶
func (a *Alerts) CreateInfrastructureCondition(condition InfrastructureCondition) (*InfrastructureCondition, error)
CreateInfrastructureCondition is used to create a New Relic Infrastructure alert condition.
func (*Alerts) CreateInfrastructureConditionWithContext ¶
func (a *Alerts) CreateInfrastructureConditionWithContext(ctx context.Context, condition InfrastructureCondition) (*InfrastructureCondition, error)
CreateInfrastructureConditionWithContext is used to create a New Relic Infrastructure alert condition.
func (*Alerts) CreateMultiLocationSyntheticsCondition ¶
func (a *Alerts) CreateMultiLocationSyntheticsCondition(condition MultiLocationSyntheticsCondition, policyID int) (*MultiLocationSyntheticsCondition, error)
CreateMultiLocationSyntheticsCondition creates an alert condition for a specified policy.
func (*Alerts) CreateMultiLocationSyntheticsConditionWithContext ¶
func (a *Alerts) CreateMultiLocationSyntheticsConditionWithContext(ctx context.Context, condition MultiLocationSyntheticsCondition, policyID int) (*MultiLocationSyntheticsCondition, error)
CreateMultiLocationSyntheticsConditionWithContext creates an alert condition for a specified policy.
func (*Alerts) CreateMutingRule ¶
func (a *Alerts) CreateMutingRule(accountID int, rule MutingRuleCreateInput) (*MutingRule, error)
CreateMutingRule is the mutation to create a muting rule for the given account and input.
func (*Alerts) CreateMutingRuleWithContext ¶
func (a *Alerts) CreateMutingRuleWithContext(ctx context.Context, accountID int, rule MutingRuleCreateInput) (*MutingRule, error)
CreateMutingRuleWithContext is the mutation to create a muting rule for the given account and input.
func (*Alerts) CreateNrqlCondition ¶
func (a *Alerts) CreateNrqlCondition(policyID int, condition NrqlCondition) (*NrqlCondition, error)
CreateNrqlCondition creates a NRQL alert condition.
func (*Alerts) CreateNrqlConditionBaselineMutation ¶
func (a *Alerts) CreateNrqlConditionBaselineMutation( accountID int, policyID string, nrqlCondition NrqlConditionCreateInput, ) (*NrqlAlertCondition, error)
CreateNrqlConditionBaselineMutation creates a baseline NRQL alert condition via New Relic's NerdGraph API.
func (*Alerts) CreateNrqlConditionBaselineMutationWithContext ¶
func (a *Alerts) CreateNrqlConditionBaselineMutationWithContext( ctx context.Context, accountID int, policyID string, nrqlCondition NrqlConditionCreateInput, ) (*NrqlAlertCondition, error)
CreateNrqlConditionBaselineMutationWithContext creates a baseline NRQL alert condition via New Relic's NerdGraph API.
func (*Alerts) CreateNrqlConditionStaticMutation ¶
func (a *Alerts) CreateNrqlConditionStaticMutation( accountID int, policyID string, nrqlCondition NrqlConditionCreateInput, ) (*NrqlAlertCondition, error)
CreateNrqlConditionStaticMutation creates a static NRQL alert condition via New Relic's NerdGraph API.
func (*Alerts) CreateNrqlConditionStaticMutationWithContext ¶
func (a *Alerts) CreateNrqlConditionStaticMutationWithContext( ctx context.Context, accountID int, policyID string, nrqlCondition NrqlConditionCreateInput, ) (*NrqlAlertCondition, error)
CreateNrqlConditionStaticMutationWithContext creates a static NRQL alert condition via New Relic's NerdGraph API.
func (*Alerts) CreateNrqlConditionWithContext ¶
func (a *Alerts) CreateNrqlConditionWithContext(ctx context.Context, policyID int, condition NrqlCondition) (*NrqlCondition, error)
CreateNrqlConditionWithContext creates a NRQL alert condition.
func (*Alerts) CreatePluginsCondition ¶
func (a *Alerts) CreatePluginsCondition(policyID int, condition PluginsCondition) (*PluginsCondition, error)
CreatePluginsCondition creates an alert condition for a plugin.
func (*Alerts) CreatePluginsConditionWithContext ¶
func (a *Alerts) CreatePluginsConditionWithContext(ctx context.Context, policyID int, condition PluginsCondition) (*PluginsCondition, error)
CreatePluginsConditionWithContext creates an alert condition for a plugin.
func (*Alerts) CreatePolicy ¶
CreatePolicy creates a new alert policy for a given account.
func (*Alerts) CreatePolicyMutation ¶
func (a *Alerts) CreatePolicyMutation(accountID int, policy AlertsPolicyInput) (*AlertsPolicy, error)
func (*Alerts) CreatePolicyMutationWithContext ¶
func (a *Alerts) CreatePolicyMutationWithContext(ctx context.Context, accountID int, policy AlertsPolicyInput) (*AlertsPolicy, error)
func (*Alerts) CreatePolicyWithContext ¶
CreatePolicyWithContext creates a new alert policy for a given account.
func (*Alerts) CreateSyntheticsCondition ¶
func (a *Alerts) CreateSyntheticsCondition(policyID int, condition SyntheticsCondition) (*SyntheticsCondition, error)
CreateSyntheticsCondition creates a new Synthetics alert condition.
func (*Alerts) CreateSyntheticsConditionWithContext ¶
func (a *Alerts) CreateSyntheticsConditionWithContext(ctx context.Context, policyID int, condition SyntheticsCondition) (*SyntheticsCondition, error)
CreateSyntheticsConditionWithContext creates a new Synthetics alert condition.
func (*Alerts) DeleteChannel ¶
DeleteChannel deletes the alert channel with the specified ID.
func (*Alerts) DeleteChannelWithContext ¶
DeleteChannelWithContext deletes the alert channel with the specified ID.
func (*Alerts) DeleteCondition ¶
DeleteCondition deletes an alert condition.
func (*Alerts) DeleteConditionMutation ¶
DeleteConditionMutation deletes any type of alert condition via New Relic's NerdGraph API.
func (*Alerts) DeleteConditionMutationWithContext ¶
func (a *Alerts) DeleteConditionMutationWithContext( ctx context.Context, accountID int, conditionID string, ) (string, error)
DeleteConditionMutationWithContext deletes any type of alert condition via New Relic's NerdGraph API.
func (*Alerts) DeleteConditionWithContext ¶
DeleteConditionWithContext deletes an alert condition.
func (*Alerts) DeleteInfrastructureCondition ¶
DeleteInfrastructureCondition is used to delete a New Relic Infrastructure alert condition.
func (*Alerts) DeleteInfrastructureConditionWithContext ¶
func (a *Alerts) DeleteInfrastructureConditionWithContext(ctx context.Context, conditionID int) error
DeleteInfrastructureConditionWithContext is used to delete a New Relic Infrastructure alert condition.
func (*Alerts) DeleteMultiLocationSyntheticsCondition ¶
func (a *Alerts) DeleteMultiLocationSyntheticsCondition(conditionID int) (*MultiLocationSyntheticsCondition, error)
DeleteMultiLocationSyntheticsCondition delete an alert condition.
func (*Alerts) DeleteMultiLocationSyntheticsConditionWithContext ¶
func (a *Alerts) DeleteMultiLocationSyntheticsConditionWithContext(ctx context.Context, conditionID int) (*MultiLocationSyntheticsCondition, error)
DeleteMultiLocationSyntheticsConditionWithContext delete an alert condition.
func (*Alerts) DeleteMutingRule ¶
DeleteMutingRule is the mutation to delete an existing muting rule.
func (*Alerts) DeleteMutingRuleWithContext ¶
DeleteMutingRuleWithContext is the mutation to delete an existing muting rule.
func (*Alerts) DeleteNrqlCondition ¶
func (a *Alerts) DeleteNrqlCondition(id int) (*NrqlCondition, error)
DeleteNrqlCondition deletes a NRQL alert condition.
func (*Alerts) DeleteNrqlConditionMutation ¶
func (*Alerts) DeleteNrqlConditionMutationWithContext ¶
func (*Alerts) DeleteNrqlConditionWithContext ¶
func (a *Alerts) DeleteNrqlConditionWithContext(ctx context.Context, id int) (*NrqlCondition, error)
DeleteNrqlConditionWithContext deletes a NRQL alert condition.
func (*Alerts) DeletePluginsCondition ¶
func (a *Alerts) DeletePluginsCondition(id int) (*PluginsCondition, error)
DeletePluginsCondition deletes a plugin alert condition.
func (*Alerts) DeletePluginsConditionWithContext ¶
func (a *Alerts) DeletePluginsConditionWithContext(ctx context.Context, id int) (*PluginsCondition, error)
DeletePluginsConditionWithContext deletes a plugin alert condition.
func (*Alerts) DeletePolicy ¶
DeletePolicy deletes an existing alert policy for a given account.
func (*Alerts) DeletePolicyChannel ¶
DeletePolicyChannel deletes a notification channel from an alert policy. This method returns a response containing the Channel that was deleted from the policy.
func (*Alerts) DeletePolicyChannelWithContext ¶
func (a *Alerts) DeletePolicyChannelWithContext(ctx context.Context, policyID int, channelID int) (*Channel, error)
DeletePolicyChannelWithContext deletes a notification channel from an alert policy. This method returns a response containing the Channel that was deleted from the policy.
func (*Alerts) DeletePolicyMutation ¶
func (a *Alerts) DeletePolicyMutation(accountID int, id string) (*AlertsPolicy, error)
DeletePolicyMutation is the NerdGraph mutation to delete a policy given the account ID and the policy ID.
func (*Alerts) DeletePolicyMutationWithContext ¶
func (a *Alerts) DeletePolicyMutationWithContext(ctx context.Context, accountID int, id string) (*AlertsPolicy, error)
DeletePolicyMutationWithContext is the NerdGraph mutation to delete a policy given the account ID and the policy ID.
func (*Alerts) DeletePolicyWithContext ¶
DeletePolicyWithContext deletes an existing alert policy for a given account.
func (*Alerts) DeleteSyntheticsCondition ¶
func (a *Alerts) DeleteSyntheticsCondition(conditionID int) (*SyntheticsCondition, error)
DeleteSyntheticsCondition deletes a Synthetics alert condition.
func (*Alerts) DeleteSyntheticsConditionWithContext ¶
func (a *Alerts) DeleteSyntheticsConditionWithContext(ctx context.Context, conditionID int) (*SyntheticsCondition, error)
DeleteSyntheticsConditionWithContext deletes a Synthetics alert condition.
func (*Alerts) GetChannel ¶
GetChannel returns a specific alert channel by ID for a given account.
func (*Alerts) GetChannelWithContext ¶
GetChannelWithContext returns a specific alert channel by ID for a given account.
func (*Alerts) GetCondition ¶
GetCondition gets an alert condition for a specified policy ID and condition ID.
func (*Alerts) GetConditionWithContext ¶
func (a *Alerts) GetConditionWithContext(ctx context.Context, policyID int, id int) (*Condition, error)
GetConditionWithContext gets an alert condition for a specified policy ID and condition ID.
func (*Alerts) GetInfrastructureCondition ¶
func (a *Alerts) GetInfrastructureCondition(conditionID int) (*InfrastructureCondition, error)
GetInfrastructureCondition is used to retrieve a specific New Relic Infrastructure alert condition.
func (*Alerts) GetInfrastructureConditionWithContext ¶
func (a *Alerts) GetInfrastructureConditionWithContext(ctx context.Context, conditionID int) (*InfrastructureCondition, error)
GetInfrastructureConditionWithContext is used to retrieve a specific New Relic Infrastructure alert condition.
func (*Alerts) GetMultiLocationSyntheticsCondition ¶
func (a *Alerts) GetMultiLocationSyntheticsCondition(policyID int, conditionID int) (*MultiLocationSyntheticsCondition, error)
GetMultiLocationSyntheticsCondition retrieves a specific Synthetics alert condition.
func (*Alerts) GetMultiLocationSyntheticsConditionWithContext ¶
func (a *Alerts) GetMultiLocationSyntheticsConditionWithContext(ctx context.Context, policyID int, conditionID int) (*MultiLocationSyntheticsCondition, error)
GetMultiLocationSyntheticsConditionWithContext retrieves a specific Synthetics alert condition.
func (*Alerts) GetMutingRule ¶
func (a *Alerts) GetMutingRule(accountID, ruleID int) (*MutingRule, error)
GetMutingRule queries for a single muting rule matching the given ID.
func (*Alerts) GetMutingRuleWithContext ¶
func (a *Alerts) GetMutingRuleWithContext(ctx context.Context, accountID, ruleID int) (*MutingRule, error)
GetMutingRuleWithContext queries for a single muting rule matching the given ID.
func (*Alerts) GetNrqlCondition ¶
func (a *Alerts) GetNrqlCondition(policyID int, id int) (*NrqlCondition, error)
GetNrqlCondition gets information about a NRQL alert condition for a specified policy ID and condition ID.
func (*Alerts) GetNrqlConditionQuery ¶
func (a *Alerts) GetNrqlConditionQuery( accountID int, conditionID string, ) (*NrqlAlertCondition, error)
GetNrqlConditionQuery fetches a NRQL alert condition via New Relic's NerdGraph API.
func (*Alerts) GetNrqlConditionQueryWithContext ¶
func (a *Alerts) GetNrqlConditionQueryWithContext( ctx context.Context, accountID int, conditionID string, ) (*NrqlAlertCondition, error)
GetNrqlConditionQueryWithContext fetches a NRQL alert condition via New Relic's NerdGraph API.
func (*Alerts) GetNrqlConditionWithContext ¶
func (a *Alerts) GetNrqlConditionWithContext(ctx context.Context, policyID int, id int) (*NrqlCondition, error)
GetNrqlConditionWithContext gets information about a NRQL alert condition for a specified policy ID and condition ID.
func (*Alerts) GetPluginsCondition ¶
func (a *Alerts) GetPluginsCondition(policyID int, pluginID int) (*PluginsCondition, error)
GetPluginsCondition gets information about an alert condition for a plugin given a policy ID and plugin ID.
func (*Alerts) GetPluginsConditionWithContext ¶
func (a *Alerts) GetPluginsConditionWithContext(ctx context.Context, policyID int, pluginID int) (*PluginsCondition, error)
GetPluginsConditionWithContext gets information about an alert condition for a plugin given a policy ID and plugin ID.
func (*Alerts) GetPolicyWithContext ¶
GetPolicyWithContext returns a specific alert policy by ID for a given account.
func (*Alerts) GetSyntheticsCondition ¶
func (a *Alerts) GetSyntheticsCondition(policyID int, conditionID int) (*SyntheticsCondition, error)
GetSyntheticsCondition retrieves a specific Synthetics alert condition.
func (*Alerts) GetSyntheticsConditionWithContext ¶
func (a *Alerts) GetSyntheticsConditionWithContext(ctx context.Context, policyID int, conditionID int) (*SyntheticsCondition, error)
GetSyntheticsConditionWithContext retrieves a specific Synthetics alert condition.
func (*Alerts) ListAlertEvents ¶
func (a *Alerts) ListAlertEvents(params *ListAlertEventsParams) ([]*AlertEvent, error)
ListAlertEvents is used to retrieve New Relic alert events
func (*Alerts) ListAlertEventsWithContext ¶
func (a *Alerts) ListAlertEventsWithContext(ctx context.Context, params *ListAlertEventsParams) ([]*AlertEvent, error)
ListAlertEventsWithContext is used to retrieve New Relic alert events
func (*Alerts) ListChannels ¶
ListChannels returns all alert channels for a given account.
func (*Alerts) ListChannelsWithContext ¶
ListChannelsWithContext returns all alert channels for a given account.
func (*Alerts) ListConditions ¶
ListConditions returns alert conditions for a specified policy.
func (*Alerts) ListConditionsWithContext ¶
ListConditionsWithContext returns alert conditions for a specified policy.
func (*Alerts) ListIncidents ¶
ListIncidents returns all alert incidents.
func (*Alerts) ListIncidentsWithContext ¶
func (a *Alerts) ListIncidentsWithContext(ctx context.Context, onlyOpen bool, excludeViolations bool) ([]*Incident, error)
ListIncidentsWithContext returns all alert incidents.
func (*Alerts) ListInfrastructureConditions ¶
func (a *Alerts) ListInfrastructureConditions(policyID int) ([]InfrastructureCondition, error)
ListInfrastructureConditions is used to retrieve New Relic Infrastructure alert conditions.
func (*Alerts) ListInfrastructureConditionsWithContext ¶
func (a *Alerts) ListInfrastructureConditionsWithContext(ctx context.Context, policyID int) ([]InfrastructureCondition, error)
ListInfrastructureConditionsWithContext is used to retrieve New Relic Infrastructure alert conditions.
func (*Alerts) ListMultiLocationSyntheticsConditions ¶
func (a *Alerts) ListMultiLocationSyntheticsConditions(policyID int) ([]*MultiLocationSyntheticsCondition, error)
ListMultiLocationSyntheticsConditions returns alert conditions for a specified policy.
func (*Alerts) ListMultiLocationSyntheticsConditionsWithContext ¶
func (a *Alerts) ListMultiLocationSyntheticsConditionsWithContext(ctx context.Context, policyID int) ([]*MultiLocationSyntheticsCondition, error)
ListMultiLocationSyntheticsConditionsWithContext returns alert conditions for a specified policy.
func (*Alerts) ListMutingRules ¶
func (a *Alerts) ListMutingRules(accountID int) ([]MutingRule, error)
ListMutingRules queries for all muting rules in a given account.
func (*Alerts) ListMutingRulesWithContext ¶
func (a *Alerts) ListMutingRulesWithContext(ctx context.Context, accountID int) ([]MutingRule, error)
ListMutingRulesWithContext queries for all muting rules in a given account.
func (*Alerts) ListNrqlConditions ¶
func (a *Alerts) ListNrqlConditions(policyID int) ([]*NrqlCondition, error)
ListNrqlConditions returns NRQL alert conditions for a specified policy.
func (*Alerts) ListNrqlConditionsWithContext ¶
func (a *Alerts) ListNrqlConditionsWithContext(ctx context.Context, policyID int) ([]*NrqlCondition, error)
ListNrqlConditionsWithContext returns NRQL alert conditions for a specified policy.
func (*Alerts) ListPluginsConditions ¶
func (a *Alerts) ListPluginsConditions(policyID int) ([]*PluginsCondition, error)
ListPluginsConditions returns alert conditions for New Relic plugins for a given alert policy.
func (*Alerts) ListPluginsConditionsWithContext ¶
func (a *Alerts) ListPluginsConditionsWithContext(ctx context.Context, policyID int) ([]*PluginsCondition, error)
ListPluginsConditionsWithContext returns alert conditions for New Relic plugins for a given alert policy.
func (*Alerts) ListPolicies ¶
func (a *Alerts) ListPolicies(params *ListPoliciesParams) ([]Policy, error)
ListPolicies returns a list of Alert Policies for a given account.
func (*Alerts) ListPoliciesWithContext ¶
func (a *Alerts) ListPoliciesWithContext(ctx context.Context, params *ListPoliciesParams) ([]Policy, error)
ListPoliciesWithContext returns a list of Alert Policies for a given account.
func (*Alerts) ListSyntheticsConditions ¶
func (a *Alerts) ListSyntheticsConditions(policyID int) ([]*SyntheticsCondition, error)
ListSyntheticsConditions returns a list of Synthetics alert conditions for a given policy.
func (*Alerts) ListSyntheticsConditionsWithContext ¶
func (a *Alerts) ListSyntheticsConditionsWithContext(ctx context.Context, policyID int) ([]*SyntheticsCondition, error)
ListSyntheticsConditionsWithContext returns a list of Synthetics alert conditions for a given policy.
func (*Alerts) NerdGraphQueryWithContext ¶
func (a *Alerts) NerdGraphQueryWithContext(ctx context.Context, query string, vars map[string]interface{}, respBody interface{}) error
NerdGraphQueryWithContext works similarly to the default client's NerdGraphQueryWithContext but with a custom error value that provides enhanced error messages and context via GraphQLErrorResponse.
func (*Alerts) QueryPolicy ¶
func (a *Alerts) QueryPolicy(accountID int, id string) (*AlertsPolicy, error)
QueryPolicy queries NerdGraph for a policy matching the given account ID and policy ID.
func (*Alerts) QueryPolicySearch ¶
func (a *Alerts) QueryPolicySearch(accountID int, params AlertsPoliciesSearchCriteriaInput) ([]*AlertsPolicy, error)
QueryPolicySearch searches NerdGraph for policies.
func (*Alerts) QueryPolicySearchWithContext ¶
func (a *Alerts) QueryPolicySearchWithContext(ctx context.Context, accountID int, params AlertsPoliciesSearchCriteriaInput) ([]*AlertsPolicy, error)
QueryPolicySearchWithContext searches NerdGraph for policies.
func (*Alerts) QueryPolicyWithContext ¶
func (a *Alerts) QueryPolicyWithContext(ctx context.Context, accountID int, id string) (*AlertsPolicy, error)
QueryPolicyWithContext queries NerdGraph for a policy matching the given account ID and policy ID.
func (*Alerts) SearchNrqlConditionsQuery ¶
func (a *Alerts) SearchNrqlConditionsQuery( accountID int, searchCriteria NrqlConditionsSearchCriteria, ) ([]*NrqlAlertCondition, error)
SearchNrqlConditionsQuery fetches multiple NRQL alert conditions based on the provided search criteria via New Relic's NerdGraph API.
func (*Alerts) SearchNrqlConditionsQueryWithContext ¶
func (a *Alerts) SearchNrqlConditionsQueryWithContext( ctx context.Context, accountID int, searchCriteria NrqlConditionsSearchCriteria, ) ([]*NrqlAlertCondition, error)
SearchNrqlConditionsQueryWithContext fetches multiple NRQL alert conditions based on the provided search criteria via New Relic's NerdGraph API.
func (*Alerts) UpdateCondition ¶
UpdateCondition updates an alert condition.
func (*Alerts) UpdateConditionWithContext ¶
func (a *Alerts) UpdateConditionWithContext(ctx context.Context, condition Condition) (*Condition, error)
UpdateConditionWithContext updates an alert condition.
func (*Alerts) UpdateInfrastructureCondition ¶
func (a *Alerts) UpdateInfrastructureCondition(condition InfrastructureCondition) (*InfrastructureCondition, error)
UpdateInfrastructureCondition is used to update a New Relic Infrastructure alert condition.
func (*Alerts) UpdateInfrastructureConditionWithContext ¶
func (a *Alerts) UpdateInfrastructureConditionWithContext(ctx context.Context, condition InfrastructureCondition) (*InfrastructureCondition, error)
UpdateInfrastructureConditionWithContext is used to update a New Relic Infrastructure alert condition.
func (*Alerts) UpdateMultiLocationSyntheticsCondition ¶
func (a *Alerts) UpdateMultiLocationSyntheticsCondition(condition MultiLocationSyntheticsCondition) (*MultiLocationSyntheticsCondition, error)
UpdateMultiLocationSyntheticsCondition updates an alert condition.
func (*Alerts) UpdateMultiLocationSyntheticsConditionWithContext ¶
func (a *Alerts) UpdateMultiLocationSyntheticsConditionWithContext(ctx context.Context, condition MultiLocationSyntheticsCondition) (*MultiLocationSyntheticsCondition, error)
UpdateMultiLocationSyntheticsConditionWithContext updates an alert condition.
func (*Alerts) UpdateMutingRule ¶
func (a *Alerts) UpdateMutingRule(accountID int, ruleID int, rule MutingRuleUpdateInput) (*MutingRule, error)
UpdateMutingRule is the mutation to update an existing muting rule.
func (*Alerts) UpdateMutingRuleWithContext ¶
func (a *Alerts) UpdateMutingRuleWithContext(ctx context.Context, accountID int, ruleID int, rule MutingRuleUpdateInput) (*MutingRule, error)
UpdateMutingRuleWithContext is the mutation to update an existing muting rule.
func (*Alerts) UpdateNrqlCondition ¶
func (a *Alerts) UpdateNrqlCondition(condition NrqlCondition) (*NrqlCondition, error)
UpdateNrqlCondition updates a NRQL alert condition.
func (*Alerts) UpdateNrqlConditionBaselineMutation ¶
func (a *Alerts) UpdateNrqlConditionBaselineMutation( accountID int, conditionID string, nrqlCondition NrqlConditionUpdateInput, ) (*NrqlAlertCondition, error)
UpdateNrqlConditionBaselineMutation updates a baseline NRQL alert condition via New Relic's NerdGraph API.
func (*Alerts) UpdateNrqlConditionBaselineMutationWithContext ¶
func (a *Alerts) UpdateNrqlConditionBaselineMutationWithContext( ctx context.Context, accountID int, conditionID string, nrqlCondition NrqlConditionUpdateInput, ) (*NrqlAlertCondition, error)
UpdateNrqlConditionBaselineMutationWithContext updates a baseline NRQL alert condition via New Relic's NerdGraph API.
func (*Alerts) UpdateNrqlConditionStaticMutation ¶
func (a *Alerts) UpdateNrqlConditionStaticMutation( accountID int, conditionID string, nrqlCondition NrqlConditionUpdateInput, ) (*NrqlAlertCondition, error)
UpdateNrqlConditionStaticMutation updates a static NRQL alert condition via New Relic's NerdGraph API.
func (*Alerts) UpdateNrqlConditionStaticMutationWithContext ¶
func (a *Alerts) UpdateNrqlConditionStaticMutationWithContext( ctx context.Context, accountID int, conditionID string, nrqlCondition NrqlConditionUpdateInput, ) (*NrqlAlertCondition, error)
UpdateNrqlConditionStaticMutationWithContext updates a static NRQL alert condition via New Relic's NerdGraph API.
func (*Alerts) UpdateNrqlConditionWithContext ¶
func (a *Alerts) UpdateNrqlConditionWithContext(ctx context.Context, condition NrqlCondition) (*NrqlCondition, error)
UpdateNrqlConditionWithContext updates a NRQL alert condition.
func (*Alerts) UpdatePluginsCondition ¶
func (a *Alerts) UpdatePluginsCondition(condition PluginsCondition) (*PluginsCondition, error)
UpdatePluginsCondition updates an alert condition for a plugin.
func (*Alerts) UpdatePluginsConditionWithContext ¶
func (a *Alerts) UpdatePluginsConditionWithContext(ctx context.Context, condition PluginsCondition) (*PluginsCondition, error)
UpdatePluginsConditionWithContext updates an alert condition for a plugin.
func (*Alerts) UpdatePolicy ¶
UpdatePolicy update an alert policy for a given account.
func (*Alerts) UpdatePolicyChannels ¶
func (a *Alerts) UpdatePolicyChannels(policyID int, channelIDs []int) (*PolicyChannels, error)
UpdatePolicyChannels updates a policy by adding the specified notification channels.
func (*Alerts) UpdatePolicyChannelsWithContext ¶
func (a *Alerts) UpdatePolicyChannelsWithContext(ctx context.Context, policyID int, channelIDs []int) (*PolicyChannels, error)
UpdatePolicyChannelsWithContext updates a policy by adding the specified notification channels.
func (*Alerts) UpdatePolicyMutation ¶
func (a *Alerts) UpdatePolicyMutation(accountID int, policyID string, policy AlertsPolicyUpdateInput) (*AlertsPolicy, error)
func (*Alerts) UpdatePolicyMutationWithContext ¶
func (a *Alerts) UpdatePolicyMutationWithContext(ctx context.Context, accountID int, policyID string, policy AlertsPolicyUpdateInput) (*AlertsPolicy, error)
func (*Alerts) UpdatePolicyWithContext ¶
UpdatePolicyWithContext update an alert policy for a given account.
func (*Alerts) UpdateSyntheticsCondition ¶
func (a *Alerts) UpdateSyntheticsCondition(condition SyntheticsCondition) (*SyntheticsCondition, error)
UpdateSyntheticsCondition updates an existing Synthetics alert condition.
func (*Alerts) UpdateSyntheticsConditionWithContext ¶
func (a *Alerts) UpdateSyntheticsConditionWithContext(ctx context.Context, condition SyntheticsCondition) (*SyntheticsCondition, error)
UpdateSyntheticsConditionWithContext updates an existing Synthetics alert condition.
type AlertsDayOfWeek ¶
type AlertsDayOfWeek string
AlertsDayOfWeek - The day of the week used to configure a WEEKLY scheduled MutingRule
type AlertsFillOption ¶
type AlertsFillOption string // nolint:golint
AlertsFillOption - The available fill options. nolint:revive
type AlertsIncidentPreference ¶
type AlertsIncidentPreference string
AlertsIncidentPreference - Determines how incidents are created for critical violations of the conditions contained in the policy.
type AlertsMutingRuleConditionGroupInput ¶
type AlertsMutingRuleConditionGroupInput struct { // The individual MutingRuleConditions within the group. Conditions []AlertsMutingRuleConditionInput `json:"conditions,omitempty"` // The operator used to combine all the MutingRuleConditions within the group. Operator AlertsMutingRuleConditionGroupOperator `json:"operator"` }
AlertsMutingRuleConditionGroupInput - A group of MutingRuleConditions combined by an operator.
type AlertsMutingRuleConditionGroupOperator ¶
type AlertsMutingRuleConditionGroupOperator string
AlertsMutingRuleConditionGroupOperator - An operator used to combine MutingRuleConditions within a MutingRuleConditionGroup.
type AlertsMutingRuleConditionInput ¶
type AlertsMutingRuleConditionInput struct { // The attribute on a violation. Expects one of: // // * **accountId** - The account id // * **conditionId** - The alert condition id // * **policyId** - The alert policy id // * **policyName** - The alert policy name // * **conditionName** - The alert condition name // * **conditionType** - The alert condition type, such as `metric` // * **conditionRunbookUrl** - The alert condition's runbook url // * **product** - The target product (e.g., `SYNTHETICS`) // * **targetId** - The ID of the alerts target // * **targetName** - The name of the alerts target // * **nrqlEventType** - The NRQL event type // * **tag** - Arbitrary tags associated with some entity (e.g., FACET from a NRQL query) // * **nrqlQuery** - The NRQL query string Attribute string `json:"attribute"` // The operator used to compare the attribute's value with the supplied value(s). Operator AlertsMutingRuleConditionOperator `json:"operator"` // The value(s) to compare against the attribute's value. Values []string `json:"values"` }
AlertsMutingRuleConditionInput - A condition which describes how to target a New Relic Alerts Violation.
type AlertsMutingRuleConditionOperator ¶
type AlertsMutingRuleConditionOperator string
AlertsMutingRuleConditionOperator - The list of operators to be used in a MutingRuleCondition. Each operator is limited to one value in the `values` list unless otherwise specified.
type AlertsMutingRuleInput ¶
type AlertsMutingRuleInput struct { // The condition that defines which violations to target. Condition AlertsMutingRuleConditionGroupInput `json:"condition,omitempty"` // The description of the MutingRule. Description string `json:"description,omitempty"` // Whether the MutingRule is enabled Enabled bool `json:"enabled"` // The name of the MutingRule. Name string `json:"name"` // The time window when the MutingRule should actively mute violations. Schedule AlertsMutingRuleScheduleInput `json:"schedule,omitempty"` }
AlertsMutingRuleInput - Input for creating MutingRules for New Relic Alerts Violations.
type AlertsMutingRuleScheduleInput ¶
type AlertsMutingRuleScheduleInput struct { // The datetime stamp when the MutingRule schedule should stop repeating. // This is in local ISO 8601 format without an offset. // // Example: `'2020-07-10T15:00:00'` // // Note: Either `endRepeat` or `repeatCount` should be used to end a MutingRule schedule. // Both fields should not be provided together. EndRepeat nrtime.NaiveDateTime `json:"endRepeat,omitempty"` // The datetime stamp representing when the MutingRule should end. // This is in local ISO 8601 format without an offset. // // Example: `'2020-07-10T15:00:00'` EndTime nrtime.NaiveDateTime `json:"endTime,omitempty"` // The frequency the MutingRule schedule repeats. // If the MutingRule repeats `WEEKLY`, be sure to set `weeklyRepeatDays`. // If the MutingRule does not repeat, use `null`. // // Example: `DAILY` Repeat AlertsMutingRuleScheduleRepeat `json:"repeat,omitempty"` // The number of times the MutingRule schedule should repeat. // // Note: Either `repeatCount` or `endRepeat` should be used to end a MutingRule schedule. // Both fields should not be provided together. RepeatCount int `json:"repeatCount,omitempty"` // The datetime stamp representing when the MutingRule should start. // This is in local ISO 8601 format without an offset. // // Example: `'2020-07-08T14:30:00'` StartTime nrtime.NaiveDateTime `json:"startTime,omitempty"` // The time zone that applies to the MutingRule schedule. // // Example: `'America/Los_Angeles'` // // See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. TimeZone string `json:"timeZone"` // The day(s) of the week that a MutingRule should repeat when the repeat field is set to `WEEKLY`. // // Example: `[MONDAY, WEDNESDAY]` WeeklyRepeatDays []AlertsDayOfWeek `json:"weeklyRepeatDays"` }
AlertsMutingRuleScheduleInput - The time window when the MutingRule should actively mute violations.
type AlertsMutingRuleScheduleRepeat ¶
type AlertsMutingRuleScheduleRepeat string
AlertsMutingRuleScheduleRepeat - Details about if or how frequently a MutingRule's schedule repeats.
type AlertsNRQLConditionTermsOperator ¶
type AlertsNRQLConditionTermsOperator string
AlertsNRQLConditionTermsOperator - Operator used to compare against the threshold for NrqlConditions.
type AlertsNrqlConditionCreateSignal ¶
type AlertsNrqlConditionCreateSignal struct { AggregationWindow *int `json:"aggregationWindow,omitempty"` EvaluationOffset *int `json:"evaluationOffset,omitempty"` FillOption *AlertsFillOption `json:"fillOption"` FillValue *float64 `json:"fillValue"` AggregationMethod *NrqlConditionAggregationMethod `json:"aggregationMethod,omitempty"` AggregationDelay *int `json:"aggregationDelay,omitempty"` AggregationTimer *int `json:"aggregationTimer,omitempty"` SlideBy *int `json:"slideBy,omitempty"` }
AlertsNrqlConditionCreateSignal - Configuration that defines the signal that the NRQL condition will use to evaluate for Create. nolint:revive
type AlertsNrqlConditionExpiration ¶
type AlertsNrqlConditionExpiration struct { ExpirationDuration *int `json:"expirationDuration"` CloseViolationsOnExpiration bool `json:"closeViolationsOnExpiration"` OpenViolationOnExpiration bool `json:"openViolationOnExpiration"` }
AlertsNrqlConditionExpiration Settings for how violations are opened or closed when a signal expires. nolint:revive
type AlertsNrqlConditionSignal ¶
type AlertsNrqlConditionSignal struct { AggregationWindow *int `json:"aggregationWindow,omitempty"` EvaluationOffset *int `json:"evaluationOffset,omitempty"` FillOption *AlertsFillOption `json:"fillOption"` FillValue *float64 `json:"fillValue"` AggregationMethod *NrqlConditionAggregationMethod `json:"aggregationMethod,omitempty"` AggregationDelay *int `json:"aggregationDelay,omitempty"` AggregationTimer *int `json:"aggregationTimer,omitempty"` SlideBy *int `json:"slideBy,omitempty"` }
AlertsNrqlConditionSignal - Configuration that defines the signal that the NRQL condition will use to evaluate. nolint:revive
type AlertsNrqlConditionUpdateSignal ¶
type AlertsNrqlConditionUpdateSignal struct { AggregationWindow *int `json:"aggregationWindow,omitempty"` EvaluationOffset *int `json:"evaluationOffset,omitempty"` FillOption *AlertsFillOption `json:"fillOption"` FillValue *float64 `json:"fillValue"` AggregationMethod *NrqlConditionAggregationMethod `json:"aggregationMethod"` AggregationDelay *int `json:"aggregationDelay"` AggregationTimer *int `json:"aggregationTimer"` SlideBy *int `json:"slideBy"` }
AlertsNrqlConditionUpdateSignal - Configuration that defines the signal that the NRQL condition will use to evaluate for Update. nolint:revive
type AlertsPoliciesSearchCriteriaInput ¶
type AlertsPoliciesSearchCriteriaInput struct { // The list of policy ids to return. IDs []string `json:"ids"` }
AlertsPoliciesSearchCriteriaInput - Search criteria for returning specific policies.
type AlertsPoliciesSearchResultSet ¶
type AlertsPoliciesSearchResultSet struct { // Cursor pointing to the end of the current page of policy records. Null if final page. NextCursor string `json:"nextCursor,omitempty"` // Set of policies returned for the supplied cursor and criteria. Policies []AlertsPolicy `json:"policies"` // Total number of policy records for the given search criteria. TotalCount int `json:"totalCount"` }
AlertsPoliciesSearchResultSet - Collection of policies with pagination information.
type AlertsPolicy ¶
type AlertsPolicy struct { // Account ID of the policy. AccountID int `json:"accountId"` // Primary key for policies. ID string `json:"id"` // Determines how incidents are created for critical violations of the conditions contained in the policy. IncidentPreference AlertsIncidentPreference `json:"incidentPreference"` // Description of the policy. Name string `json:"name"` }
AlertsPolicy - Container for conditions with associated notifications channels.
type AlertsPolicyInput ¶
type AlertsPolicyInput struct { // Determines how incidents are created for critical violations of the conditions contained in the policy. IncidentPreference AlertsIncidentPreference `json:"incidentPreference"` // Description of the policy. Name string `json:"name"` }
AlertsPolicyInput - Container for conditions with associated notifications channels.
type AlertsPolicyUpdateInput ¶
type AlertsPolicyUpdateInput struct { // Determines how incidents are created for critical violations of the conditions contained in the policy. IncidentPreference AlertsIncidentPreference `json:"incidentPreference,omitempty"` // Description of the policy. Name string `json:"name,omitempty"` }
AlertsPolicyUpdateInput - Policy fields to be updated.
type ByUser ¶
type ByUser struct { Email string `json:"email"` Gravatar string `json:"gravatar"` ID int `json:"id"` Name string `json:"name"` }
ByUser is a collection of the user information that created or updated the muting rule.
type Channel ¶
type Channel struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Type ChannelType `json:"type,omitempty"` Configuration ChannelConfiguration `json:"configuration,omitempty"` Links ChannelLinks `json:"links,omitempty"` }
Channel represents a New Relic alert notification channel
type ChannelConfiguration ¶
type ChannelConfiguration struct { Recipients string `json:"recipients,omitempty"` IncludeJSONAttachment string `json:"include_json_attachment,omitempty"` AuthToken string `json:"auth_token,omitempty"` APIKey string `json:"api_key,omitempty"` Teams string `json:"teams,omitempty"` Tags string `json:"tags,omitempty"` URL string `json:"url,omitempty"` Channel string `json:"channel,omitempty"` Key string `json:"key,omitempty"` RouteKey string `json:"route_key,omitempty"` ServiceKey string `json:"service_key,omitempty"` BaseURL string `json:"base_url,omitempty"` AuthUsername string `json:"auth_username,omitempty"` AuthPassword string `json:"auth_password,omitempty"` PayloadType string `json:"payload_type,omitempty"` Region string `json:"region,omitempty"` UserID string `json:"user_id,omitempty"` // Payload is unmarshaled to type map[string]string Payload serialization.MapStringInterface `json:"payload,omitempty"` // Headers is unmarshaled to type map[string]string Headers serialization.MapStringInterface `json:"headers,omitempty"` }
ChannelConfiguration represents a Configuration type within Channels
type ChannelLinks ¶
type ChannelLinks struct {
PolicyIDs []int `json:"policy_ids,omitempty"`
}
ChannelLinks represent the links between policies and alert channels
type ChannelType ¶
type ChannelType string
ChannelType specifies the channel type used when creating the alert channel.
type Condition ¶
type Condition struct { ID int `json:"id,omitempty"` Type ConditionType `json:"type,omitempty"` Name string `json:"name,omitempty"` Enabled bool `json:"enabled"` Entities []string `json:"entities,omitempty"` Metric MetricType `json:"metric,omitempty"` RunbookURL string `json:"runbook_url"` Terms []ConditionTerm `json:"terms,omitempty"` UserDefined ConditionUserDefined `json:"user_defined,omitempty"` Scope string `json:"condition_scope,omitempty"` GCMetric string `json:"gc_metric,omitempty"` ViolationCloseTimer int `json:"violation_close_timer,omitempty"` }
Condition represents a New Relic alert condition. TODO: custom unmarshal entities to ints?
type ConditionTerm ¶
type ConditionTerm struct { Duration int `json:"duration,string,omitempty"` Operator OperatorType `json:"operator,omitempty"` Priority PriorityType `json:"priority,omitempty"` Threshold float64 `json:"threshold,string"` TimeFunction TimeFunctionType `json:"time_function,omitempty"` }
ConditionTerm represents the terms of a New Relic alert condition.
func (*ConditionTerm) UnmarshalJSON ¶
func (c *ConditionTerm) UnmarshalJSON(data []byte) error
UnmarshalJSON is responsible for unmarshaling the ConditionTerm type.
type ConditionType ¶
type ConditionType string
ConditionType specifies the condition type used when creating the alert condition.
type ConditionUserDefined ¶
type ConditionUserDefined struct { Metric string `json:"metric,omitempty"` ValueFunction ValueFunctionType `json:"value_function,omitempty"` }
ConditionUserDefined represents user defined metrics for the New Relic alert condition.
type DayOfWeek ¶
type DayOfWeek string
DayOfWeek is used to configure a WEEKLY scheduled MutingRule.
type GraphQLErrorResponse ¶
type GraphQLErrorResponse struct { http.GraphQLErrorResponse Errors []struct { Message string `json:"message"` Path []string `json:"path"` Extensions struct { Code string `json:"code"` ErrorClass string `json:"errorClass"` ErrorCode string `json:"error_code,omitempty"` ValidationErrors []struct { Name string `json:"name"` Reason string `json:"reason"` } `json:"validationErrors"` } `json:"extensions"` } `json:"errors"` }
GraphQLErrorResponse is a special GraphQL response produced by Alerts GraphQL Service and provides additional context
func (*GraphQLErrorResponse) Error ¶
func (r *GraphQLErrorResponse) Error() string
func (*GraphQLErrorResponse) IsNotFound ¶
func (r *GraphQLErrorResponse) IsNotFound() bool
func (*GraphQLErrorResponse) New ¶
func (r *GraphQLErrorResponse) New() http.ErrorResponse
type Incident ¶
type Incident struct { ID int `json:"id,omitempty"` OpenedAt *serialization.EpochTime `json:"opened_at,omitempty"` ClosedAt *serialization.EpochTime `json:"closed_at,omitempty"` IncidentPreference string `json:"incident_preference,omitempty"` Links IncidentLink `json:"links"` }
Incident represents a New Relic alert incident.
type IncidentLink ¶
type IncidentLink struct { Violations []int `json:"violations,omitempty"` PolicyID int `json:"policy_id"` }
IncidentLink represents a link between a New Relic alert incident and its violations
type IncidentPreferenceType ¶
type IncidentPreferenceType string
IncidentPreferenceType specifies rollup settings for alert policies.
type InfrastructureCondition ¶
type InfrastructureCondition struct { Comparison string `json:"comparison,omitempty"` CreatedAt *serialization.EpochTime `json:"created_at_epoch_millis,omitempty"` Critical *InfrastructureConditionThreshold `json:"critical_threshold,omitempty"` Enabled bool `json:"enabled"` Event string `json:"event_type,omitempty"` ID int `json:"id,omitempty"` IntegrationProvider string `json:"integration_provider,omitempty"` Name string `json:"name,omitempty"` PolicyID int `json:"policy_id,omitempty"` ProcessWhere string `json:"process_where_clause,omitempty"` RunbookURL string `json:"runbook_url,omitempty"` Select string `json:"select_value,omitempty"` Type string `json:"type,omitempty"` UpdatedAt *serialization.EpochTime `json:"updated_at_epoch_millis,omitempty"` ViolationCloseTimer *int `json:"violation_close_timer,omitempty"` Warning *InfrastructureConditionThreshold `json:"warning_threshold,omitempty"` Where string `json:"where_clause,omitempty"` Description string `json:"description"` }
InfrastructureCondition represents a New Relic Infrastructure alert condition.
type InfrastructureConditionThreshold ¶
type InfrastructureConditionThreshold struct { Duration int `json:"duration_minutes,omitempty"` Function string `json:"time_function,omitempty"` Value *float64 `json:"value"` }
InfrastructureConditionThreshold represents an New Relic Infrastructure alert condition threshold.
type ListAlertEventsParams ¶
type ListAlertEventsParams struct { Product string `url:"filter[product],omitempty"` EntityType string `url:"filter[entity_type],omitempty"` EntityGroupID int `url:"filter[entity_group_id],omitempty"` EntityID int `url:"filter[entity_id],omitempty"` EventType string `url:"filter[event_type],omitempty"` IncidentID int `url:"filter[incident_id],omitempty"` Page int `url:"page,omitempty"` }
ListAlertEventsParams represents a set of filters to be used when querying New Relic alert events
type ListPoliciesParams ¶
type ListPoliciesParams struct {
Name string `url:"filter[name],omitempty"`
}
ListPoliciesParams represents a set of filters to be used when querying New Relic alert policies.
type MetricType ¶
type MetricType string
MetricType specifies the metric type used when creating the alert condition.
type MultiLocationSyntheticsCondition ¶
type MultiLocationSyntheticsCondition struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Enabled bool `json:"enabled"` RunbookURL string `json:"runbook_url,omitempty"` Entities []string `json:"entities,omitempty"` Terms []MultiLocationSyntheticsConditionTerm `json:"terms,omitempty"` ViolationTimeLimitSeconds int `json:"violation_time_limit_seconds,omitempty"` }
MultiLocationSyntheticsCondition represents a location-based failure condition.
ViolationTimeLimitSeconds must be one of 3600, 7200, 14400, 28800, 43200, 86400.
type MultiLocationSyntheticsConditionTerm ¶
type MultiLocationSyntheticsConditionTerm struct { Priority string `json:"priority,omitempty"` Threshold int `json:"threshold,omitempty"` }
MultiLocationSyntheticsConditionTerm represents a single term for a location-based failure condition.
Priority must be "warning" or "critical". Threshold must be greater than zero.
type MutingRule ¶
type MutingRule struct { ID int `json:"id,string,omitempty"` AccountID int `json:"accountId,omitempty"` Condition MutingRuleConditionGroup `json:"condition,omitempty"` CreatedAt string `json:"createdAt,omitempty"` CreatedByUser ByUser `json:"createdByUser,omitempty"` Description string `json:"description,omitempty"` Enabled bool `json:"enabled"` Name string `json:"name,omitempty"` UpdatedAt string `json:"updatedAt,omitempty"` UpdatedByUser ByUser `json:"updatedByUser,omitempty"` Schedule *MutingRuleSchedule `json:"schedule,omitempty"` }
MutingRule represents the alert suppression mechanism in the Alerts API.
type MutingRuleCondition ¶
type MutingRuleCondition struct { Attribute string `json:"attribute"` Operator string `json:"operator"` Values []string `json:"values"` }
MutingRuleCondition is a single muting rule condition.
type MutingRuleConditionGroup ¶
type MutingRuleConditionGroup struct { Conditions []MutingRuleCondition `json:"conditions"` Operator string `json:"operator"` }
MutingRuleConditionGroup is a collection of conditions for muting.
type MutingRuleCreateInput ¶
type MutingRuleCreateInput struct { Condition MutingRuleConditionGroup `json:"condition"` Description string `json:"description"` Enabled bool `json:"enabled"` Name string `json:"name"` Schedule *MutingRuleScheduleCreateInput `json:"schedule,omitempty"` }
MutingRuleCreateInput is the input for creating muting rules.
type MutingRuleSchedule ¶
type MutingRuleSchedule struct { StartTime *time.Time `json:"startTime,omitempty"` EndTime *time.Time `json:"endTime,omitempty"` TimeZone string `json:"timeZone"` Repeat *MutingRuleScheduleRepeat `json:"repeat,omitempty"` EndRepeat *time.Time `json:"endRepeat,omitempty"` RepeatCount *int `json:"repeatCount,omitempty"` WeeklyRepeatDays *[]DayOfWeek `json:"weeklyRepeatDays,omitempty"` }
MutingRuleSchedule is the time window when the MutingRule should actively mute violations
type MutingRuleScheduleCreateInput ¶
type MutingRuleScheduleCreateInput struct { StartTime *NaiveDateTime `json:"startTime,omitempty"` EndTime *NaiveDateTime `json:"endTime,omitempty"` TimeZone string `json:"timeZone"` Repeat *MutingRuleScheduleRepeat `json:"repeat,omitempty"` EndRepeat *NaiveDateTime `json:"endRepeat,omitempty"` RepeatCount *int `json:"repeatCount,omitempty"` WeeklyRepeatDays *[]DayOfWeek `json:"weeklyRepeatDays,omitempty"` }
MutingRuleScheduleCreateInput is the time window when the MutingRule should actively mute violations for Create
type MutingRuleScheduleRepeat ¶
type MutingRuleScheduleRepeat string
MutingRuleScheduleRepeat represents how frequently a MutingRule's schedule repeats.
type MutingRuleScheduleUpdateInput ¶
type MutingRuleScheduleUpdateInput struct { StartTime *NaiveDateTime `json:"startTime"` EndTime *NaiveDateTime `json:"endTime"` TimeZone *string `json:"timeZone"` Repeat *MutingRuleScheduleRepeat `json:"repeat"` EndRepeat *NaiveDateTime `json:"endRepeat"` RepeatCount *int `json:"repeatCount"` WeeklyRepeatDays *[]DayOfWeek `json:"weeklyRepeatDays"` }
MutingRuleScheduleUpdateInput is the time window when the MutingRule should actively mute violations for Update
type MutingRuleUpdateInput ¶
type MutingRuleUpdateInput struct { Condition *MutingRuleConditionGroup `json:"condition,omitempty"` Description string `json:"description,omitempty"` Enabled bool `json:"enabled"` Name string `json:"name,omitempty"` Schedule *MutingRuleScheduleUpdateInput `json:"schedule"` }
MutingRuleUpdateInput is the input for updating a rule.
type NaiveDateTime ¶
NaiveDateTime wraps `time.Time` to remove the time zone offset when JSON marshaling. NaiveDateTime is used for MutingRuleScheduleCreateInput and MutingRuleScheduleUpdateInput fields StartTime, EndTime, and EndRepeat.
func (NaiveDateTime) MarshalJSON ¶
func (t NaiveDateTime) MarshalJSON() ([]byte, error)
MarshalJSON strips the UTC time zone offset from the NaiveDateTime when JSON marshaling. If a non-UTC time zone offset is specified on the NaiveDateTime, an error will be thrown.
type NrqlAlertCondition ¶
type NrqlAlertCondition struct { NrqlConditionBase ID string `json:"id,omitempty"` PolicyID string `json:"policyId,omitempty"` // BaselineDirection exists ONLY for NRQL conditions of type BASELINE. BaselineDirection *NrqlBaselineDirection `json:"baselineDirection,omitempty"` // ValueFunction is returned ONLY for NRQL conditions of type STATIC. ValueFunction *NrqlConditionValueFunction `json:"valueFunction,omitempty"` }
NrqlAlertCondition represents a NerdGraph NRQL alert condition, which is type AlertsNrqlCondition in NerdGraph. NrqlAlertCondition could be a baseline condition or static condition.
type NrqlCondition ¶
type NrqlCondition struct { Enabled bool `json:"enabled"` ID int `json:"id,omitempty"` ViolationCloseTimer int `json:"violation_time_limit_seconds,omitempty"` Name string `json:"name,omitempty"` Nrql NrqlQuery `json:"nrql,omitempty"` RunbookURL string `json:"runbook_url,omitempty"` Terms []ConditionTerm `json:"terms,omitempty"` Type string `json:"type,omitempty"` ValueFunction ValueFunctionType `json:"value_function,omitempty"` EntityGUID *common.EntityGUID `json:"entity_guid,omitempty"` }
NrqlCondition represents a New Relic NRQL Alert condition.
type NrqlConditionAggregationMethod ¶
type NrqlConditionAggregationMethod string
NrqlConditionAggregationMethod - The available aggregation methods.
type NrqlConditionBase ¶
type NrqlConditionBase struct { Description string `json:"description,omitempty"` Enabled bool `json:"enabled"` Name string `json:"name,omitempty"` Nrql NrqlConditionQuery `json:"nrql,omitempty"` RunbookURL string `json:"runbookUrl,omitempty"` Terms []NrqlConditionTerm `json:"terms,omitempty"` Type NrqlConditionType `json:"type,omitempty"` ViolationTimeLimit NrqlConditionViolationTimeLimit `json:"violationTimeLimit,omitempty"` ViolationTimeLimitSeconds int `json:"violationTimeLimitSeconds,omitempty"` Expiration *AlertsNrqlConditionExpiration `json:"expiration,omitempty"` Signal *AlertsNrqlConditionSignal `json:"signal,omitempty"` EntityGUID common.EntityGUID `json:"entityGuid,omitempty"` }
NrqlConditionBase represents the base fields for a New Relic NRQL Alert condition.
type NrqlConditionCreateBase ¶
type NrqlConditionCreateBase struct { Description string `json:"description,omitempty"` Enabled bool `json:"enabled"` Name string `json:"name,omitempty"` Nrql NrqlConditionCreateQuery `json:"nrql,omitempty"` RunbookURL string `json:"runbookUrl,omitempty"` Terms []NrqlConditionTerm `json:"terms,omitempty"` Type NrqlConditionType `json:"type,omitempty"` ViolationTimeLimit NrqlConditionViolationTimeLimit `json:"violationTimeLimit,omitempty"` ViolationTimeLimitSeconds int `json:"violationTimeLimitSeconds,omitempty"` Expiration *AlertsNrqlConditionExpiration `json:"expiration,omitempty"` Signal *AlertsNrqlConditionCreateSignal `json:"signal,omitempty"` }
NrqlConditionCreateBase represents the base fields for creating a New Relic NRQL Alert condition.
type NrqlConditionCreateInput ¶
type NrqlConditionCreateInput struct { NrqlConditionCreateBase // BaselineDirection ONLY applies to NRQL conditions of type BASELINE. BaselineDirection *NrqlBaselineDirection `json:"baselineDirection,omitempty"` // ValueFunction ONLY applies to NRQL conditions of type STATIC. ValueFunction *NrqlConditionValueFunction `json:"valueFunction,omitempty"` }
NrqlConditionCreateInput represents the input options for creating a Nrql Condition.
type NrqlConditionCreateQuery ¶
type NrqlConditionCreateQuery struct { Query string `json:"query,omitempty"` EvaluationOffset *int `json:"evaluationOffset,omitempty"` }
NrqlConditionCreateQuery represents the NRQL query object for create.
type NrqlConditionOperator ¶
type NrqlConditionOperator string
NrqlConditionOperator specifies the operator for alert condition terms.
type NrqlConditionPriority ¶
type NrqlConditionPriority string
NrqlConditionPriority specifies the priority for alert condition terms.
type NrqlConditionQuery ¶
type NrqlConditionQuery struct { Query string `json:"query,omitempty"` EvaluationOffset *int `json:"evaluationOffset,omitempty"` }
NrqlConditionQuery represents the NRQL query object returned in a NerdGraph response object.
type NrqlConditionTerm ¶
type NrqlConditionTerm struct { Operator AlertsNRQLConditionTermsOperator `json:"operator,omitempty"` Priority NrqlConditionPriority `json:"priority,omitempty"` Threshold *float64 `json:"threshold"` ThresholdDuration int `json:"thresholdDuration,omitempty"` ThresholdOccurrences ThresholdOccurrence `json:"thresholdOccurrences,omitempty"` }
NrqlConditionTerm represents the a single term of a New Relic alert condition.
type NrqlConditionType ¶
type NrqlConditionType string
NrqlConditionType specifies the type of NRQL alert condition.
type NrqlConditionUpdateBase ¶
type NrqlConditionUpdateBase struct { Description string `json:"description,omitempty"` Enabled bool `json:"enabled"` Name string `json:"name,omitempty"` Nrql NrqlConditionUpdateQuery `json:"nrql"` RunbookURL string `json:"runbookUrl,omitempty"` Terms []NrqlConditionTerm `json:"terms,omitempty"` Type NrqlConditionType `json:"type,omitempty"` ViolationTimeLimit NrqlConditionViolationTimeLimit `json:"violationTimeLimit,omitempty"` ViolationTimeLimitSeconds int `json:"violationTimeLimitSeconds,omitempty"` Expiration *AlertsNrqlConditionExpiration `json:"expiration,omitempty"` Signal *AlertsNrqlConditionUpdateSignal `json:"signal"` }
NrqlConditionUpdateBase represents the base fields for updating a New Relic NRQL Alert condition.
type NrqlConditionUpdateInput ¶
type NrqlConditionUpdateInput struct { NrqlConditionUpdateBase // BaselineDirection ONLY applies to NRQL conditions of type BASELINE. BaselineDirection *NrqlBaselineDirection `json:"baselineDirection,omitempty"` // ValueFunction ONLY applies to NRQL conditions of type STATIC. ValueFunction *NrqlConditionValueFunction `json:"valueFunction,omitempty"` }
NrqlConditionUpdateInput represents the input options for updating a Nrql Condition.
type NrqlConditionUpdateQuery ¶
type NrqlConditionUpdateQuery struct { Query string `json:"query"` EvaluationOffset *int `json:"evaluationOffset"` }
NrqlConditionUpdateQuery represents the NRQL query object for update.
type NrqlConditionValueFunction ¶
type NrqlConditionValueFunction string
NrqlConditionValueFunction specifies the value function of NRQL alert condition.
type NrqlConditionViolationTimeLimit ¶
type NrqlConditionViolationTimeLimit string
NrqlConditionViolationTimeLimit specifies the value function of NRQL alert condition.
type NrqlQuery ¶
type NrqlQuery struct { Query string `json:"query,omitempty"` SinceValue string `json:"since_value,omitempty"` }
NrqlQuery represents a NRQL query to use with a NRQL alert condition
type OperatorType ¶
type OperatorType string
OperatorType specifies the operator for alert condition terms.
type PluginsCondition ¶
type PluginsCondition struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Enabled bool `json:"enabled"` Entities []string `json:"entities,omitempty"` Metric string `json:"metric,omitempty"` MetricDescription string `json:"metric_description,omitempty"` RunbookURL string `json:"runbook_url,omitempty"` Terms []ConditionTerm `json:"terms,omitempty"` ValueFunction string `json:"value_function,omitempty"` Plugin AlertPlugin `json:"plugin,omitempty"` }
PluginsCondition represents an alert condition for New Relic Plugins.
type Policy ¶
type Policy struct { ID int `json:"id,omitempty"` IncidentPreference IncidentPreferenceType `json:"incident_preference,omitempty"` Name string `json:"name,omitempty"` CreatedAt *serialization.EpochTime `json:"created_at,omitempty"` UpdatedAt *serialization.EpochTime `json:"updated_at,omitempty"` }
Policy represents a New Relic alert policy.
type PolicyChannels ¶
type PolicyChannels struct { ID int `json:"id,omitempty"` ChannelIDs []int `json:"channel_ids,omitempty"` }
PolicyChannels represents an association of alert channels to a specific alert policy.
type PriorityType ¶
type PriorityType string
PriorityType specifies the priority for alert condition terms.
type SyntheticsCondition ¶
type SyntheticsCondition struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Enabled bool `json:"enabled"` RunbookURL string `json:"runbook_url,omitempty"` MonitorID string `json:"monitor_id,omitempty"` }
SyntheticsCondition represents a New Relic Synthetics alert condition.
type ThresholdOccurrence ¶
type ThresholdOccurrence string
ThresholdOccurrence specifies the threshold occurrence for NRQL alert condition terms.
type TimeFunctionType ¶
type TimeFunctionType string
TimeFunctionType specifies the time function to be used for alert condition terms.
type ValueFunctionType ¶
type ValueFunctionType string
ValueFunctionType specifies the value function to be used for returning custom metric data.