Documentation ¶
Index ¶
- Constants
- type AlertChannel
- type AlertSettings
- type Assertion
- type BasicAuth
- type Check
- type Client
- func (c *Client) Create(check Check) (string, error)
- func (c *Client) Delete(ID string) error
- func (c *Client) Get(ID string) (Check, error)
- func (c *Client) MakeAPICall(method string, URL string, data []byte) (statusCode int, response string, err error)
- func (c *Client) Update(ID string, check Check) error
- type EnvironmentVariable
- type KeyValue
- type Reminders
- type Request
- type RunBasedEscalation
- type SSLCertificates
- type Subscription
- type TimeBasedEscalation
Constants ¶
const Contains = "CONTAINS"
Contains asserts that the source contains a specified value.
const Equals = "EQUALS"
Equals asserts that the source and target are equal.
const GreaterThan = "GREATER_THAN"
GreaterThan asserts that the source is greater than the target.
const Headers = "HEADERS"
Headers identifies the HTTP headers as an assertion source.
const IsEmpty = "IS_EMPTY"
IsEmpty asserts that the source is empty.
const JSONBody = "JSON_BODY"
JSONBody identifies the JSON body data as an assertion source.
const LessThan = "LESS_THAN"
LessThan asserts that the source is less than the target.
const NotContains = "NOT_CONTAINS"
NotContains asserts that the source does not contain a specified value.
const NotEmpty = "NOT_EMPTY"
NotEmpty asserts that the source is not empty.
const NotEquals = "NOT_EQUALS"
NotEquals asserts that the source and target are not equal.
const ResponseTime = "RESPONSE_TIME"
ResponseTime identifies the response time as an assertion source.
const RunBased = "RUN_BASED"
RunBased identifies a run-based escalation type, for use with an AlertSettings.
const StatusCode = "STATUS_CODE"
StatusCode identifies the HTTP status code as an assertion source.
const TextBody = "TEXT_BODY"
TextBody identifies the response body text as an assertion source.
const TimeBased = "TIME_BASED"
TimeBased identifies a time-based escalation type, for use with an AlertSettings.
const TypeAPI = "API"
TypeAPI is used to identify an API check.
const TypeBrowser = "BROWSER"
TypeBrowser is used to identify a browser check.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertChannel ¶ added in v0.2.0
type AlertChannel struct { ID string `json:"id"` Type string `json:"type,omitempty"` Config map[string]interface{} `json:"config,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
AlertChannel represents an alert channel and its subscribed checks. The API defines this data as read-only.
type AlertSettings ¶ added in v0.0.2
type AlertSettings struct { EscalationType string `json:"escalationType,omitempty"` RunBasedEscalation RunBasedEscalation `json:"runBasedEscalation,omitempty"` TimeBasedEscalation TimeBasedEscalation `json:"timeBasedEscalation,omitempty"` Reminders Reminders `json:"reminders,omitempty"` SSLCertificates SSLCertificates `json:"sslCertificates,omitempty"` }
AlertSettings represents an alert configuration.
type Assertion ¶ added in v0.0.4
type Assertion struct { Edit bool `json:"edit"` Order int `json:"order"` ArrayIndex int `json:"arrayIndex"` ArraySelector int `json:"arraySelector"` Source string `json:"source"` Property string `json:"property"` Comparison string `json:"comparison"` Target string `json:"target"` }
Assertion represents an assertion about an API response, which will be verified as part of the check.
type BasicAuth ¶ added in v0.0.7
type BasicAuth struct { Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` }
BasicAuth represents the HTTP basic authentication credentials for a request.
type Check ¶
type Check struct { ID string `json:"id"` Name string `json:"name"` Type string `json:"checkType"` Frequency int `json:"frequency"` Activated bool `json:"activated"` Muted bool `json:"muted"` ShouldFail bool `json:"shouldFail"` Locations []string `json:"locations"` DegradedResponseTime int `json:"degradedResponseTime"` MaxResponseTime int `json:"maxResponseTime"` Script string `json:"script,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` EnvironmentVariables []EnvironmentVariable `json:"environmentVariables"` DoubleCheck bool `json:"doubleCheck"` Tags []string `json:"tags,omitempty"` SSLCheck bool `json:"sslCheck"` SSLCheckDomain string `json:"sslCheckDomain"` SetupSnippetID int64 `json:"setupSnippetId,omitempty"` TearDownSnippetID int64 `json:"tearDownSnippetId,omitempty"` LocalSetupScript string `json:"localSetupScript,omitempty"` LocalTearDownScript string `json:"localTearDownScript,omitempty"` AlertSettings AlertSettings `json:"alertSettings,omitempty"` UseGlobalAlertSettings bool `json:"useGlobalAlertSettings"` Request Request `json:"request"` AlertChannelSubscriptions []Subscription `json:"alertChannelSubscriptions"` }
Check represents the parameters for an existing check.
type Client ¶
type Client struct { URL string HTTPClient *http.Client Debug io.Writer // contains filtered or unexported fields }
Client represents a Checkly client. If the Debug field is set to an io.Writer (for example os.Stdout), then the client will dump API requests and responses to it. To use a non-default HTTP client (for example, for testing, or to set a timeout), assign to the HTTPClient field. To set a non-default URL (for example, for testing), assign to the URL field.
func (*Client) Create ¶
Create creates a new check with the specified details. It returns the check ID of the newly-created check, or an error.
func (*Client) Delete ¶
Delete deletes the check with the specified ID. It returns a non-nil error if the request failed.
func (*Client) Get ¶
Get takes the ID of an existing check, and returns the check parameters, or an error.
type EnvironmentVariable ¶ added in v0.0.2
type EnvironmentVariable struct { Key string `json:"key"` Value string `json:"value"` Locked bool `json:"locked"` }
EnvironmentVariable represents a key-value pair for setting environment values during check execution.
type KeyValue ¶ added in v0.0.4
type KeyValue struct { Key string `json:"key"` Value string `json:"value"` Locked bool `json:"locked"` }
KeyValue represents a key-value pair, for example a request header setting, or a query parameter.
type Reminders ¶ added in v0.0.2
type Reminders struct { Amount int `json:"amount,omitempty"` Interval int `json:"interval,omitempty"` }
Reminders represents the number of reminders to send after an alert notification, and the time interval between them.
type Request ¶
type Request struct { Method string `json:"method"` URL string `json:"url"` FollowRedirects bool `json:"followRedirects"` Body string `json:"body"` BodyType string `json:"bodyType,omitempty"` Headers []KeyValue `json:"headers"` QueryParameters []KeyValue `json:"queryParameters"` Assertions []Assertion `json:"assertions"` BasicAuth BasicAuth `json:"basicAuth,omitempty"` }
Request represents the parameters for the request made by the check.
type RunBasedEscalation ¶ added in v0.0.2
type RunBasedEscalation struct {
FailedRunThreshold int `json:"failedRunThreshold,omitempty"`
}
RunBasedEscalation represents an alert escalation based on a number of failed check runs.
type SSLCertificates ¶ added in v0.0.2
type SSLCertificates struct { Enabled bool `json:"enabled"` AlertThreshold int `json:"alertThreshold"` }
SSLCertificates represents alert settings for expiring SSL certificates.
type Subscription ¶ added in v0.2.0
type Subscription struct { ID string `json:"id,omitempty"` CheckID string `json:"checkId,omitempty"` AlertChannelID int64 `json:"alertChannelId,omitempty"` Activated bool `json:"activated"` }
Subscription represents a subscription to an alert channel. The API defines this data as read-only.
type TimeBasedEscalation ¶ added in v0.0.2
type TimeBasedEscalation struct {
MinutesFailingThreshold int `json:"minutesFailingThreshold,omitempty"`
}
TimeBasedEscalation represents an alert escalation based on the number of minutes after a check first starts failing.