api

package
v0.0.0-...-fc3f7f0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintPolicyTree

func PrintPolicyTree(policy alerting.NotificationPolicy, depth int)

Types

type Client

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

func NewClient

func NewClient(url string, apiKey string) *Client

func (*Client) AddNestedPolicy

func (c *Client) AddNestedPolicy(newNotificationPolicy alerting.NotificationPolicy) error

AddNestedPolicy Add Nested Policy to Notification Policy Tree

func (*Client) CreateOrUpdateContactPoint

func (c *Client) CreateOrUpdateContactPoint(contactPoint alerting.ContactPoint) error

CreateOrUpdateContactPoint create or update a contact point

func (*Client) DeleteAlertRule

func (c *Client) DeleteAlertRule(uid string) (DeleteAlertRuleResponse, *resty.Response, error)

DeleteAlertRule Delete a specific alert rule by UID

func (*Client) DeleteContactPoint

func (c *Client) DeleteContactPoint(uid string) (DeleteContactPointResponse, *resty.Response, error)

DeleteContactPoint Delete a contact point

func (*Client) DeleteDashboardByUID

func (c *Client) DeleteDashboardByUID(uid string) (*resty.Response, error)

func (*Client) DeleteNestedPolicy

func (c *Client) DeleteNestedPolicy(newNotificationPolicy alerting.NotificationPolicy) error

DeleteNestedPolicy Delete Nested Policy from Notification Policy Tree

func (*Client) DeleteNotificationPolicy

func (c *Client) DeleteNotificationPolicy() (DeleteNotificationPolicyResponse, *resty.Response, error)

DeleteNotificationPolicy Clears the notification policy tree

func (*Client) DeleteNotificationTemplate

func (c *Client) DeleteNotificationTemplate(name string) (DeleteNotificationTemplateResponse, *resty.Response, error)

func (*Client) FindOrCreateFolder

func (c *Client) FindOrCreateFolder(name string) (*Folder, error)

FindOrCreateFolder returns the folder by its name or creates it if it doesn't exist

func (*Client) GetAlertRules

func (c *Client) GetAlertRules() (GetAllAlertRulesResponse, *resty.Response, error)

GetAlertRules Get all alert rules

func (*Client) GetAlertRulesByDashboardUID

func (c *Client) GetAlertRulesByDashboardUID(dashboardUID string) (GetAllAlertRulesResponse, error)

GetAlertRulesByDashboardUID Get alert rules by dashboard UID

func (*Client) GetAlertRulesByFolderUIDAndGroupName

func (c *Client) GetAlertRulesByFolderUIDAndGroupName(folderUID string, ruleGroupName string) (GetAllAlertRulesResponse, error)

GetAlertRulesByFolderUIDAndGroupName Get alert rules by folder UID and GroupName

func (*Client) GetContactPointByName

func (c *Client) GetContactPointByName(name string) (*alerting.ContactPoint, error)

GetContactPointByName Get a contact point by name

func (*Client) GetContactPoints

func (c *Client) GetContactPoints() (GetContactPointsResponse, *resty.Response, error)

GetContactPoints Get all the contact points

func (*Client) GetDashboardByName

func (c *Client) GetDashboardByName(name string) (GetDashboardResponse, *resty.Response, error)

func (*Client) GetDataSourceByName

func (c *Client) GetDataSourceByName(name string) (*Datasource, *resty.Response, error)

GetDataSourceByName Get a datasource by name

func (*Client) GetFolderByTitle

func (c *Client) GetFolderByTitle(title string) (*Folder, error)

GetFolderByTitle Get a folder by title

func (*Client) GetFolders

func (c *Client) GetFolders() (GetAllFoldersResponse, *resty.Response, error)

GetFolders Get all folders

func (*Client) GetNotificationPolicy

func (c *Client) GetNotificationPolicy() (GetNotificationPolicyResponse, *resty.Response, error)

GetNotificationPolicy Get the notification policy tree

func (*Client) PostAlertRule

func (c *Client) PostAlertRule(alertRule alerting.Rule) (PostAlertRuleResponse, *resty.Response, error)

PostAlertRule Create a new alert rule

func (*Client) PostContactPoint

func (c *Client) PostContactPoint(contactPoint alerting.ContactPoint) (PostContactPointResponse, *resty.Response, error)

PostContactPoint Create a new contact point

func (*Client) PostDashboard

func (c *Client) PostDashboard(dashboard PostDashboardRequest) (PostDashboardResponse, *resty.Response, error)

func (*Client) PostFolder

func (c *Client) PostFolder(name string) (*Folder, *resty.Response, error)

PostFolder Create a new folder

func (*Client) PutContactPoint

func (c *Client) PutContactPoint(uid string, contactPoint alerting.ContactPoint) (PutContactPointResponse, *resty.Response, error)

PutContactPoint Update an existing contact point

func (*Client) PutNotificationPolicy

func (c *Client) PutNotificationPolicy(notificationPolicy alerting.NotificationPolicy) (PutNotificationPolicyResponse, *resty.Response, error)

PutNotificationPolicy Sets the notification policy tree

func (*Client) PutNotificationTemplate

func (c *Client) PutNotificationTemplate(notificationTemplate alerting.NotificationTemplate) (PutNotificationPolicyResponse, *resty.Response, error)

PutNotificationTemplate Create or update a notification template

func (*Client) UpdateAlertRule

func (c *Client) UpdateAlertRule(uid string, alertRule alerting.Rule) (UpdateAlertRuleResponse, *resty.Response, error)

UpdateAlertRule Update a specific alert rule by UID

func (*Client) UpdateAlertRuleGroup

func (c *Client) UpdateAlertRuleGroup(folderUID string, alertRuleGroup alerting.RuleGroup) (UpdateAlertRuleGroupResponse, *resty.Response, error)

UpdateAlertRuleGroup Update a specific alert rule group

type Datasource

type Datasource struct {
	ID   uint   `json:"id"`
	UID  string `json:"uid"`
	Name string `json:"name"`
}

type DeleteAlertRuleResponse

type DeleteAlertRuleResponse struct{}

type DeleteContactPointResponse

type DeleteContactPointResponse struct{}

type DeleteNotificationPolicyResponse

type DeleteNotificationPolicyResponse struct{}

type DeleteNotificationTemplateResponse

type DeleteNotificationTemplateResponse struct{}

type Folder

type Folder struct {
	ID    uint   `json:"id"`
	UID   string `json:"uid"`
	Title string `json:"title"`
}

type GetAllAlertRulesResponse

type GetAllAlertRulesResponse []alerting.Rule

type GetAllFoldersResponse

type GetAllFoldersResponse []Folder

type GetContactPointsResponse

type GetContactPointsResponse []alerting.ContactPoint

type GetDashboardResponse

type GetDashboardResponse struct {
	ID    *uint   `json:"id"`
	UID   *string `json:"uid"`
	Title *string `json:"title"`
}

type GetNotificationPolicyResponse

type GetNotificationPolicyResponse alerting.NotificationPolicy

type PostAlertRuleResponse

type PostAlertRuleResponse struct{}

type PostContactPointResponse

type PostContactPointResponse struct{}

type PostDashboardRequest

type PostDashboardRequest struct {
	Dashboard interface{} `json:"dashboard"`
	FolderID  int         `json:"folderId"`
	Overwrite bool        `json:"overwrite"`
}

type PostDashboardResponse

type PostDashboardResponse struct {
	ID      *uint   `json:"id"`
	OrgID   *uint   `json:"orgId"`
	Message *string `json:"message"`
	Slug    *string `json:"slug"`
	Version *int    `json:"version"`
	Status  *string `json:"status"`
	UID     *string `json:"uid"`
	URL     *string `json:"url"`
}

type PutContactPointResponse

type PutContactPointResponse struct{}

type PutNotificationPolicyResponse

type PutNotificationPolicyResponse struct{}

type PutNotificationTemplateResponse

type PutNotificationTemplateResponse struct{}

type UpdateAlertRuleGroupResponse

type UpdateAlertRuleGroupResponse struct{}

type UpdateAlertRuleResponse

type UpdateAlertRuleResponse struct{}

Jump to

Keyboard shortcuts

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