aapi

package module
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

Types

type Alert added in v0.0.5

type Alert struct {
	ID           string       `json:"id"`
	AlertGroupID string       `json:"alert_group_id"`
	CreatedAt    string       `json:"created_at"`
	Payload      AlertPayload `json:"payload"`
}

Alert represents an on-call alert.

type AlertEvalMatch added in v0.0.5

type AlertEvalMatch struct {
	Tags   []string `json:"tags"`
	Value  int64    `json:"value"`
	Metric string   `json:"metric"`
}

AlertEvalMatch represents an on-call alert payload evalMatch.

type AlertPayload added in v0.0.5

type AlertPayload struct {
	State       string           `json:"state"`
	Title       string           `json:"title"`
	RuleID      int              `json:"ruleId"`
	Message     string           `json:"message"`
	RuleURL     string           `json:"ruleUrl"`
	RuleName    string           `json:"ruleName"`
	EvalMatches []AlertEvalMatch `json:"evalMatches"`
}

AlertPayload represents an on-call alert payload.

type AlertService added in v0.0.5

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

AlertService handles requests to the on-call alerts endpoint.

// https://grafana.com/docs/oncall/latest/oncall-api-reference/alerts/

func NewAlertService added in v0.0.5

func NewAlertService(client *Client) *AlertService

NewAlertService creates an AlertService with the defined URL.

func (*AlertService) ListAlerts added in v0.0.5

func (service *AlertService) ListAlerts(opt *ListAlertOptions) (*PaginatedAlertsResponse, *http.Response, error)

ListAlerts fetches all on-call alerts for authorized organization.

https://grafana.com/docs/oncall/latest/oncall-api-reference/alerts/

type Client

type Client struct {
	UserAgent string
	// List of Services. Keep in sync with func newClient
	Alerts                *AlertService
	Integrations          *IntegrationService
	EscalationChains      *EscalationChainService
	Escalations           *EscalationService
	Users                 *UserService
	Schedules             *ScheduleService
	Routes                *RouteService
	SlackChannels         *SlackChannelService
	UserGroups            *UserGroupService
	OnCallShifts          *OnCallShiftService
	Teams                 *TeamService
	Webhooks              *WebhookService
	UserNotificationRules *UserNotificationRuleService
	// contains filtered or unexported fields
}

func New

func New(base_url, token string) (*Client, error)

func NewWithGrafanaURL added in v0.0.18

func NewWithGrafanaURL(base_url, token, grafana_url string) (*Client, error)

func (*Client) BaseURL

func (c *Client) BaseURL() *url.URL

func (*Client) Do

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

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.

func (*Client) GrafanaURL added in v0.0.18

func (c *Client) GrafanaURL() *url.URL

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string, opt interface{}) (*retryablehttp.Request, error)

type CreateEscalationChainOptions

type CreateEscalationChainOptions struct {
	Name   string `json:"name,omitempty"`
	TeamId string `json:"team_id"`
}

type CreateEscalationOptions

type CreateEscalationOptions struct {
	EscalationChainId           string    `json:"escalation_chain_id,omitempty"`
	Position                    *int      `json:"position,omitempty"`
	Type                        *string   `json:"type"`
	Duration                    int       `json:"duration,omitempty"`
	PersonsToNotify             *[]string `json:"persons_to_notify,omitempty"`
	PersonsToNotifyNextEachTime *[]string `json:"persons_to_notify_next_each_time,omitempty"`
	TeamToNotify                string    `json:"team_to_notify,omitempty"`
	NotifyOnCallFromSchedule    string    `json:"notify_on_call_from_schedule,omitempty"`
	ActionToTrigger             string    `json:"action_to_trigger,omitempty"`
	GroupToNotify               string    `json:"group_to_notify,omitempty"`
	ManualOrder                 bool      `json:"manual_order,omitempty"`
	Important                   *bool     `json:"important,omitempty"`
	NotifyIfTimeFrom            string    `json:"notify_if_time_from,omitempty"`
	NotifyIfTimeTo              string    `json:"notify_if_time_to,omitempty"`
	Severity                    string    `json:"severity,omitempty"`
}

type CreateIntegrationOptions

type CreateIntegrationOptions struct {
	TeamId       string        `json:"team_id"`
	Name         string        `json:"name,omitempty"`
	Type         string        `json:"type,omitempty"`
	Templates    *Templates    `json:"templates,omitempty"`
	DefaultRoute *DefaultRoute `json:"default_route,omitempty"`
}

type CreateOnCallShiftOptions

type CreateOnCallShiftOptions struct {
	TeamId                     string      `json:"team_id"`
	Type                       string      `json:"type"`
	Name                       string      `json:"name"`
	Level                      *int        `json:"level,omitempty"`
	Start                      string      `json:"start"`
	Duration                   int         `json:"duration"`
	Until                      *string     `json:"until"`
	Frequency                  *string     `json:"frequency"`
	Users                      *[]string   `json:"users"`
	Interval                   *int        `json:"interval"`
	WeekStart                  *string     `json:"week_start,omitempty"`
	ByDay                      *[]string   `json:"by_day"`
	ByMonth                    *[]int      `json:"by_month"`
	ByMonthday                 *[]int      `json:"by_monthday"`
	Source                     int         `json:"source"`
	RollingUsers               *[][]string `json:"rolling_users"`
	TimeZone                   *string     `json:"time_zone"`
	StartRotationFromUserIndex *int        `json:"start_rotation_from_user_index"`
}

type CreateRouteOptions

type CreateRouteOptions struct {
	IntegrationId     string         `json:"integration_id,omitempty"`
	EscalationChainId string         `json:"escalation_chain_id,omitempty"`
	Position          *int           `json:"position,omitempty"`
	RoutingRegex      string         `json:"routing_regex,omitempty"`
	RoutingType       string         `json:"routing_type,omitempty"`
	Slack             *SlackRoute    `json:"slack,omitempty"`
	Telegram          *TelegramRoute `json:"telegram,omitempty"`
	MSTeams           *MSTeamsRoute  `json:"msteams,omitempty"`
	ManualOrder       bool           `url:"manual_order,omitempty" json:"manual_order,omitempty"`
}

type CreateScheduleOptions

type CreateScheduleOptions struct {
	TeamId             string         `json:"team_id"`
	Name               string         `json:"name"`
	Type               string         `json:"type"`
	ICalUrlPrimary     *string        `json:"ical_url_primary"`
	ICalUrlOverrides   *string        `json:"ical_url_overrides"`
	EnableWebOverrides bool           `json:"enable_web_overrides"`
	TimeZone           string         `json:"time_zone,omitempty"`
	Slack              *SlackSchedule `json:"slack,omitempty"`
	Shifts             *[]string      `json:"shifts"`
}

type CreateUserNotificationRuleOptions added in v0.0.12

type CreateUserNotificationRuleOptions struct {
	UserId      string `json:"user_id,omitempty"`
	Position    *int   `json:"position,omitempty"`
	Duration    *int   `json:"duration,omitempty"`
	Important   bool   `json:"important,omitempty"`
	Type        string `json:"type,omitempty"`
	ManualOrder bool   `json:"manual_order,omitempty"`
}

type CreateWebhookOptions added in v0.0.11

type CreateWebhookOptions struct {
	Name                string    `json:"name"`
	Team                string    `json:"team"`
	Url                 string    `json:"url"`
	TriggerType         string    `json:"trigger_type"`
	HttpMethod          string    `json:"http_method"`
	Data                *string   `json:"data"`
	Username            *string   `json:"username"`
	Password            *string   `json:"password"`
	AuthorizationHeader *string   `json:"authorization_header"`
	TriggerTemplate     *string   `json:"trigger_template"`
	Headers             *string   `json:"headers"`
	ForwardAll          bool      `json:"forward_all"`
	IntegrationFilter   *[]string `json:"integration_filter"`
	IsWebhookEnabled    bool      `json:"is_webhook_enabled"`
}

type DefaultRoute

type DefaultRoute struct {
	ID                string         `json:"id"`
	EscalationChainId *string        `json:"escalation_chain_id"`
	SlackRoute        *SlackRoute    `json:"slack,omitempty"`
	TelegramRoute     *TelegramRoute `json:"telegram,omitempty"`
	MSTeamsRoute      *MSTeamsRoute  `json:"msteams,omitempty"`
}

type DeleteEscalationChainOptions

type DeleteEscalationChainOptions struct {
}

type DeleteEscalationOptions

type DeleteEscalationOptions struct {
}

type DeleteIntegrationOptions

type DeleteIntegrationOptions struct {
}

type DeleteOnCallShiftOptions

type DeleteOnCallShiftOptions struct {
}

type DeleteRouteOptions

type DeleteRouteOptions struct {
}

type DeleteScheduleOptions

type DeleteScheduleOptions struct {
}

type DeleteUserNotificationRuleOptions added in v0.0.12

type DeleteUserNotificationRuleOptions struct {
}

type DeleteWebhookOptions added in v0.0.11

type DeleteWebhookOptions struct {
}

type ErrorResponse

type ErrorResponse struct {
	Body     []byte
	Response *http.Response
	Message  string
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type Escalation

type Escalation struct {
	ID                       string    `json:"id"`
	EscalationChainId        string    `json:"escalation_chain_id"`
	Position                 int       `json:"position"`
	Type                     *string   `json:"type"`
	Duration                 *int      `json:"duration"`
	PersonsToNotify          *[]string `json:"persons_to_notify"`
	PersonsToNotifyEachTime  *[]string `json:"persons_to_notify_next_each_time"`
	TeamToNotify             *string   `json:"team_to_notify"`
	NotifyOnCallFromSchedule *string   `json:"notify_on_call_from_schedule"`
	ActionToTrigger          *string   `json:"action_to_trigger"`
	GroupToNotify            *string   `json:"group_to_notify"`
	Important                *bool     `json:"important"`
	NotifyIfTimeFrom         *string   `json:"notify_if_time_from"`
	NotifyIfTimeTo           *string   `json:"notify_if_time_to"`
	Severity                 *string   `json:"severity"`
}

type EscalationChain

type EscalationChain struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	TeamId string `json:"team_id"`
}

type EscalationChainService

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

EscalationChainService handles requests to escalation chain endpoint

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/escalation_chains/

func NewEscalationChainService

func NewEscalationChainService(client *Client) *EscalationChainService

NewEscalationChainService creates EscalationChainService with corresponding url part

func (*EscalationChainService) CreateEscalationChain

func (service *EscalationChainService) CreateEscalationChain(opt *CreateEscalationChainOptions) (*EscalationChain, *http.Response, error)

CreateEscalationChain creates escalation chain with name and team_id.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/escalation_chains/#create-an-escalation-chain

func (*EscalationChainService) DeleteEscalationChain

func (service *EscalationChainService) DeleteEscalationChain(id string, opt *DeleteEscalationChainOptions) (*http.Response, error)

DeleteEscalationChain deletes escalation chain.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/escalation_chains/#delete-an-escalation-chain

func (*EscalationChainService) GetEscalationChain

func (service *EscalationChainService) GetEscalationChain(id string, opt *GetEscalationChainOptions) (*EscalationChain, *http.Response, error)

GetEscalationChain fetches escalation chain by given id.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/escalation_chains/#get-an-escalation-chain

func (*EscalationChainService) ListEscalationChains

ListEscalationChains fetches all escalation chains for current organization.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/escalation_chains/#list-escalation-chains

func (*EscalationChainService) UpdateEscalationChain

func (service *EscalationChainService) UpdateEscalationChain(id string, opt *UpdateEscalationChainOptions) (*EscalationChain, *http.Response, error)

UpdateEscalationChain updates escalation chain with name.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/escalation_chains/#update-an-escalation-chain

type EscalationService

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

EscalationService handles requests to escalation endpoint

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/escalation_policies/

func NewEscalationService

func NewEscalationService(client *Client) *EscalationService

NewEscalationService creates EscalationService with defined url

func (*EscalationService) ListEscalations

ListEscalations gets all escalations for authorized organization

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/escalation_policies/#list-escalation-policies

func (*EscalationService) UpdateEscalation

func (service *EscalationService) UpdateEscalation(id string, opt *UpdateEscalationOptions) (*Escalation, *http.Response, error)

UpdateEscalation updates an escalation with new templates and/or name. At least one field in template is required

type GetEscalationChainOptions

type GetEscalationChainOptions struct {
}

type GetEscalationOptions

type GetEscalationOptions struct {
}

type GetIntegrationOptions

type GetIntegrationOptions struct {
}

type GetOnCallShiftOptions

type GetOnCallShiftOptions struct {
}

type GetRouteOptions

type GetRouteOptions struct {
}

type GetScheduleOptions

type GetScheduleOptions struct {
}

type GetTeamOptions

type GetTeamOptions struct {
}

type GetUserNotificationRuleOptions added in v0.0.12

type GetUserNotificationRuleOptions struct {
}

type GetUserOptions

type GetUserOptions struct {
}

type GetWebhookOptions added in v0.0.11

type GetWebhookOptions struct {
}

type ImageURLTemplate added in v0.0.7

type ImageURLTemplate struct {
	ImageURL *string `json:"image_url"`
}

type Integration

type Integration struct {
	ID             string        `json:"id"`
	TeamId         string        `json:"team_id"`
	Name           string        `json:"name"`
	Link           string        `json:"link"`
	IncidentsCount int           `json:"incidents_count"`
	Type           string        `json:"type"`
	DefaultRoute   *DefaultRoute `json:"default_route"`
	Templates      *Templates    `json:"templates"`
}

type IntegrationService

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

IntegrationService handles requests to integration endpoint

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/integrations/

func NewIntegrationService

func NewIntegrationService(client *Client) *IntegrationService

NewIntegrationService creates IntegrationService with corresponding url part

func (*IntegrationService) CreateIntegration

func (service *IntegrationService) CreateIntegration(opt *CreateIntegrationOptions) (*Integration, *http.Response, error)

CreateIntegration creates integration with type, team_id and optional given name.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/integrations/#get-integration

func (*IntegrationService) DeleteIntegration

func (service *IntegrationService) DeleteIntegration(id string, opt *DeleteIntegrationOptions) (*http.Response, error)

DeleteIntegration deletes integration.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/integrations/#delete-integration

func (*IntegrationService) GetIntegration

func (service *IntegrationService) GetIntegration(id string, opt *GetIntegrationOptions) (*Integration, *http.Response, error)

GetIntegration fetches integration by given id.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/integrations/#get-integration

func (*IntegrationService) ListIntegrations

ListIntegrations fetches all integrations for current organization.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/integrations/#get-integration

func (*IntegrationService) UpdateIntegration

func (service *IntegrationService) UpdateIntegration(id string, opt *UpdateIntegrationOptions) (*Integration, *http.Response, error)

UpdateIntegration updates integration with new templates, name and default route. To update template it is enough to provide at least one field.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/integrations/#update-integration

type ListAlertOptions added in v0.0.5

type ListAlertOptions struct {
	ListOptions
	AlertGroupID string `url:"alert_group_id,omitempty" json:"alert_group_id,omitempty"`
	Name         string `url:"search,omitempty" json:"search,omitempty"`
}

ListAlertOptions represent filter options supported by the on-call alerts API.

type ListEscalationChainOptions

type ListEscalationChainOptions struct {
	ListOptions
	Name string `url:"name,omitempty" json:"name,omitempty"`
}

type ListEscalationOptions

type ListEscalationOptions struct {
	ListOptions
}

Empty struct is here in case we want to add request params to ListEscalations.

type ListIntegrationOptions

type ListIntegrationOptions struct {
	ListOptions
}

type ListOnCallShiftOptions

type ListOnCallShiftOptions struct {
	ListOptions
	ScheduleId string `url:"schedule_id,omitempty" json:"schedule_id,omitempty"`
	Name       string `url:"name,omitempty" json:"name,omitempty"`
}

type ListOptions

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

type ListRouteOptions

type ListRouteOptions struct {
	ListOptions
	IntegrationId string `url:"integration_id,omitempty" json:"integration_id,omitempty"`
	RoutingRegex  string `url:"routing_regex,omitempty" json:"routing_regex,omitempty"`
	RoutingType   string `url:"routing_type,omitempty" json:"routing_type,omitempty"`
}

type ListScheduleOptions

type ListScheduleOptions struct {
	ListOptions
	Name string `url:"name,omitempty" json:"name,omitempty"`
}

type ListSlackChannelOptions

type ListSlackChannelOptions struct {
	ListOptions
	ChannelName string `url:"channel_name,omitempty" json:"channel_name,omitempty"`
}

type ListTeamOptions

type ListTeamOptions struct {
	ListOptions
	Name string `url:"name,omitempty" json:"name,omitempty"`
}

type ListUserGroupOptions

type ListUserGroupOptions struct {
	ListOptions
	SlackHandle string `url:"slack_handle,omitempty" json:"slack_handle,omitempty"`
}

type ListUserNotificationRuleOptions added in v0.0.12

type ListUserNotificationRuleOptions struct {
	ListOptions
	UserId    string `url:"user_id,omitempty" json:"user_id,omitempty"`
	Important string `url:"important,omitempty" json:"important,omitempty"`
}

type ListUserOptions

type ListUserOptions struct {
	ListOptions
	Username string `url:"username,omitempty" json:"username,omitempty"`
}

type ListWebhookOptions added in v0.0.11

type ListWebhookOptions struct {
	ListOptions
	Name string `url:"name,omitempty" json:"name,omitempty"`
}

type MSTeamsRoute added in v0.0.5

type MSTeamsRoute struct {
	Id      *string `json:"id"`
	Enabled bool    `json:"enabled"`
}

type MessageTemplate added in v0.0.7

type MessageTemplate struct {
	Message *string `json:"message"`
}

type OnCallShift

type OnCallShift struct {
	ID                         string      `json:"id"`
	TeamId                     string      `json:"team_id"`
	Type                       string      `json:"type"`
	Name                       string      `json:"name"`
	Level                      int         `json:"level"`
	Start                      string      `json:"start"`
	Duration                   int         `json:"duration"`
	Until                      *string     `json:"until"`
	Frequency                  *string     `json:"frequency"`
	Users                      *[]string   `json:"users"`
	Interval                   *int        `json:"interval"`
	WeekStart                  *string     `json:"week_start"`
	ByDay                      *[]string   `json:"by_day"`
	ByMonth                    *[]int      `json:"by_month"`
	ByMonthday                 *[]int      `json:"by_monthday"`
	RollingUsers               *[][]string `json:"rolling_users"`
	TimeZone                   *string     `json:"time_zone"`
	StartRotationFromUserIndex *int        `json:"start_rotation_from_user_index"`
}

type OnCallShiftService

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

OnCallShiftService handles requests to on-call shift endpoint

// https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/on_call_shifts/

func NewOnCallShiftService

func NewOnCallShiftService(client *Client) *OnCallShiftService

NewOnCallShiftService creates OnCallShiftService with defined url

func (*OnCallShiftService) DeleteOnCallShift

func (service *OnCallShiftService) DeleteOnCallShift(id string, opt *DeleteOnCallShiftOptions) (*http.Response, error)

DeleteOnCallShift deletes on-call shift

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/on_call_shifts/#delete-oncall-shift

func (*OnCallShiftService) GetOnCallShift

func (service *OnCallShiftService) GetOnCallShift(id string, opt *GetOnCallShiftOptions) (*OnCallShift, *http.Response, error)

GetOnCallShift fetches shift by given id

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/on_call_shifts/#get-oncall-shifts

func (*OnCallShiftService) ListOnCallShifts

ListOnCallShifts fetches all on-call shifts for authorized organization

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/on_call_shifts/#list-oncall-shifts

type PaginatedAlertsResponse added in v0.0.5

type PaginatedAlertsResponse struct {
	PaginatedResponse
	Alerts []*Alert `json:"results"`
}

PaginatedAlertsResponse represents a paginated response from the on-call alerts API.

type PaginatedEscalationChainsResponse

type PaginatedEscalationChainsResponse struct {
	PaginatedResponse
	EscalationChains []*EscalationChain `json:"results"`
}

type PaginatedEscalationsResponse

type PaginatedEscalationsResponse struct {
	PaginatedResponse
	Escalations []*Escalation `json:"results"`
}

type PaginatedIntegrationsResponse

type PaginatedIntegrationsResponse struct {
	PaginatedResponse
	Integrations []*Integration `json:"results"`
}

type PaginatedOnCallShiftsResponse

type PaginatedOnCallShiftsResponse struct {
	PaginatedResponse
	OnCallShifts []*OnCallShift `json:"results"`
}

type PaginatedResponse

type PaginatedResponse struct {
	Count    int     `json:"count"`
	Next     *string `json:"next"`
	Previous *string `json:"previous"`
}

type PaginatedRoutesResponse

type PaginatedRoutesResponse struct {
	PaginatedResponse
	Routes []*Route `json:"results"`
}

type PaginatedSchedulesResponse

type PaginatedSchedulesResponse struct {
	PaginatedResponse
	Schedules []*Schedule `json:"results"`
}

type PaginatedSlackChannelsResponse

type PaginatedSlackChannelsResponse struct {
	PaginatedResponse
	SlackChannels []*SlackChannel `json:"results"`
}

type PaginatedTeamsResponse

type PaginatedTeamsResponse struct {
	PaginatedResponse
	Teams []*Team `json:"results"`
}

type PaginatedUserGroupsResponse

type PaginatedUserGroupsResponse struct {
	PaginatedResponse
	UserGroups []*UserGroup `json:"results"`
}

type PaginatedUserNotificationRulesResponse added in v0.0.12

type PaginatedUserNotificationRulesResponse struct {
	PaginatedResponse
	UserNotificationRules []*UserNotificationRule `json:"results"`
}

type PaginatedUsersResponse

type PaginatedUsersResponse struct {
	PaginatedResponse
	Users []*User `json:"results"`
}

type PaginatedWebhooksResponse added in v0.0.11

type PaginatedWebhooksResponse struct {
	PaginatedResponse
	Webhooks []*Webhook `json:"results"`
}

type Route

type Route struct {
	ID                string         `json:"id"`
	IntegrationId     string         `json:"integration_id"`
	EscalationChainId string         `json:"escalation_chain_id"`
	Position          int            `json:"position"`
	RoutingRegex      string         `json:"routing_regex"`
	RoutingType       string         `json:"routing_type"`
	IsTheLastRoute    bool           `json:"is_the_last_route"`
	SlackRoute        *SlackRoute    `json:"slack"`
	TelegramRoute     *TelegramRoute `json:"telegram"`
	MSTeamsRoute      *MSTeamsRoute  `json:"msteams"`
}

type RouteService

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

RouteService handles requests to route endpoint

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/routes/

func NewRouteService

func NewRouteService(client *Client) *RouteService

NewRouteService creates RouteService with defined url

func (*RouteService) CreateRoute

func (service *RouteService) CreateRoute(opt *CreateRouteOptions) (*Route, *http.Response, error)

CreateRoute creates route with given name and type

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/routes/#create-a-route

func (*RouteService) GetRoute

func (service *RouteService) GetRoute(id string, opt *GetRouteOptions) (*Route, *http.Response, error)

GetRoute fetches route by given id

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/routes/#get-a-route

func (*RouteService) ListRoutes

func (service *RouteService) ListRoutes(opt *ListRouteOptions) (*PaginatedRoutesResponse, *http.Response, error)

ListRoutes fetches all routes for authorized organization

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/routes/#list-routes

func (*RouteService) UpdateRoute

func (service *RouteService) UpdateRoute(id string, opt *UpdateRouteOptions) (*Route, *http.Response, error)

UpdateRoute updates route with new templates and/or name. At least one field in template is required

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/routes/#update-route

type Schedule

type Schedule struct {
	ID                 string         `json:"id"`
	TeamId             string         `json:"team_id"`
	Type               string         `json:"type"`
	OnCallNow          []string       `json:"on_call_now"`
	Name               string         `json:"name"`
	ICalUrlPrimary     *string        `json:"ical_url_primary"`
	ICalUrlOverrides   *string        `json:"ical_url_overrides"`
	EnableWebOverrides bool           `json:"enable_web_overrides"`
	TimeZone           string         `json:"time_zone"`
	Slack              *SlackSchedule `json:"slack"`
	Shifts             *[]string      `json:"shifts"`
}

type ScheduleService

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

ScheduleService handles requests to schedule endpoint

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/schedules/

func NewScheduleService

func NewScheduleService(client *Client) *ScheduleService

NewScheduleService creates ScheduleService with defined url

func (*ScheduleService) CreateSchedule

func (service *ScheduleService) CreateSchedule(opt *CreateScheduleOptions) (*Schedule, *http.Response, error)

CreateSchedule creates a schedule with given name, type and other parameters depending on type/

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/schedules/#create-a-schedule

func (*ScheduleService) DeleteSchedule

func (service *ScheduleService) DeleteSchedule(id string, opt *DeleteScheduleOptions) (*http.Response, error)

DeleteSchedule deletes a schedule.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/schedules/#delete-a-schedule

func (*ScheduleService) GetSchedule

func (service *ScheduleService) GetSchedule(id string, opt *GetScheduleOptions) (*Schedule, *http.Response, error)

GetSchedule fetches a schedule by given id

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/schedules/#get-a-schedule

func (*ScheduleService) ListSchedules

ListSchedules fetches all schedules for authorized organization

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/schedules/#list-schedules

type SlackChannel

type SlackChannel struct {
	Name    string `json:"name"`
	SlackId string `json:"slack_id"`
}

type SlackChannelService

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

SlackChannelService handles requests to slack channel endpoint

// https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/slack_channels/

func NewSlackChannelService

func NewSlackChannelService(client *Client) *SlackChannelService

NewSlackChannelsService creates SlackChannelService with defined url

func (*SlackChannelService) ListSlackChannels

ListSlackChannels gets all slackChannels for authorized organization

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/slack_channels/#list-slack-channels

type SlackRoute

type SlackRoute struct {
	ChannelId *string `json:"channel_id"`
	Enabled   bool    `json:"enabled"`
}

type SlackSchedule

type SlackSchedule struct {
	ChannelId   *string `json:"channel_id"`
	UserGroupId *string `json:"user_group_id"`
}

type SlackUserGroup

type SlackUserGroup struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Handle string `json:"handle"`
}

type Team

type Team struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Email     string `json:"email"`
	AvatarUrl string `json:"avatar_url"`
}

type TeamService

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

TeamService handles requests to team endpoint

func NewTeamService

func NewTeamService(client *Client) *TeamService

NewTeamService creates TeamService with defined url

func (*TeamService) GetTeam

func (service *TeamService) GetTeam(id string, opt *GetTeamOptions) (*Team, *http.Response, error)

GetTeam fetches team by given id

func (*TeamService) ListTeams

func (service *TeamService) ListTeams(opt *ListTeamOptions) (*PaginatedTeamsResponse, *http.Response, error)

ListTeams fetchs all Teams for authorized user

type TelegramRoute added in v0.0.5

type TelegramRoute struct {
	Id      *string `json:"id"`
	Enabled bool    `json:"enabled"`
}

type Templates

type Templates struct {
	GroupingKey       *string                    `json:"grouping_key"`
	ResolveSignal     *string                    `json:"resolve_signal"`
	AcknowledgeSignal *string                    `json:"acknowledge_signal"`
	SourceLink        *string                    `json:"source_link"`
	Slack             *TitleMessageImageTemplate `json:"slack"`
	Web               *TitleMessageImageTemplate `json:"web"`
	MSTeams           *TitleMessageImageTemplate `json:"msteams"`
	Telegram          *TitleMessageImageTemplate `json:"telegram"`
	PhoneCall         *TitleTemplate             `json:"phone_call"`
	SMS               *TitleTemplate             `json:"sms"`
	Email             *TitleMessageTemplate      `json:"email"`
	MobileApp         *TitleMessageTemplate      `json:"mobile_app"`
}

type TitleMessageImageTemplate added in v0.0.7

type TitleMessageImageTemplate struct {
	Title    *string `json:"title"`
	Message  *string `json:"message"`
	ImageURL *string `json:"image_url"`
}

type TitleMessageTemplate added in v0.0.7

type TitleMessageTemplate struct {
	Title   *string `json:"title"`
	Message *string `json:"message"`
}

type TitleTemplate added in v0.0.7

type TitleTemplate struct {
	Title *string `json:"title"`
}

type UpdateEscalationChainOptions

type UpdateEscalationChainOptions struct {
	Name   string `json:"name,omitempty"`
	TeamId string `json:"team_id"`
}

type UpdateEscalationOptions

type UpdateEscalationOptions struct {
	Position                 *int      `json:"position,omitempty"`
	Type                     *string   `json:"type"`
	Duration                 int       `json:"duration,omitempty"`
	PersonsToNotify          *[]string `json:"persons_to_notify,omitempty"`
	PersonsToNotifyEachTime  *[]string `json:"persons_to_notify_next_each_time,omitempty"`
	TeamToNotify             string    `json:"team_to_notify,omitempty"`
	NotifyOnCallFromSchedule string    `json:"notify_on_call_from_schedule,omitempty"`
	ActionToTrigger          string    `json:"action_to_trigger,omitempty"`
	GroupToNotify            string    `json:"group_to_notify,omitempty"`
	ManualOrder              bool      `json:"manual_order,omitempty"`
	Important                *bool     `json:"important,omitempty"`
	NotifyIfTimeFrom         string    `json:"notify_if_time_from,omitempty"`
	NotifyIfTimeTo           string    `json:"notify_if_time_to,omitempty"`
	Severity                 string    `json:"severity,omitempty"`
}

type UpdateIntegrationOptions

type UpdateIntegrationOptions struct {
	Name         string        `json:"name,omitempty"`
	TeamId       string        `json:"team_id"`
	Templates    *Templates    `json:"templates,omitempty"`
	DefaultRoute *DefaultRoute `json:"default_route,omitempty"`
}

type UpdateOnCallShiftOptions

type UpdateOnCallShiftOptions struct {
	Type                       string      `json:"type"`
	Name                       string      `json:"name"`
	TeamId                     string      `json:"team_id"`
	Level                      *int        `json:"level,omitempty"`
	Start                      string      `json:"start"`
	Duration                   int         `json:"duration"`
	Until                      *string     `json:"until"`
	Frequency                  *string     `json:"frequency"`
	Users                      *[]string   `json:"users"`
	Interval                   *int        `json:"interval"`
	WeekStart                  *string     `json:"week_start,omitempty"`
	ByDay                      *[]string   `json:"by_day"`
	ByMonth                    *[]int      `json:"by_month"`
	ByMonthday                 *[]int      `json:"by_monthday"`
	Source                     int         `json:"source"`
	RollingUsers               *[][]string `json:"rolling_users"`
	TimeZone                   *string     `json:"time_zone"`
	StartRotationFromUserIndex *int        `json:"start_rotation_from_user_index"`
}

type UpdateRouteOptions

type UpdateRouteOptions struct {
	EscalationChainId string         `json:"escalation_chain_id,omitempty"`
	Position          *int           `json:"position,omitempty"`
	Slack             *SlackRoute    `json:"slack,omitempty"`
	Telegram          *TelegramRoute `json:"telegram,omitempty"`
	MSTeams           *MSTeamsRoute  `json:"msteams,omitempty"`
	RoutingRegex      string         `json:"routing_regex,omitempty"`
	RoutingType       string         `json:"routing_type,omitempty"`
	ManualOrder       bool           `url:"manual_order,omitempty" json:"manual_order,omitempty"`
}

type UpdateScheduleOptions

type UpdateScheduleOptions struct {
	Name               string         `json:"name,omitempty"`
	TeamId             string         `json:"team_id"`
	ICalUrlPrimary     *string        `json:"ical_url_primary"`
	ICalUrlOverrides   *string        `json:"ical_url_overrides"`
	TimeZone           string         `json:"time_zone,omitempty"`
	EnableWebOverrides bool           `json:"enable_web_overrides"`
	Slack              *SlackSchedule `json:"slack,omitempty"`
	Shifts             *[]string      `json:"shifts"`
}

type UpdateUserNotificationRuleOptions added in v0.0.12

type UpdateUserNotificationRuleOptions struct {
	Position    *int   `json:"position,omitempty"`
	Duration    *int   `json:"duration,omitempty"`
	Type        string `json:"type,omitempty"`
	ManualOrder bool   `json:"manual_order,omitempty"`
}

type UpdateWebhookOptions added in v0.0.11

type UpdateWebhookOptions struct {
	Name                string    `json:"name"`
	Team                string    `json:"team"`
	Url                 string    `json:"url"`
	TriggerType         string    `json:"trigger_type"`
	HttpMethod          string    `json:"http_method"`
	Data                *string   `json:"data"`
	Username            *string   `json:"username"`
	Password            *string   `json:"password"`
	AuthorizationHeader *string   `json:"authorization_header"`
	TriggerTemplate     *string   `json:"trigger_template"`
	Headers             *string   `json:"headers"`
	ForwardAll          bool      `json:"forward_all"`
	IntegrationFilter   *[]string `json:"integration_filter"`
	IsWebhookEnabled    bool      `json:"is_webhook_enabled"`
}

type User

type User struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	Role     string `json:"role"`
	Email    string `json:"email"`
}

type UserGroup

type UserGroup struct {
	ID             string          `json:"id"`
	Type           string          `json:"type"`
	SlackUserGroup *SlackUserGroup `json:"slack"`
}

type UserGroupService

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

UserGroupService handles requests for user group endpoint

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/user_groups/

func NewUserGroupService

func NewUserGroupService(client *Client) *UserGroupService

NewUserGroupService creates UserGroupService with defined url

func (*UserGroupService) ListUserGroups

ListUserGroups gets all UserGroups for authorized organization

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/user_groups/#list-user-groups

type UserNotificationRule added in v0.0.12

type UserNotificationRule struct {
	ID        string `json:"id"`
	UserId    string `json:"user_id"`
	Position  int    `json:"position"`
	Duration  int    `json:"duration"`
	Important bool   `json:"important"`
	Type      string `json:"type"`
}

type UserNotificationRuleService added in v0.0.12

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

UserNotificationRuleService handles requests to user notification rule endpoints

https://grafana.com/docs/oncall/latest/oncall-api-reference/personal_notification_rules/

func NewUserNotificationRuleService added in v0.0.12

func NewUserNotificationRuleService(client *Client) *UserNotificationRuleService

NewUserNotificationRuleService creates UserNotificationRuleService with defined url

func (*UserNotificationRuleService) CreateUserNotificationRule added in v0.0.12

CreateUserNotificationRule creates a user notification rule for the given user, type, and position

https://grafana.com/docs/oncall/latest/oncall-api-reference/personal_notification_rules/#post-a-personal-notification-rule

func (*UserNotificationRuleService) DeleteUserNotificationRule added in v0.0.12

func (service *UserNotificationRuleService) DeleteUserNotificationRule(id string, opt *DeleteUserNotificationRuleOptions) (*http.Response, error)

DeleteUserNotificationRule deletes user notification rule

https://grafana.com/docs/oncall/latest/oncall-api-reference/personal_notification_rules/#delete-a-personal-notification-rule

func (*UserNotificationRuleService) GetUserNotificationRule added in v0.0.12

GetUserNotificationRule fetches a user notification rule by given id

https://grafana.com/docs/oncall/latest/oncall-api-reference/personal_notification_rules/#get-personal-notification-rule

func (*UserNotificationRuleService) ListUserNotificationRules added in v0.0.12

ListUserNotificationRules fetches all user notification rules for authorized organization

https://grafana.com/docs/oncall/latest/oncall-api-reference/personal_notification_rules/#list-personal-notification-rules

func (*UserNotificationRuleService) UpdateUserNotificationRule added in v0.0.12

UpdateUserNotificationRule updates user notification rule with new position, duration, and type

NOTE: this endpoint is not currently publicly documented, but it does exist

type UserService

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

UserService handles requests to user endpoint

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/users/

func NewUserService

func NewUserService(client *Client) *UserService

NewUserService creates UserService with defined url

func (*UserService) GetUser

func (service *UserService) GetUser(id string, opt *GetUserOptions) (*User, *http.Response, error)

GetUser fetches a user by given id.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/users/#get-a-user

func (*UserService) ListUsers

func (service *UserService) ListUsers(opt *ListUserOptions) (*PaginatedUsersResponse, *http.Response, error)

ListUsers fetches all users for authorized organization.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/users/

type Webhook added in v0.0.11

type Webhook struct {
	ID                  string    `json:"id"`
	Name                string    `json:"name"`
	Team                string    `json:"team"`
	Url                 string    `json:"url"`
	TriggerType         string    `json:"trigger_type"`
	HttpMethod          string    `json:"http_method"`
	Data                *string   `json:"data"`
	Username            *string   `json:"username"`
	Password            *string   `json:"password"`
	AuthorizationHeader *string   `json:"authorization_header"`
	TriggerTemplate     *string   `json:"trigger_template"`
	Headers             *string   `json:"headers"`
	ForwardAll          bool      `json:"forward_all"`
	IntegrationFilter   *[]string `json:"integration_filter"`
	IsWebhookEnabled    bool      `json:"is_webhook_enabled"`
}

type WebhookService added in v0.0.11

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

WebhookService handles requests to outgoing webhook endpoint

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/outgoing_webhooks/

func NewWebhookService added in v0.0.11

func NewWebhookService(client *Client) *WebhookService

NewWebhookService creates WebhookService with defined url

func (*WebhookService) CreateWebhook added in v0.0.11

func (service *WebhookService) CreateWebhook(opt *CreateWebhookOptions) (*Webhook, *http.Response, error)

CreateWebhook creates webhook

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/outgoing_webhooks/

func (*WebhookService) DeleteWebhook added in v0.0.11

func (service *WebhookService) DeleteWebhook(id string, opt *DeleteWebhookOptions) (*http.Response, error)

DeleteWebhook deletes webhook.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/outgoing_webhooks/

func (*WebhookService) GetWebhook added in v0.0.11

func (service *WebhookService) GetWebhook(id string, opt *GetWebhookOptions) (*Webhook, *http.Response, error)

GetWebhook fetches webhook by given id.

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/outgoing_webhooks/

func (*WebhookService) ListWebhooks added in v0.0.11

ListWebhooks fetches all Webhooks for authorized organization

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/outgoing_webhooks/#list-actions

func (*WebhookService) UpdateWebhook added in v0.0.11

func (service *WebhookService) UpdateWebhook(id string, opt *UpdateWebhookOptions) (*Webhook, *http.Response, error)

UpdateWebhook updates webhook

https://grafana.com/docs/grafana-cloud/oncall/oncall-api-reference/outgoing_webhooks/

Jump to

Keyboard shortcuts

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