returnfmt.Errorf("call to provider alert returned status code %d: %s",response.StatusCode,string(body))
}
returnerr
}
typeAlertBodystruct{
Titlestring`json:"title,omitempty"`// The title of the alert.
Descriptionstring`json:"description,omitempty"`// A high-level summary of the problem.
StartTimestring`json:"start_time,omitempty"`// The time of the alert. If none is provided, a current time is used.
EndTimestring`json:"end_time,omitempty"`// The resolution time of the alert. If provided, the alert is resolved.
Servicestring`json:"service,omitempty"`// The affected service.
MonitoringToolstring`json:"monitoring_tool,omitempty"`// The name of the associated monitoring tool.
Hostsstring`json:"hosts,omitempty"`// One or more hosts, as to where this incident occurred.
Severitystring`json:"severity,omitempty"`// The severity of the alert. Case-insensitive. Can be one of: critical, high, medium, low, info, unknown. Defaults to critical if missing or value is not in this list.
Fingerprintstring`json:"fingerprint,omitempty"`// The unique identifier of the alert. This can be used to group occurrences of the same alert.
GitlabEnvironmentNamestring`json:"gitlab_environment_name,omitempty"`// The name of the associated GitLab environment. Required to display alerts on a dashboard.
message=fmt.Sprintf("An alert for *%s* has been resolved after passing successfully %d time(s) in a row",endpoint.DisplayName(),alert.SuccessThreshold)
}else{
message=fmt.Sprintf("An alert for *%s* has been triggered due to having failed %d time(s) in a row",endpoint.DisplayName(),alert.FailureThreshold)