Documentation
¶
Overview ¶
Package devo provides a client library for working with the REST API interfaces available with https://devo.com.
This package is NOT production ready as is.
The official API documentation for the upstream Devo API's can be found at https://docs.devo.com/confluence/ndt/latest/api-reference.
Index ¶
- Constants
- type Alert
- type AlertCorrelationContext
- type AlertCorrelationTrigger
- type AlertCreateRequest
- type AlertDeleteRequest
- type AlertListRequest
- type AlertStatusUpdateRequest
- type AlertUpdateRequest
- type AlertsService
- type AlertsServiceOp
- func (s *AlertsServiceOp) Create(createRequest *AlertCreateRequest) (*Alert, error)
- func (s *AlertsServiceOp) Delete(deleteRequest *AlertDeleteRequest) error
- func (s *AlertsServiceOp) List(parameters *AlertListRequest) ([]Alert, error)
- func (s *AlertsServiceOp) Status(statusRequest *AlertStatusUpdateRequest) error
- func (s *AlertsServiceOp) Update(updateRequest *AlertUpdateRequest) (*Alert, error)
- type Client
- type ClientOpt
Constants ¶
const ( // Default endpoint for US based Devo domains. ALERTS_API_US_DEFAULT_ENDPOINT = "https://api-us.devo.com/alerts" // Default endpoint for EU based Devo domains. ALERTS_API_EU_DEFAULT_ENDPOINT = "https://api-eu.devo.com/alerts" // Default path for API Alerting ALERTS_API_PATH_ALERT_DEFINITIONS = "/v1/alertDefinitions" // Default path for API Alerting status ALERTS_API_PATH_ALERT_DEFINITIONS_STATUS = "/v1/alertDefinitions/status" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
ID string `json:"id"`
CreationDate int `json:"creationDate"`
Name string `json:"name"`
Message string `json:"message"`
Description string `json:"description"`
Subcategory string `json:"subcategory"`
CategoryID string `json:"categoryId"`
SubcategoryID string `json:"subcategoryId"`
IsActive bool `json:"isActive"`
IsAlertChain bool `json:"isAlertChain"`
AlertCorrelationContext AlertCorrelationContext
ActionPolicyID []interface{} `json:"actionPolicyId"`
}
Alert represents an alert definition.
type AlertCorrelationContext ¶
type AlertCorrelationContext struct {
QuerySourceCode string `json:"querySourceCode"`
Priority int `json:"priority"`
CorrelationTrigger AlertCorrelationTrigger `json:"correlationTrigger"`
}
AlertCorrelationContext represents an alert correlation context.
type AlertCorrelationTrigger ¶
type AlertCorrelationTrigger struct {
Kind string `json:"kind"`
ExternalOffset string `json:"externalOffset"`
InternalPeriod string `json:"internalPeriod"`
InternalOffset string `json:"internalOffset"`
Period string `json:"period"`
Threshold string `json:"threshold"`
BackPeriod string `json:"backPeriod"`
Absolute string `json:"absolute"`
AggregationColumn string `json:"aggregationColumn"`
}
AlertCorrelationTrigger represents an alert correlation trigger.
type AlertCreateRequest ¶
type AlertCreateRequest struct {
Name string `json:"name"`
Message string `json:"message,omitempty"`
Description string `json:"description,omitempty"`
Subcategory string `json:"subcategory"`
AlertCorrelationContext AlertCorrelationContext `json:"alertCorrelationContext"`
}
AlertCreateRequest contains parameters used when creating a new alert definition in your Devo domain using Create. The parameters Name, Subcategory and AlertCorrelationContext are required by the upstream API, more information can be found in the upstream documentation here: https://docs.devo.com/confluence/ndt/latest/api-reference/alerts-api/working-with-alert-definitions
type AlertDeleteRequest ¶
type AlertDeleteRequest struct {
AlertIDs []string
}
AlertDeleteRequest contains parameters used when deleting an alert definition in your Devo domain using Delete.
type AlertListRequest ¶
type AlertListRequest struct {
// Define the group to get. See parent struct documentation.
Page string
// Define the number of alerts to get. See parent struct documentation.
Size string
// Use this parameter to filter alerts by their names. You will only get
// alerts that contain the terms specified in their names. The filter is
// case insensitive.
NameFilter string
// Indicate an alert definition ID to get only that specific alert. You
// will get the ID of an alert definition after creating a new alert
// definition through the Alerting API. Note that this ID cannot be
// found in the Devo application.
IDFilter string
}
AlertListRequest contains the parameters that can be provided to the List method.
The documentation for the upstream Devo API can be found here: https://docs.devo.com/confluence/ndt/latest/api-reference/alerting-api/working-with-alert-definitions#id-.Workingwithalertdefinitionsvv7.11.0-createalertCreateanewalertdefinition
Use these parameters to group your list of alerts by a specific number (size) and get only one of the resulting groups (page). This comes in handy if you need to get only a specific set of alerts and have a long list.
Note that the count of both the selected page and groups defined starts at 0, so for example, if you enter page=2 and size=5 and have 22 alerts in your list, the API will divide the list into groups of 5 alerts (0-4, 5-9, 10-14, 15-19, and 20-22) and will return the group of alerts 10-14.
Some struct attributes here is intentionally strings, and not ints, to allow us to distinguish between empty/no-value and 0.
type AlertStatusUpdateRequest ¶
AlertStatusUpdateRequest contains parameters used when changing the status of alert definitions in your Devo domain using Status.
type AlertUpdateRequest ¶
type AlertUpdateRequest struct {
Name string `json:"name"`
Message string `json:"message,omitempty"`
Description string `json:"description,omitempty"`
Subcategory string `json:"subcategory,omitempty"`
AlertCorrelationContext AlertCorrelationContext `json:"alertCorrelationContext,omitempty"`
}
AlertUpdateRequest contains parameters used when updating an alert definition in your Devo domain using Update. The parameter Name are required by the upstream API, more information can be found in the upstream documentation here: https://docs.devo.com/confluence/ndt/latest/api-reference/alerts-api/working-with-alert-definitions
type AlertsService ¶
type AlertsService interface {
List(parameters *AlertListRequest) ([]Alert, error)
Create(createRequest *AlertCreateRequest) (*Alert, error)
Update(updateRequest *AlertUpdateRequest) (*Alert, error)
Delete(deleteRequest *AlertDeleteRequest) error
Status(statusRequest *AlertStatusUpdateRequest) error
}
AlertService is an interface for interfacing with the Devo Alerting API.
type AlertsServiceOp ¶
type AlertsServiceOp struct {
// contains filtered or unexported fields
}
AlertsServiceOp implements the AlertService interface and handles the communication with the Devo Alerting API using its methods.
func (*AlertsServiceOp) Create ¶
func (s *AlertsServiceOp) Create(createRequest *AlertCreateRequest) (*Alert, error)
Create creates a new alert definition in your Devo domain. Accepts parameters in the form of a pointer to a AlertCreateRequest struct.
As per AlertCreateRequest documentation, certain attributes are required by the upstream API. These attributes aren't checked before submitting an API request and any errors from the API will be returned by this function. FIXME: Tests for this cannot be created right now, as Devo doesn't document what an error response looks like.
Upstream API documentation can be found here: https://docs.devo.com/confluence/ndt/latest/api-reference/alerts-api/working-with-alert-definitions
Returns an error if createRequest isn't provided.
func (*AlertsServiceOp) Delete ¶
func (s *AlertsServiceOp) Delete(deleteRequest *AlertDeleteRequest) error
Delete deletes one or more alerts in your Devo domain. Accepts parameters in the form of a pointer to a AlertDeleteRequest struct.
Returns an error if deleteRequest isn't provided. Returns an error if deleteRequest.AlertIDs is empty.
func (*AlertsServiceOp) List ¶
func (s *AlertsServiceOp) List(parameters *AlertListRequest) ([]Alert, error)
List lists all the alert definitions in your Devo domain. Accepts parameters in the form of a pointer to an AlertListRequest struct.
func (*AlertsServiceOp) Status ¶
func (s *AlertsServiceOp) Status(statusRequest *AlertStatusUpdateRequest) error
Status sets the status of one or more alerts in your Devo domain. Accepts parameters in the form of a pointer to a AlertStatusUpdateRequest.
Returns an error if statusRequest isn't provided. Returns an error if statusRequest.AlertIDs is empty.
func (*AlertsServiceOp) Update ¶
func (s *AlertsServiceOp) Update(updateRequest *AlertUpdateRequest) (*Alert, error)
Update updates an existing alert definition in your Devo domain. Accepts parameters in the form of a pointer to a AlertUpdateRequst struct.
As per AlertUpdateRequest documentation, certain attributes are required by the upstream API. These attributes aren't checked before submitting an API request and any errors from the API will be returned by this function. FIXME: Tests for this cannot be created right now, as Devo doesn't document what an error response looks like.
Upstream API documentation can be found here: https://docs.devo.com/confluence/ndt/latest/api-reference/alerts-api/working-with-alert-definitions
Returns an error if updateRequest isn't provided.