generated from cybozu-go/neco-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.go
33 lines (26 loc) · 1.33 KB
/
functions.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
package necogcp
import (
"context"
"net/http"
"cloud.google.com/go/pubsub"
"github.com/cybozu-go/neco-gcp/pkg/autodctest"
"github.com/cybozu-go/neco-gcp/pkg/instancedeleter"
"github.com/cybozu-go/neco-gcp/pkg/slacknotifier"
)
// NOTE: An entrypoint of the Cloud Functions must be in the root of this project.
// ref: https://cloud.google.com/functions/docs/writing#structuring_source_code
// >> For the Go runtime, your function must be in a Go package at the root of your project. Your function cannot be in package main. Sub-packages are only supported when using Go modules.
func ExtendEntryPoint(w http.ResponseWriter, r *http.Request) {
instancedeleter.ExtendEntryPoint(w, r, NecoTestProject, NecoTestZone)
}
func ShutdownEntryPoint(ctx context.Context, m *pubsub.Message) error {
return instancedeleter.ShutdownEntryPoint(ctx, m, NecoTestProject, NecoTestZone)
}
// SlackNotifierEntryPoint is the entrypoint for the "slack-notifier" function.
func SlackNotifierEntryPoint(ctx context.Context, m *pubsub.Message) error {
return slacknotifier.EntryPoint(ctx, m)
}
// AutoDCTestEntryPoint is the entrypoint for the "auto-dctest" function.
func AutoDCTestEntryPoint(ctx context.Context, m *pubsub.Message) error {
return autodctest.EntryPoint(ctx, m, autoDCTestMachineType, autoDCTestNumLocalSSDs, autoDCTestZone, autoDCTestJPHolidays)
}