Documentation
¶
Index ¶
- Constants
- func AlertChannelConfigFromJSON(channelType string, cfgJSON []byte) (interface{}, error)
- type APICheckDefaults
- type AlertChannel
- type AlertChannelEmail
- type AlertChannelOpsgenie
- type AlertChannelPagerduty
- type AlertChannelSMS
- type AlertChannelSlack
- type AlertChannelSubscription
- type AlertChannelWebhook
- type AlertSettings
- type ApiCheckResult
- type Assertion
- type BasicAuth
- type BrowserCheckResult
- type Check
- type CheckResult
- type CheckResultsFilter
- type CheckType
- type Client
- type EnvironmentVariable
- type Group
- type KeyValue
- type Reminders
- type Request
- type RunBasedEscalation
- type SSLCertificates
- type Snippet
- type TimeBasedEscalation
Constants ¶
const ( AlertTypeEmail = "EMAIL" AlertTypeSlack = "SLACK" AlertTypeWebhook = "WEBHOOK" AlertTypeSMS = "SMS" AlertTypePagerduty = "PAGERDUTY" AlertTypeOpsgenie = "OPSGENIE" )
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 ¶
func AlertChannelConfigFromJSON ¶ added in v0.4.8
AlertChannelConfigFromJSON gets AlertChannel.config from JSON
Types ¶
type APICheckDefaults ¶ added in v0.4.0
type APICheckDefaults struct { BaseURL string `json:"url"` Headers []KeyValue `json:"headers,omitempty"` QueryParameters []KeyValue `json:"queryParameters,omitempty"` Assertions []Assertion `json:"assertions,omitempty"` BasicAuth BasicAuth `json:"basicAuth,omitempty"` }
APICheckDefaults represents the default settings for API checks within a given group.
type AlertChannel ¶
type AlertChannel struct { ID int64 `json:"id,omitempty"` Type string `json:"type"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Email *AlertChannelEmail `json:"-"` Slack *AlertChannelSlack `json:"-"` SMS *AlertChannelSMS `json:"-"` Opsgenie *AlertChannelOpsgenie `json:"-"` Webhook *AlertChannelWebhook `json:"-"` Pagerduty *AlertChannelPagerduty `json:"-"` SendRecovery *bool `json:"sendRecovery"` SendFailure *bool `json:"sendFailure"` SendDegraded *bool `json:"sendDegraded"` SSLExpiry *bool `json:"sslExpiry"` SSLExpiryThreshold *int `json:"sslExpiryThreshold"` }
AlertChannel represents an alert channel and its subscribed checks. The API defines this data as read-only.
func (*AlertChannel) GetConfig ¶ added in v0.4.8
func (a *AlertChannel) GetConfig() (cfg map[string]interface{})
GetConfig gets the config of the alert channel based on it's type
func (*AlertChannel) SetConfig ¶ added in v0.4.8
func (a *AlertChannel) SetConfig(cfg interface{})
SetConfig sets config of alert channel based on it's type
type AlertChannelEmail ¶ added in v0.4.8
type AlertChannelEmail struct {
Address string `json:"address"`
}
AlertChannelEmail defines a type for an email alert channel
type AlertChannelOpsgenie ¶ added in v0.4.8
type AlertChannelOpsgenie struct { Name string `json:"name"` APIKey string `json:"apiKey"` Region string `json:"region"` Priority string `json:"priority"` }
AlertChannelOpsgenie defines a type for an opsgenie alert channel
type AlertChannelPagerduty ¶ added in v1.2.0
type AlertChannelPagerduty struct { Account string `json:"account,omitempty"` ServiceKey string `json:"serviceKey"` ServiceName string `json:"serviceName,omitempty"` }
AlertChannelPagerduty defines a type for an pager duty alert channel
type AlertChannelSMS ¶ added in v0.4.8
AlertChannelSMS defines a type for a sms alert channel
type AlertChannelSlack ¶ added in v0.4.8
AlertChannelSlack defines a type for a slack alert channel
type AlertChannelSubscription ¶ added in v0.4.8
type AlertChannelSubscription struct { ChannelID int64 `json:"alertChannelId"` Activated bool `json:"activated"` }
AlertChannelSubscription represents a subscription to an alert channel.
type AlertChannelWebhook ¶ added in v0.4.8
type AlertChannelWebhook struct { Name string `json:"name"` URL string `json:"url"` Method string `json:"method,omitempty"` Template string `json:"template,omitempty"` WebhookSecret string `json:"webhookSecret,omitempty"` Headers []KeyValue `json:"headers,omitempty"` QueryParameters []KeyValue `json:"queryParameters,omitempty"` }
AlertChannelWebhook defines a type for a webhook alert channel
type AlertSettings ¶
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 ApiCheckResult ¶ added in v0.4.4
type ApiCheckResult map[string]interface{}
ApiCheckResult represents an API Check result
type Assertion ¶
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 BrowserCheckResult ¶ added in v0.4.4
type BrowserCheckResult map[string]interface{}
BrowserCheckResult represents a Browser Check result
type Check ¶
type Check struct { ID string `json:"id"` Name string `json:"name"` Type string `json:"checkType"` Frequency int `json:"frequency"` FrequencyOffset int `json:"frequencyOffset,omitempty"` 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"` EnvironmentVariables []EnvironmentVariable `json:"environmentVariables"` DoubleCheck bool `json:"doubleCheck"` Tags []string `json:"tags,omitempty"` SSLCheck bool `json:"sslCheck"` 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"` GroupID int64 `json:"groupId,omitempty"` GroupOrder int `json:"groupOrder,omitempty"` AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions,omitempty"` RuntimeID *string `json:"runtimeId"` }
Check represents the parameters for an existing check.
type CheckResult ¶ added in v0.4.4
type CheckResult struct { ID string `json:"id"` Name string `json:"name"` CheckID string `json:"checkId"` HasFailures bool `json:"hasFailures"` HasErrors bool `json:"hasErrors"` IsDegraded bool `json:"isDegraded"` OverMaxResponseTime bool `json:"overMaxResponseTime"` RunLocation string `json:"runLocation"` StartedAt time.Time `json:"startedAt"` StoppedAt time.Time `json:"stoppedAt"` CreatedAt time.Time `json:"created_at"` ResponseTime int64 `json:"responseTime"` ApiCheckResult *ApiCheckResult `json:"apiCheckResult"` BrowserCheckResult *BrowserCheckResult `json:"browserCheckResult"` CheckRunID int64 `json:"checkRunId"` Attempts int64 `json:"attempts"` }
CheckResult represents a Check result
type CheckResultsFilter ¶ added in v0.4.4
type CheckResultsFilter struct { Limit int64 Page int64 Location string To int64 From int64 CheckType CheckType HasFailures bool }
CheckResultsFilter represents the parameters that can be passed while getting Check Results
type Client ¶
type Client interface { // Create creates a new check with the specified details. // It returns the newly-created check, or an error. Create( ctx context.Context, check Check, ) (*Check, error) // Update updates an existing check with the specified details. // It returns the updated check, or an error. Update( ctx context.Context, ID string, check Check, ) (*Check, error) // Delete deletes the check with the specified ID. // It returns a non-nil error if the request failed. Delete( ctx context.Context, ID string, ) error // Get takes the ID of an existing check, and returns the check parameters, // or an error. Get( ctx context.Context, ID string, ) (*Check, error) // CreateGroup creates a new check group with the specified details. // It returns the newly-created group, or an error. CreateGroup( ctx context.Context, group Group, ) (*Group, error) // GetGroup takes the ID of an existing check group, and returns the // corresponding group, or an error. GetGroup( ctx context.Context, ID int64, ) (*Group, error) // UpdateGroup takes the ID of an existing check group, and updates the // corresponding check group to match the supplied group. It returns the updated // group, or an error. UpdateGroup( ctx context.Context, ID int64, group Group, ) (*Group, error) // DeleteGroup deletes the check group with the specified ID. It returns a // non-nil error if the request failed. DeleteGroup( ctx context.Context, ID int64, ) error // GetCheckResult gets a specific Check result, or it returns an error. GetCheckResult( ctx context.Context, checkID, checkResultID string, ) (*CheckResult, error) // GetCheckResults gets the results of the given Check GetCheckResults( ctx context.Context, checkID string, filters *CheckResultsFilter, ) ([]CheckResult, error) // CreateSnippet creates a new snippet with the specified details. It returns // the newly-created snippet, or an error. CreateSnippet( ctx context.Context, snippet Snippet, ) (*Snippet, error) // GetSnippet takes the ID of an existing snippet, and returns the // corresponding snippet, or an error. GetSnippet( ctx context.Context, ID int64, ) (*Snippet, error) // UpdateSnippet takes the ID of an existing snippet, and updates the // corresponding snippet to match the supplied snippet. It returns the updated // snippet, or an error. UpdateSnippet( ctx context.Context, ID int64, snippet Snippet, ) (*Snippet, error) // DeleteSnippet deletes the snippet with the specified ID. It returns a // non-nil error if the request failed. DeleteSnippet( ctx context.Context, ID int64, ) error // CreateEnvironmentVariable creates a new environment variable with the // specified details. It returns the newly-created environment variable, // or an error. CreateEnvironmentVariable( ctx context.Context, envVar EnvironmentVariable, ) (*EnvironmentVariable, error) // GetEnvironmentVariable takes the ID of an existing environment variable, and returns the // corresponding environment variable, or an error. GetEnvironmentVariable( ctx context.Context, key string, ) (*EnvironmentVariable, error) // UpdateEnvironmentVariable takes the ID of an existing environment variable, and updates the // corresponding environment variable to match the supplied environment variable. It returns the updated // environment variable, or an error. UpdateEnvironmentVariable( ctx context.Context, key string, envVar EnvironmentVariable, ) (*EnvironmentVariable, error) // DeleteEnvironmentVariable deletes the environment variable with the specified ID. It returns a // non-nil error if the request failed. DeleteEnvironmentVariable( ctx context.Context, key string, ) error // CreateAlertChannel creates a new alert channel with the specified details. It returns // the newly-created alert channel, or an error. CreateAlertChannel( ctx context.Context, ac AlertChannel, ) (*AlertChannel, error) // GetAlertChannel takes the ID of an existing alert channel, and returns the // corresponding alert channel, or an error. GetAlertChannel( ctx context.Context, ID int64, ) (*AlertChannel, error) // UpdateAlertChannel takes the ID of an existing alert channel, and updates the // corresponding alert channel to match the supplied alert channel. It returns the updated // alert channel, or an error. UpdateAlertChannel( ctx context.Context, ID int64, ac AlertChannel, ) (*AlertChannel, error) // DeleteAlertChannel deletes the alert channel with the specified ID. It returns a // non-nil error if the request failed. DeleteAlertChannel( ctx context.Context, ID int64, ) error }
Client is an interface that implements Checkly's API
type EnvironmentVariable ¶
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 Group ¶ added in v0.4.0
type Group struct { ID int64 `json:"id,omitempty"` Name string `json:"name"` Activated bool `json:"activated"` Muted bool `json:"muted"` Tags []string `json:"tags"` Locations []string `json:"locations"` Concurrency int `json:"concurrency"` APICheckDefaults APICheckDefaults `json:"apiCheckDefaults"` EnvironmentVariables []EnvironmentVariable `json:"environmentVariables"` DoubleCheck bool `json:"doubleCheck"` UseGlobalAlertSettings bool `json:"useGlobalAlertSettings"` AlertSettings AlertSettings `json:"alertSettings,omitempty"` SetupSnippetID int64 `json:"setupSnippetId,omitempty"` TearDownSnippetID int64 `json:"tearDownSnippetId,omitempty"` LocalSetupScript string `json:"localSetupScript,omitempty"` LocalTearDownScript string `json:"localTearDownScript,omitempty"` AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions,omitempty"` RuntimeID *string `json:"runtimeId"` }
Group represents a check group.
type KeyValue ¶
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 ¶
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 ¶
type RunBasedEscalation struct {
FailedRunThreshold int `json:"failedRunThreshold,omitempty"`
}
RunBasedEscalation represents an alert escalation based on a number of failed check runs.
type SSLCertificates ¶
type SSLCertificates struct { Enabled bool `json:"enabled"` AlertThreshold int `json:"alertThreshold"` }
SSLCertificates represents alert settings for expiring SSL certificates.
type Snippet ¶ added in v0.4.6
type Snippet struct { ID int64 `json:"id"` Name string `json:"name"` Script string `json:"script"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
Snippet defines Snippet type
type TimeBasedEscalation ¶
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.