goalert

package
v0.0.0-...-dccb77e Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	CreateService(ctx context.Context, data *Data) (string, error)
	CreateIntegrationKey(ctx context.Context, data *Data) (string, error)
	CreateHeartbeatMonitor(ctx context.Context, data *Data) (string, string, error)
	DeleteService(ctx context.Context, data *Data) error
	NewRequest(ctx context.Context, method string, body interface{}) ([]byte, error)
	IsHeartbeatMonitorInactive(ctx context.Context, data *Data) (bool, error)
}

Client is a wrapper interface for the GraphqlClient to allow for easier testing

func NewClient

func NewClient(sessionCookie *http.Cookie) Client

Wrapper to create new client for GraphQL api calls

type Data

type Data struct {
	Name               string `json:"name"`
	Id                 string `json:"id,omitempty"`
	Description        string `json:"description,omitempty"`
	Favorite           bool   `json:"favorite,omitempty"`
	EscalationPolicyID string `json:"escalationPolicyID,omitempty"`
	Type               string `json:"type,omitempty"`
	Timeout            int    `json:"timeoutMinutes,omitempty"`
	DeleteAll          bool   `json:"deleteAll,omitempty"`
}

Data describes the data that is needed for Goalert GraphQL api calls

type GraphqlClient

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

Wrapper for HTTP client

func (*GraphqlClient) CreateHeartbeatMonitor

func (c *GraphqlClient) CreateHeartbeatMonitor(ctx context.Context, data *Data) (string, string, error)

CreateHeartbeatMonitor calls GoAlert's GraphQL api to create a new heartbeat monitor for a GoAlert Service

func (*GraphqlClient) CreateIntegrationKey

func (c *GraphqlClient) CreateIntegrationKey(ctx context.Context, data *Data) (string, error)

CreateIntegrationKey calls GoAlert's GraphQL api to create a new integration key

func (*GraphqlClient) CreateService

func (c *GraphqlClient) CreateService(ctx context.Context, data *Data) (string, error)

CreateService calls GoAlert's GraphQL api to create a new service within GoAlert

func (*GraphqlClient) DeleteService

func (c *GraphqlClient) DeleteService(ctx context.Context, data *Data) error

DeleteService calls GoAlert's GraphQL API to delete a GoAlert service

func (*GraphqlClient) IsHeartbeatMonitorInactive

func (c *GraphqlClient) IsHeartbeatMonitorInactive(ctx context.Context, data *Data) (bool, error)

func (*GraphqlClient) NewRequest

func (c *GraphqlClient) NewRequest(ctx context.Context, method string, body interface{}) ([]byte, error)

NewRequest is a wrapper func to help send the http request

type Q

type Q struct {
	Query string
}

Q describes GraphQL query payload

type RespDelete

type RespDelete struct {
	Data struct {
		DeleteAll bool `json:"deleteAll"`
	} `json:"data"`
}

RespDelete contains boolean returned from deleteAll

type RespHeartBeatData

type RespHeartBeatData struct {
	Data struct {
		CreateHeartBeatKey struct {
			Key string `json:"href"`
			Id  string `json:"id"`
		} `json:"createHeartbeatMonitor"`
	} `json:"data"`
}

RespHeartBeatData describes a heartbeat monitor key from createHeartbeatMonitor

type RespHeartbeatState

type RespHeartbeatState struct {
	Data struct {
		Heatbeatmonitor struct {
			LastState string `json:"lastState"`
		} `json:"heartbeatMonitor"`
	} `json:"data"`
}

type RespIntKeyData

type RespIntKeyData struct {
	Data struct {
		CreateIntKey struct {
			Key string `json:"href"`
		} `json:"createIntegrationKey"`
	} `json:"data"`
}

RespIntKeyData describes int key returned from createIntegrationKey

type RespSvcData

type RespSvcData struct {
	Data struct {
		CreateService struct {
			ID string `json:"id"`
		} `json:"createService"`
	} `json:"data"`
}

RespSvcData describes Svc ID returned from createService

Jump to

Keyboard shortcuts

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