endpoints

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EndpointTypeSlack     endpointType = "slack"
	EndpointTypeCustom    endpointType = "custom"
	EndpointTypePagerDuty endpointType = "pagerduty"
	EndpointTypeBigPanda  endpointType = "bigpanda"
	EndpointTypeDataDog   endpointType = "datadog"
	EndpointTypeVictorOps endpointType = "victorops"
)

Variables

This section is empty.

Functions

func ValidateEndpointRequest

func ValidateEndpointRequest(endpoint Endpoint) bool

ValidateEndpointRequest validates an endpoint request for correctness given its type, returns FALSE if validation failed, true otherwise

Types

type Endpoint

type Endpoint struct {
	Id            int64             // all
	EndpointType  endpointType      // all
	Title         string            // all
	Description   string            // all
	Url           string            // custom & slack
	Method        string            // custom
	Headers       map[string]string // custom
	BodyTemplate  interface{}       // custom
	Message       string            // n.b. this is a hack to determine if there was an error (despite a 200 being returned)
	ServiceKey    string            // pager-duty
	ApiToken      string            // big-panda
	AppKey        string            // big-panda
	ApiKey        string            // data-dog
	RoutingKey    string            // victorops
	MessageType   string            // victorops
	ServiceApiKey string            // victorops
}

type EndpointsClient

type EndpointsClient struct {
	*client.Client
}

func New

func New(apiToken, baseUrl string) (*EndpointsClient, error)

func (*EndpointsClient) CreateEndpoint

func (c *EndpointsClient) CreateEndpoint(endpoint Endpoint) (*Endpoint, error)

Creates an endpoint, given the endpoint definition and the service to create the endpoint against Returns the endpoint object if successful (hopefully with an ID) and a non-nil error if not

func (*EndpointsClient) DeleteEndpoint

func (c *EndpointsClient) DeleteEndpoint(endpointId int64) error

Deletes an endpoint with the given id, returns a non nil error otherwise

func (*EndpointsClient) GetEndpoint

func (c *EndpointsClient) GetEndpoint(endpointId int64) (*Endpoint, error)

Returns an endpoint, given it's identity. Returns nul (and an error) if an endpoint with the specified id can't be found

func (*EndpointsClient) GetEndpointByName

func (c *EndpointsClient) GetEndpointByName(endpointName string) (*Endpoint, error)

Returns an endpoint, given it's name. Returns nil (and an error) if an endpoint with the specified name can't be found

func (*EndpointsClient) ListEndpoints

func (c *EndpointsClient) ListEndpoints() ([]Endpoint, error)

Lists all the current endpoints in an array, returns an error otherwise

func (*EndpointsClient) UpdateEndpoint

func (c *EndpointsClient) UpdateEndpoint(id int64, endpoint Endpoint) (*Endpoint, error)

Updates an existing endpoint, returns the updated endpoint if successful, an error otherwise

Jump to

Keyboard shortcuts

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