Documentation
¶
Index ¶
- type Client
- type ClientConfig
- type Integration
- type IntegrationGetResponse
- type IntegrationProvider
- type IntegrationService
- func (cs *IntegrationService) Create(integration Integration) (*IntegrationStatus, error)
- func (cs *IntegrationService) Delete(id int) (*IntegrationStatus, error)
- func (cs *IntegrationService) List() ([]IntegrationGetResponse, error)
- func (cs *IntegrationService) ListProviders() ([]IntegrationProvider, error)
- func (cs *IntegrationService) Read(id int) (*IntegrationGetResponse, error)
- func (cs *IntegrationService) Update(id int, integration Integration) (*IntegrationStatus, error)
- type IntegrationStatus
- type WebHookData
- type WebHookIntegration
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 ¶
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 ¶
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 ¶
func (cs *IntegrationService) List() ([]IntegrationGetResponse, error)
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 ¶
func (cs *IntegrationService) Read(id int) (*IntegrationGetResponse, error)
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 ¶
IntegrationStatus represents a general response from the Pingdom integration API.
type WebHookData ¶
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.