aapi

package module
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 16 Imported by: 1

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
	CustomActions    *CustomActionService
	OnCallShifts     *OnCallShiftService
	Teams            *TeamService
	Webhooks         *WebhookService
	// contains filtered or unexported fields
}

func New

func New(base_url, token 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) NewRequest

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

type CreateCustomActionOptions added in v0.0.2

type CreateCustomActionOptions struct {
	Name                string  `json:"name,omitempty"`
	TeamId              string  `json:"team_id"`
	Url                 string  `json:"url,omitempty"`
	Data                *string `json:"data"`
	User                *string `json:"user"`
	Password            *string `json:"password"`
	AuthorizationHeader *string `json:"authorization_header"`
	ForwardWholePayload bool    `json:"forward_whole_payload"`
}

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"`
	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"`
}

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"`
	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 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 CustomAction

type CustomAction struct {
	ID                  string  `json:"id"`
	Name                string  `json:"name"`
	TeamId              string  `json:"team_id"`
	Url                 string  `json:"url"`
	Data                *string `json:"data"`
	User                *string `json:"user"`
	Password            *string `json:"password"`
	AuthorizationHeader *string `json:"authorization_header"`
	ForwardWholePayload bool    `json:"forward_whole_payload"`
}

type CustomActionService

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

CustomActionService handles requests to outgoing webhook endpoint

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

func NewCustomActionService

func NewCustomActionService(client *Client) *CustomActionService

NewCustomActionService creates CustomActionService with defined url

func (*CustomActionService) CreateCustomAction added in v0.0.2

func (service *CustomActionService) CreateCustomAction(opt *CreateCustomActionOptions) (*CustomAction, *http.Response, error)

CreateCustomAction creates custom action

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

func (*CustomActionService) DeleteCustomAction added in v0.0.2

func (service *CustomActionService) DeleteCustomAction(id string, opt *DeleteCustomActionOptions) (*http.Response, error)

DeleteCustomAction deletes custom action.

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

func (*CustomActionService) GetCustomAction added in v0.0.2

func (service *CustomActionService) GetCustomAction(id string, opt *GetCustomActionOptions) (*CustomAction, *http.Response, error)

GetCustomAction fetches custom action by given id.

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

func (*CustomActionService) ListCustomActions

ListCustomActions fetches all customActions for authorized organization

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

func (*CustomActionService) UpdateCustomAction added in v0.0.2

func (service *CustomActionService) UpdateCustomAction(id string, opt *UpdateCustomActionOptions) (*CustomAction, *http.Response, error)

UpdateCustomAction updates custom action

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

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 DeleteCustomActionOptions added in v0.0.2

type DeleteCustomActionOptions struct {
}

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 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"`
	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"`
}

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 GetCustomActionOptions added in v0.0.2

type GetCustomActionOptions struct {
}

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 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 ListCustomActionOptions

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

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 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"`
	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 PaginatedCustomActionsResponse

type PaginatedCustomActionsResponse struct {
	PaginatedResponse
	CustomActions []*CustomAction `json:"results"`
}

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 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"`
}

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 UpdateCustomActionOptions added in v0.0.2

type UpdateCustomActionOptions struct {
	Name                string  `json:"name,omitempty"`
	Url                 string  `json:"url"`
	Data                *string `json:"data"`
	User                *string `json:"user"`
	Password            *string `json:"password"`
	AuthorizationHeader *string `json:"authorization_header"`
	ForwardWholePayload bool    `json:"forward_whole_payload"`
	TeamId              string  `json:"team_id"`
}

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"`
	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"`
}

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"`
	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 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 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