-
Notifications
You must be signed in to change notification settings - Fork 1
/
handler.go
39 lines (31 loc) · 814 Bytes
/
handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package lambstatus
import (
"log"
"net/http"
"os"
"github.com/eawsy/aws-lambda-go-core/service/lambda/runtime"
factory "github.com/flaccid/lambstatus-pingdom/factory"
)
var (
debugMode bool = false
)
func handleEvent() {
log.Println("function starting")
factory.Ship(os.Getenv("LAMBSTATUS_ENDPOINT_URL"),
os.Getenv("LAMBSTATUS_API_KEY"),
os.Getenv("PINGDOM_USERNAME"),
os.Getenv("PINGDOM_PASSWORD"),
os.Getenv("PINGDOM_API_KEY"),
os.Getenv("CHECK_TO_METRIC_MAP"),
debugMode)
log.Println("function complete")
}
// Handle - external handling via runtime context
func Handle(evt interface{}, ctx *runtime.Context) (interface{}, error) {
handleEvent()
return "done", nil
}
// HTTPHandle - Cloud Function handler
func HTTPHandle(w http.ResponseWriter, r *http.Request) {
handleEvent()
}