newrelic

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: Apache-2.0 Imports: 16 Imported by: 20

Documentation

Overview

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (
	ChannelByUser      AlertsChannelType = "user"
	ChannelByEmail     AlertsChannelType = "email"
	ChannelBySlack     AlertsChannelType = "slack"
	ChannelByPagerDuty AlertsChannelType = "pagerduty"
	ChannelByWebhook   AlertsChannelType = "webhook"
	ChannelByCampfire  AlertsChannelType = "campfire"
	ChannelByHipChat   AlertsChannelType = "hipchat"
	ChannelByOpsGenie  AlertsChannelType = "opsgenie"
	ChannelByVictorOps AlertsChannelType = "victorops"
	ChannelByXMatters  AlertsChannelType = "xmatters"

	ChannelWebhookByJSON AlertsChannelWebhookType = "application/json"
	ChannelWebhookByForm AlertsChannelWebhookType = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertsChannel

type AlertsChannel struct {
	ID            *int64              `json:"id,omitempty"`
	Name          *string             `json:"name,omitempty"`
	Type          AlertsChannelType   `json:"type,omitempty"`
	Configuration interface{}         `json:"configuration,omitempty"`
	Links         *AlertsChannelLinks `json:"links,omitempty"`
}

func (*AlertsChannel) UnmarshalJSON

func (c *AlertsChannel) UnmarshalJSON(data []byte) error

UnmarshalJSON customizes UnmarshalJSON method so that Configuration field can be properly unmarshlled

type AlertsChannelEntity

type AlertsChannelEntity struct {
	AlertsChannel *AlertsChannel `json:"channel,omitempty"`
}
type AlertsChannelLinks struct {
	PolicyIDs []*int64 `json:"policy_ids,omitempty"`
}

AlertsChannelLinks holds the links to AlertsPolicies

type AlertsChannelList

type AlertsChannelList struct {
	AlertsChannels []*AlertsChannel `json:"channels,omitempty"`
	AlertsLinks    *AlertsLinks     `json:"links,omitempty"`
}

type AlertsChannelListOptions

type AlertsChannelListOptions struct {
	PageOptions
}

type AlertsChannelType

type AlertsChannelType string

type AlertsChannelWebhookType

type AlertsChannelWebhookType string

type AlertsChannelsService

type AlertsChannelsService service

func (*AlertsChannelsService) Create

Create POST a AlertsChannelEntity to create

maybe a potential bug in NewRelic side from API document, Create returns a AlertsChannel json payload but actually it returns a AlertsChannelList json {"channels":[{"id":1104874,"name":"newrelic-cli-integration-test-channel","type":"email","configuration":{"recipients":""},"links":{"policy_ids":[]}}],"links":{"channel.policy_ids":"/v2/policies/{policy_id}"}} so change returned parameter *AlertsChannelEntity to *AlertsChannelList

func (*AlertsChannelsService) DeleteByID

func (s *AlertsChannelsService) DeleteByID(ctx context.Context, id int64) (*Response, error)

func (*AlertsChannelsService) ListAll

func (*AlertsChannelsService) UpdatePolicyChannels

func (s *AlertsChannelsService) UpdatePolicyChannels(ctx context.Context, policyId int64, channelIds []*int64) (*Response, error)

type AlertsConditionTerm

type AlertsConditionTerm struct {
	Duration     *string `json:"duration,omitempty"`
	Operator     *string `json:"operator,omitempty"`
	Priority     *string `json:"priority,omitempty"`
	Threshold    *string `json:"threshold,omitempty"`
	TimeFunction *string `json:"time_function,omitempty"`
}

type AlertsConditionsOptions

type AlertsConditionsOptions struct {
	PolicyIDOptions string `url:"policy_id,omitempty"`

	PageOptions
}

type AlertsConditionsService

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

func (*AlertsConditionsService) Create

func (*AlertsConditionsService) DeleteByID

func (s *AlertsConditionsService) DeleteByID(ctx context.Context, cat ConditionCategory, conditionID int64) (*Response, error)

func (*AlertsConditionsService) List

func (*AlertsConditionsService) ListAll

func (*AlertsConditionsService) Update

type AlertsDefaultCondition

type AlertsDefaultCondition struct {
	ID                  *int64                             `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"`
	GCMetric            *string                            `json:"gc_metric,omitempty"`
	RunbookURL          *string                            `json:"runbook_url,omitempty"`
	ConditionScope      *string                            `json:"condition_scope,omitempty"`
	ViolationCloseTimer *int64                             `json:"violation_close_timer,omitempty"`
	Terms               []*AlertsConditionTerm             `json:"terms,omitempty"`
	UserDefined         *AlertsDefaultConditionUserDefined `json:"user_defined,omitempty"`
}

AlertsDefaultCondition manages Conditions of * APM Application * Key Transaction * Browser application metric * Mobile application metric for your alert policies

NOTICE: API documents says Entities are integers, but it's string actually

type AlertsDefaultConditionEntity

type AlertsDefaultConditionEntity struct {
	AlertsDefaultCondition *AlertsDefaultCondition `json:"condition,omitempty"`
}

type AlertsDefaultConditionList

type AlertsDefaultConditionList struct {
	AlertsDefaultConditions []*AlertsDefaultCondition `json:"conditions,omitempty"`
}

type AlertsDefaultConditionUserDefined

type AlertsDefaultConditionUserDefined struct {
	Metric        *string `json:"metric,omitempty"`
	ValueFunction *string `json:"value_function,omitempty"`
}

type AlertsEventList

type AlertsEventList struct {
	RecentEvents []*RecentEvent `json:"recent_events,omitempty"`
}

type AlertsEventListOptions

type AlertsEventListOptions struct {
	PageOptions
	Product       string `url:"filter[product],omitempty"`
	EntityType    string `url:"filter[entity_type],omitempty"`
	EntityGroupID int64  `url:"filter[entity_group_id],omitempty"`
	EntityID      int64  `url:"filter[entity_id],omitempty"`
	EventType     string `url:"filter[event_type],omitempty"`
	IncidentID    int64  `url:"filter[incident_id],omitempty"`
}

type AlertsEventService

type AlertsEventService service

func (*AlertsEventService) ListAll

type AlertsExternalServiceCondition

type AlertsExternalServiceCondition struct {
	ID                 *int64                 `json:"id,omitempty"`
	Type               *string                `json:"type,omitempty"`
	Name               *string                `json:"name,omitempty"`
	Enabled            *bool                  `json:"enabled,omitempty"`
	Entities           []*string              `json:"entities,omitempty"`
	ExternalServiceURL *string                `json:"external_service_url,omitempty"`
	Metric             *string                `json:"metric,omitempty"`
	RunbookURL         *string                `json:"runbook_url,omitempty"`
	Terms              []*AlertsConditionTerm `json:"terms,omitempty"`
}

type AlertsExternalServiceConditionEntity

type AlertsExternalServiceConditionEntity struct {
	AlertsExternalServiceCondition *AlertsExternalServiceCondition `json:"external_service_condition,omitempty"`
}

type AlertsExternalServiceConditionList

type AlertsExternalServiceConditionList struct {
	AlertsExternalServiceConditions []*AlertsExternalServiceCondition `json:"external_service_conditions,omitempty"`
}

type AlertsIncident

type AlertsIncident struct {
	ID                 *int64               `json:"id,omitempty"`
	OpenedAt           *int64               `json:"opened_at,omitempty"`
	IncidentPreference *string              `json:"incident_preference,omitempty"`
	Links              *AlertsIncidentLinks `json:"links,omitempty"`
}
type AlertsIncidentLinks struct {
	Violations []*int64 `json:"violations,omitempty"`
	PolicyID   *int64   `json:"policy_id,omitempty"`
}

type AlertsIncidentList

type AlertsIncidentList struct {
	Incidents []*AlertsIncident        `json:"incidents,omitempty"`
	Links     *AlertsIncidentListLinks `json:"links,omitempty"`
}
type AlertsIncidentListLinks struct {
	IncidentPolicyID *string `json:"incident.policy_id,omitempty"`
}

type AlertsIncidentListOptions

type AlertsIncidentListOptions struct {
	PageOptions
	OnlyOpen bool `url:"only_open,omitempty"`
}

type AlertsIncidentService

type AlertsIncidentService service

func (*AlertsIncidentService) ListAll

type AlertsInfraThreshold added in v0.1.6

type AlertsInfraThreshold struct {
	CriticalThreshold *AlertsInfraThresholdValues `json:"critical_threshold,omitempty"`
	WarningThreshold  *AlertsInfraThresholdValues `json:"warning_threshold,omitempty"`
}

AlertsInfraThreshold thresholds for alert conditions

type AlertsInfraThresholdValues added in v0.1.6

type AlertsInfraThresholdValues struct {
	DurationMinutes *int64  `json:"duration_minutes,omitempty"`
	TimeFunction    *string `json:"time_function,omitempty"`
	Value           *int64  `json:"value,omitempty"`
}

AlertsInfraThresholdValues threshold values for condition

type AlertsInfrastructureCondition added in v0.1.6

type AlertsInfrastructureCondition struct {
	AlertsInfraThreshold
	Comparison           *string      `json:"comparison,omitempty"`
	CreatedAtEpochMillis *int64       `json:"created_at_epoch_millis,omitempty"`
	Enabled              *bool        `json:"enabled,omitempty"`
	EventType            *string      `json:"event_type,omitempty"`
	Filter               *filterField `json:"filter,omitempty"`
	ID                   *int64       `json:"id,omitempty"`
	IntegrationProvider  *string      `json:"integration_provider,omitempty"`
	Name                 *string      `json:"name,omitempty"`
	PolicyID             *int64       `json:"policy_id,omitempty"`
	SelectValue          *string      `json:"select_value,omitempty"`
	Type                 *string      `json:"type,omitempty"`
	UpdatedAtEpochMillis *int64       `json:"updated_at_epoch_millis,omitempty"`
	WhereClause          *string      `json:"where_clause,omitempty"`
}

AlertsInfrastructureCondition object for infrastructure condition

type AlertsInfrastructureConditionEntity added in v0.1.6

type AlertsInfrastructureConditionEntity struct {
	AlertsInfrastructureCondition *AlertsInfrastructureCondition `json:"data,omitempty"`
}

AlertsInfrastructureConditionEntity infrastructure alert condition entity

type AlertsInfrastructureConditionList added in v0.1.6

type AlertsInfrastructureConditionList struct {
	AlertsInfrastructureConditions []*AlertsInfrastructureCondition `json:"data,omitempty"`
}

AlertsInfrastructureConditionList list of infrastructure conditions

type AlertsLinks struct {
	ChannelPolicyIDs *string `json:"channel.policy_ids,omitempty"`
}

type AlertsNRQLCondition

type AlertsNRQLCondition struct {
	ID            *int64                   `json:"id,omitempty"`
	Name          *string                  `json:"name,omitempty"`
	RunbookURL    *string                  `json:"runbook_url,omitempty"`
	Enabled       *bool                    `json:"enabled,omitempty"`
	Terms         []*AlertsConditionTerm   `json:"terms,omitempty"`
	ValueFunction *string                  `json:"value_function,omitempty"`
	NRQL          *AlertsNRQLConditionNRQL `json:"nrql,omitempty"`
}

type AlertsNRQLConditionEntity

type AlertsNRQLConditionEntity struct {
	AlertsNRQLCondition *AlertsNRQLCondition `json:"nrql_condition,omitempty"`
}

type AlertsNRQLConditionList

type AlertsNRQLConditionList struct {
	AlertsNRQLConditions []*AlertsNRQLCondition `json:"nrql_conditions,omitempty"`
}

type AlertsNRQLConditionNRQL

type AlertsNRQLConditionNRQL struct {
	Query      *string `json:"query,omitempty"`
	SinceValue *string `json:"since_value,omitempty"`
}

type AlertsPluginsCondition

type AlertsPluginsCondition struct {
	ID                *int64                        `json:"id,omitempty"`
	Name              *string                       `json:"name,omitempty"`
	Enabled           *bool                         `json:"enabled,omitempty"`
	Entities          []*int64                      `json:"entities,omitempty"`
	MetricDescription *string                       `json:"metric_description,omitempty"`
	Metric            *string                       `json:"metric,omitempty"`
	ValueFunction     *string                       `json:"value_function,omitempty"`
	RunbookURL        *string                       `json:"runbook_url,omitempty"`
	Terms             []*AlertsConditionTerm        `json:"terms,omitempty"`
	Plugin            *AlertsPluginsConditionPlugin `json:"plugin,omitempty"`
}

type AlertsPluginsConditionEntity

type AlertsPluginsConditionEntity struct {
	AlertsPluginsCondition *AlertsPluginsCondition `json:"plugins_condition,omitempty"`
}

type AlertsPluginsConditionList

type AlertsPluginsConditionList struct {
	AlertsPluginsConditions []*AlertsPluginsCondition `json:"plugins_conditions,omitempty"`
}

type AlertsPluginsConditionPlugin

type AlertsPluginsConditionPlugin struct {
	ID   *string `json:"id,omitempty"`
	GUID *string `json:"guid,omitempty"`
}

type AlertsPoliciesService

type AlertsPoliciesService service

func (*AlertsPoliciesService) Create

Create tries to create an alerts policy CAVEAT: it's good practice to check if a `p` existed If a `p` is "Created" twice, two alerts policies will be created with same Name but different ID

func (*AlertsPoliciesService) DeleteByID

func (s *AlertsPoliciesService) DeleteByID(ctx context.Context, id int64) (*Response, error)

func (*AlertsPoliciesService) ListAll

func (*AlertsPoliciesService) Update

type AlertsPolicy

type AlertsPolicy struct {
	ID                 *int64                   `json:"id,omitempty"`
	IncidentPreference IncidentPreferenceOption `json:"incident_preference,omitempty"`
	Name               *string                  `json:"name,omitempty"`
	CreatedAt          *int64                   `json:"created_at,omitempty"`
	UpdatedAt          *int64                   `json:"updated_at,omitempty"`
}

type AlertsPolicyEntity

type AlertsPolicyEntity struct {
	AlertsPolicy *AlertsPolicy `json:"policy,omitempty"`
}

type AlertsPolicyList

type AlertsPolicyList struct {
	AlertsPolicies []*AlertsPolicy `json:"policies,omitempty"`
}

type AlertsPolicyListOptions

type AlertsPolicyListOptions struct {
	NameOptions string `url:"filter[name],omitempty"`

	PageOptions
}

type AlertsSyntheticsCondition

type AlertsSyntheticsCondition struct {
	ID         *int64  `json:"id,omitempty"`
	Name       *string `json:"name,omitempty"`
	MonitorID  *string `json:"monitor_id,omitempty"`
	RunbookURL *string `json:"runbook_url,omitempty"`
	Enabled    *bool   `json:"enabled,omitempty"`
}

type AlertsSyntheticsConditionEntity

type AlertsSyntheticsConditionEntity struct {
	AlertsSyntheticsCondition *AlertsSyntheticsCondition `json:"synthetics_condition,omitempty"`
}

type AlertsSyntheticsConditionList

type AlertsSyntheticsConditionList struct {
	AlertsSyntheticsConditions []*AlertsSyntheticsCondition `json:"synthetics_conditions,omitempty"`
}

type AlertsViolation

type AlertsViolation struct {
	ID            *int64                 `json:"id,omitempty"`
	Label         *string                `json:"label,omitempty"`
	Duration      *int64                 `json:"duration,omitempty"`
	PolicyName    *string                `json:"policy_name,omitempty"`
	ConditionName *string                `json:"condition_name,omitempty"`
	Priority      *string                `json:"priority,omitempty"`
	OpenedAt      *int64                 `json:"opened_at,omitempty"`
	Entity        *AlertsViolationEntity `json:"entity,omitempty"`
	Links         *AlertsViolationLinks  `json:"links,omitempty"`
	ClosedAt      *int64                 `json:"closed_at,omitempty"`
}

type AlertsViolationEntity

type AlertsViolationEntity struct {
	Product *string `json:"product,omitempty"`
	Type    *string `json:"type,omitempty"`
	GroupID *int64  `json:"group_id,omitempty"`
	ID      *int64  `json:"id,omitempty"`
	Name    *string `json:"name,omitempty"`
}
type AlertsViolationLinks struct {
	PolicyID    *int64 `json:"policy_id,omitempty"`
	ConditionID *int64 `json:"condition_id,omitempty"`
}

type AlertsViolationList

type AlertsViolationList struct {
	Violations []*AlertsViolation        `json:"violations,omitempty"`
	Links      *AlertsViolationListLinks `json:"links,omitempty"`
}
type AlertsViolationListLinks struct {
	ViolationPolicyID    *string `json:"violation.policy_id,omitempty"`
	ViolationConditionID *string `json:"violation.condition_id,omitempty"`
}

type AlertsViolationListOptions

type AlertsViolationListOptions struct {
	PageOptions
	OnlyOpen  bool   `url:"only_open,omitempty"`
	StartDate string `url:"start_date,omitempty"`
	EndDate   string `url:"end_date,omitempty"`
}

type AlertsViolationService

type AlertsViolationService service

func (*AlertsViolationService) ListAll

type ChannelCampfireConfig

type ChannelCampfireConfig struct {
	Subdomain *string `json:"subdomain,omitempty"`
	Token     *string `json:"token,omitempty"`
	Room      *string `json:"room,omitempty"`
}

type ChannelEmailConfig

type ChannelEmailConfig struct {
	Recipients            *string `json:"recipients,omitempty"`
	IncludeJSONAttachment *bool   `json:"include_json_attachment,omitempty"`
}

ChannelEmailConfig is struct of Email Alert Channel

type ChannelHipChatConfig

type ChannelHipChatConfig struct {
	AuthToken *string `json:"auth_token,omitempty"`
	RoomId    *string `json:"room_id,omitempty"`
}

type ChannelOpsGenieConfig

type ChannelOpsGenieConfig struct {
	ApiKey     *string `json:"api_key,omitempty"`
	Teams      *string `json:"teams,omitempty"`
	Tags       *string `json:"tags,omitempty"`
	Recipients *string `json:"recipients,omitempty"`
}

type ChannelPagerDutyConfig

type ChannelPagerDutyConfig struct {
	ServiceKey *string `json:"service_key,omitempty"`
}

ChannelPagerDutyConfig is struct of Pagerduty Alert Channel

type ChannelSlackConfig

type ChannelSlackConfig struct {
	URL     *string `json:"url,omitempty"`
	Channel *string `json:"channel,omitempty"`
}

ChannelSlackConfig is struct of Slack Alert Channel

type ChannelUserConfig

type ChannelUserConfig struct {
	UserID *string `json:"user_id,omitempty"`
}

ChannelUserConfig is system generated alerts channel, it's non-editable

type ChannelVictorOpsConfig

type ChannelVictorOpsConfig struct {
	Key      *string `json:"key,omitempty"`
	RouteKey *string `json:"route_key,omitempty"`
}

type ChannelWebhookConfig

type ChannelWebhookConfig struct {
	BaseURL      *string                  `json:"base_url,omitempty"`
	AuthUsername *string                  `json:"auth_username,omitempty"`
	AuthPassword *string                  `json:"auth_password,omitempty"`
	PayloadType  AlertsChannelWebhookType `json:"payload_type,omitempty"`
	Payload      *map[string]interface{}  `json:"payload,omitempty"`
	Headers      *map[string]string       `json:"headers,omitempty"`
}

ChannelWebhookConfig is struct of Webhook Alert Channel

type ChannelXMattersConfig added in v0.1.7

type ChannelXMattersConfig struct {
	URL     *string `json:"url,omitempty"`
	Channel *string `json:"channel,omitempty"`
}

type Client

type Client struct {
	BaseURL   *url.URL
	UserAgent string
	XApiKey   string
	ProxyAuth string
	Retries   int

	Users              *UsersService
	AlertsPolicies     *AlertsPoliciesService
	AlertsChannels     *AlertsChannelsService
	Labels             *LabelsService
	AlertsIncidents    *AlertsIncidentService
	AlertsViolations   *AlertsViolationService
	AlertsEvents       *AlertsEventService
	AlertsConditions   *AlertsConditionsService
	SyntheticsMonitors *SyntheticsService
	SyntheticsScript   *ScriptService
	LabelsSynthetics   *LabelsSyntheticsService
	Dashboards         *DashboardService
	CustomEvents       *CustomEventService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client, endpointType string) *Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)

func (*Client) DoWithBytes

func (c *Client) DoWithBytes(ctx context.Context, req *http.Request) (*Response, []byte, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

func (*Client) NewRequestForNonJSON

func (c *Client) NewRequestForNonJSON(method, urlStr string, body string) (*http.Request, error)

type ConditionCategory

type ConditionCategory string
const (
	// https://docs.newrelic.com/docs/alerts/rest-api-alerts/new-relic-alerts-rest-api/rest-api-calls-new-relic-alerts
	ConditionDefault         ConditionCategory = "condition"
	ConditionPlugins         ConditionCategory = "plugins_condition"
	ConditionExternalService ConditionCategory = "external_service_condition"
	ConditionSynthetics      ConditionCategory = "synthetics_condition"
	ConditionNRQL            ConditionCategory = "nrql_condition"
	ConditionInfrastructure  ConditionCategory = "infrastructure_condition"
)

type CreateDashboardResponse added in v0.1.5

type CreateDashboardResponse struct {
	Dashboard *Dashboard `json:"dashboard,omitempty"`
}

type CustomEventService

type CustomEventService service

func (*CustomEventService) Insert

func (s *CustomEventService) Insert(ctx context.Context, insertKey string, accountID string, jsonData string) (*Response, []byte, error)

type Dashboard

type Dashboard struct {
	ID          *int64  `json:"id,omitempty"`
	Title       *string `json:"title,omitempty"`
	Description *string `json:"description,omitempty"`
	Icon        *string `json:"icon,omitempty"`
	//created_at
	//updated_at
	Visibility *string `json:"visibility,omitempty"`
	Editable   *string `json:"editable,omitempty"`
	UIURL      *string `json:"ui_url,omitempty"`
	APIURL     *string `json:"api_url,omitempty"`
	OwnerEmail *string `json:"owner_email,omitempty"`
}

type DashboardList

type DashboardList struct {
	Dashboards []*Dashboard `json:"dashboards,omitempty"`
}

type DashboardListOptions

type DashboardListOptions struct {
	PageOptions
}

type DashboardService

type DashboardService service

func (*DashboardService) Create

func (s *DashboardService) Create(ctx context.Context, dashboard string) (*Response, []byte, error)

func (*DashboardService) DeleteByID

func (s *DashboardService) DeleteByID(ctx context.Context, id int64) (*Response, []byte, error)

func (*DashboardService) GetByID

func (s *DashboardService) GetByID(ctx context.Context, id int64) (*Response, []byte, error)

func (*DashboardService) ListAll

func (*DashboardService) Update

func (s *DashboardService) Update(ctx context.Context, dashboard string, id int64) (*Response, []byte, error)

type IncidentPreferenceOption

type IncidentPreferenceOption string
const (
	// https://docs.newrelic.com/docs/alerts/rest-api-alerts/new-relic-alerts-rest-api/rest-api-calls-new-relic-alerts#policies-create
	IncidentPerPolicy            IncidentPreferenceOption = "PER_POLICY"
	IncidentPerCondition         IncidentPreferenceOption = "PER_CONDITION"
	IncidentPerConditionAndTaret IncidentPreferenceOption = "PER_CONDITION_AND_TARGET"
)

type Label

type Label struct {
	Key                           *string             `json:"key,omitempty"`
	Category                      *string             `json:"category,omitempty"`
	Name                          *string             `json:"name,omitempty"`
	LabelsApplicationHealthStatus *LabelsHealthStatus `json:"application_health_status,omitempty"`
	LabelsServerHealthStatus      *LabelsHealthStatus `json:"server_health_status,omitempty"`
	LabelLinks                    *LabelLinks         `json:"links,omitempty"`
}

type LabelEntity

type LabelEntity struct {
	Label *Label `json:"label,omitempty"`
}
type LabelLinks struct {
	Applications []*int64 `json:"applications,omitempty"`
	Servers      []*int64 `json:"servers,omitempty"`
}

type LabelList

type LabelList struct {
	Labels         []*Label        `json:"labels,omitempty"`
	LabelListLinks *LabelListLinks `json:"links,omitempty"`
}
type LabelListLinks struct {
	LabelApplications *string `json:"label.applications,omitempty"`
	LabelServers      *string `json:"label.servers,omitempty"`
	LabelServer       *string `json:"label.server,omitempty"`
}

type LabelListOptions

type LabelListOptions struct {
	PageOptions
}

type LabelSynthetics

type LabelSynthetics struct {
	PagedData *MonitorRefList `json:"pagedData,omitempty"`
	Metadata  *Metadata       `json:"metadata,omitempty"`
}

type LabelsHealthStatus

type LabelsHealthStatus struct {
	Green  []*int64 `json:"green,omitempty"`
	Orange []*int64 `json:"orange,omitempty"`
	Red    []*int64 `json:"red,omitempty"`
	Gray   []*int64 `json:"gray,omitempty"`
}

type LabelsService

type LabelsService service

func (*LabelsService) Create

func (*LabelsService) DeleteByKey

func (s *LabelsService) DeleteByKey(ctx context.Context, key string) (*Response, error)

func (*LabelsService) ListAll

type LabelsSyntheticsService

type LabelsSyntheticsService service

func (*LabelsSyntheticsService) AddLabelToMonitor

func (s *LabelsSyntheticsService) AddLabelToMonitor(ctx context.Context, monitorId string, monitorLabel *MonitorLabel) (*Response, error)

func (*LabelsSyntheticsService) DeleteLabelFromMonitor

func (s *LabelsSyntheticsService) DeleteLabelFromMonitor(ctx context.Context, monitorId string, label string) (*Response, error)

func (*LabelsSyntheticsService) GetMonitorsByLabel

func (s *LabelsSyntheticsService) GetMonitorsByLabel(ctx context.Context, opt *PageLimitOptions, label string) (*LabelSynthetics, *Response, error)

type Metadata

type Metadata struct {
	Limit  *int `json:"limit,omitempty"`
	Offset *int `json:"offset,omitempty"`
}

type Monitor

type Monitor struct {
	ID           *string        `json:"id,omitempty"`
	Name         *string        `json:"name,omitempty"`
	Type         *string        `json:"type,omitempty"`
	Frequency    *int64         `json:"frequency,omitempty"`
	URI          *string        `json:"uri,omitempty"`
	Locations    []*string      `json:"locations,omitempty"`
	Status       *string        `json:"status,omitempty"`
	SLAThreshold *float64       `json:"slaThreshold,omitempty"`
	UserID       *int64         `json:"userId,omitempty"`
	ApiVersion   *string        `json:"apiVersion,omitempty"`
	CreatedAt    *string        `json:"createdAt,omitempty"`
	UpdatedAt    *string        `json:"modifiedAt,omitempty"`
	Options      MonitorOptions `json:"options,omitempty"`
	Script       *Script        `json:"script,omitempty"`
	Labels       []*string      `json:"labels,omitempty"`
}

type MonitorLabel

type MonitorLabel struct {
	Category *string `json:"id,omitempty"`
	Label    *string `json:"href,omitempty"`
}

type MonitorList

type MonitorList struct {
	Monitors []*Monitor `json:"monitors,omitempty"`
}

type MonitorListOptions

type MonitorListOptions struct {
	PageOptions
	PageLimitOptions
}

type MonitorOptions

type MonitorOptions struct {
	ValidationString       *string `json:"validationString,omitempty"`
	VerifySSL              bool    `json:"verifySSL,omitempty"`
	BypassHEADRequest      bool    `json:"bypassHEADRequest,omitempty"`
	TreatRedirectAsFailure bool    `json:"treatRedirectAsFailure,omitempty"`
}

type MonitorRef

type MonitorRef struct {
	ID   *string `json:"id,omitempty"`
	HREF *string `json:"href,omitempty"`
}

type MonitorRefList

type MonitorRefList struct {
	MonitorRefs []*MonitorRef `json:"monitorRefs,omitempty"`
}

type PageLimitOptions

type PageLimitOptions struct {
	Limit  int `url:"limit,omitempty"`
	Offset int `url:"offset,omitempty"`
}

type PageOptions

type PageOptions struct {
	Page int `url:"page,omitempty"`
}

type PolicyChannelsAssociation

type PolicyChannelsAssociation struct {
	PolicyID      *int64   `json:"policyId,omitempty"`
	ChannelIDList []*int64 `json:"channels,omitempty"`
}

type RecentEvent

type RecentEvent struct {
	ID            *int64  `json:"id,omitempty"`
	EventType     *string `json:"event_type,omitempty"`
	Description   *string `json:"description,omitempty"`
	Timestamp     *int64  `json:"timestamp,omitempty"`
	IncidentID    *int64  `json:"incident_id,omitempty"`
	Product       *string `json:"product,omitempty"`
	EntityType    *string `json:"entity_type,omitempty"`
	EntityGroupID *int64  `json:"entity_group_id,omitempty"`
	EntityID      *int64  `json:"entity_id,omitempty"`
	Priority      *string `json:"priority,omitempty"`
}

type Response

type Response struct {
	*http.Response

	NextPage  int
	PrePage   int
	FirstPage int
	LastPage  int
}

func (*Response) String

func (r *Response) String() string

type Script

type Script struct {
	ScriptText *string `json:"scriptText,omitempty"`
}

type ScriptService

type ScriptService service

func (*ScriptService) GetByID

func (s *ScriptService) GetByID(ctx context.Context, id string) (*Script, *Response, error)

func (*ScriptService) UpdateByID

func (s *ScriptService) UpdateByID(ctx context.Context, scriptText *Script, id string) (*Response, error)

type SyntheticsService

type SyntheticsService service

func (*SyntheticsService) Create

func (s *SyntheticsService) Create(ctx context.Context, monitor *Monitor) (*Monitor, *Response, error)

func (*SyntheticsService) DeleteByID

func (s *SyntheticsService) DeleteByID(ctx context.Context, id *string) (*Response, error)

func (*SyntheticsService) GetByID

func (s *SyntheticsService) GetByID(ctx context.Context, id string) (*Monitor, *Response, error)

func (*SyntheticsService) ListAll

func (*SyntheticsService) Patch

func (s *SyntheticsService) Patch(ctx context.Context, monitor *Monitor, id *string) (*Response, error)

func (*SyntheticsService) Update

func (s *SyntheticsService) Update(ctx context.Context, monitor *Monitor, id *string) (*Response, error)

type User

type User struct {
	ID        *int64  `json:"id,omitempty"`
	FirstName *string `json:"first_name,omitempty"`
	LastName  *string `json:"last_name,omitempty"`
	Email     *string `json:"email,omitempty"`
	Role      *string `json:"role,omitempty"`
}

User represents a NewRelic user.

type UserEntity

type UserEntity struct {
	User *User `json:"user,omitempty"`
}

UserEntity corresponds to a JSON payload returned by NewRelic API

type UserList

type UserList struct {
	Users []*User `json:"users,omitempty"`
}

UserList represents a collection of NewRelic users.

type UserListOptions

type UserListOptions struct {
	IDOptions    string `url:"filter[ids],omitempty"`
	EmailOptions string `url:"filter[email],omitempty"`

	PageOptions
}

UserListOptions specifies optional parameters to the UsersService.ListAll method.

type UsersService

type UsersService service

UsersService handles communication with the user related methods of the NewRelic API.

NewRelic API docs: https://docs.newrelic.com/docs/apis/rest-api-v2/account-examples-v2/listing-users-your-account

func (*UsersService) GetByID

func (s *UsersService) GetByID(ctx context.Context, id int64) (*UserEntity, *Response, error)

GetByID returns specfic NewRelic user by given `id`

func (*UsersService) ListAll

func (s *UsersService) ListAll(ctx context.Context, opt *UserListOptions) (*UserList, *Response, error)

ListAll retruns all NewRelic users under current account/NEW_RELIC_API_KEY When given `opt`, it returns fitlered resultset

Jump to

Keyboard shortcuts

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