pingdomext

package
v1.3.2-0...-966ad0a Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 10 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 struct {
	JWTToken string
	BaseURL  *url.URL

	Integrations *IntegrationService
	// contains filtered or unexported fields
}

Client represents a client to the Pingdom API.

func NewClientWithConfig

func NewClientWithConfig(config ClientConfig) (*Client, error)

NewClientWithConfig returns a Pingdom client.

func (*Client) Do

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

Do makes an HTTP request and will unmarshal the JSON response in to the passed in interface. If the HTTP response is outside of the 2xx range the response will be returned along with the error.

func (*Client) NewRequest

func (pc *Client) NewRequest(method string, rsc string, params map[string]string) (*http.Request, error)

NewRequest makes a new HTTP Request. The method param should be an HTTP method in all caps such as GET, POST, PUT, DELETE. The rsc param should correspond with a restful resource. Params can be passed in as a map of strings Usually users of the client can use one of the convenience methods such as ListChecks, etc but this method is provided to allow for making other API calls that might not be built in.

type ClientConfig

type ClientConfig struct {
	Username   string
	Password   string
	OrgID      string
	AuthURL    string
	BaseURL    string
	HTTPClient *http.Client
}

ClientConfig represents a configuration for a pingdom client.

type Integration

type Integration interface {
	PostParams() map[string]string
	Valid() error
}

Integration is an interface representing a Pingdom integration. Specific integration types should implement the methods of this interface.

type IntegrationGetResponse

type IntegrationGetResponse struct {
	NumberOfConnectedChecks int               `json:"number_of_connected_checks"`
	ID                      int               `json:"id"`
	Name                    string            `json:"name"`
	Description             string            `json:"description"`
	ProviderID              int               `json:"provider_id"`
	ActivatedAt             int               `json:"activated_at"`
	CreatedAt               int               `json:"created_at"`
	UserData                map[string]string `json:"user_data"`
}

IntegrationGetResponse represents the JSON response for a integration from the Pingdom API.

type IntegrationProvider

type IntegrationProvider struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

IntegrationProvider represents a Pingdom integration provider.

type IntegrationService

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

IntegrationService provides an interface to Pingdom integration management.

func (*IntegrationService) Create

func (cs *IntegrationService) Create(integration Integration) (*IntegrationStatus, error)

Create a new Integration.

func (*IntegrationService) Delete

func (cs *IntegrationService) Delete(id int) (*IntegrationStatus, error)

Delete will delete the Integration for the given ID.

func (*IntegrationService) List

List returns the response holding a list of Integration.

func (*IntegrationService) ListProviders

func (cs *IntegrationService) ListProviders() ([]IntegrationProvider, error)

ListProviders returns the response holding a list of Provider.

func (*IntegrationService) Read

Read returns a Integration for a given ID.

func (*IntegrationService) Update

func (cs *IntegrationService) Update(id int, integration Integration) (*IntegrationStatus, error)

Update will update the Integration for the given ID.

type IntegrationStatus

type IntegrationStatus struct {
	ID     int  `json:"id"`
	Status bool `json:"status"`
}

IntegrationStatus represents a general response from the Pingdom integration API.

type WebHookData

type WebHookData struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

WebHookData represents a WebHook data in the WebHook integration.

type WebHookIntegration

type WebHookIntegration struct {
	Active     bool         `json:"active"`
	ProviderID int          `json:"provider_id"`
	UserData   *WebHookData `json:"user_data"`
}

WebHookIntegration represents a Pingdom WebHook integration.

func (*WebHookIntegration) PostParams

func (wi *WebHookIntegration) PostParams() map[string]string

PostParams returns a map of parameters for an WebHook integration that can be sent along.

func (*WebHookIntegration) Valid

func (wi *WebHookIntegration) Valid() error

Valid determines whether the WebHook integration contains valid fields. This can be used to guard against sending illegal values to the Pingdom API.

Jump to

Keyboard shortcuts

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