Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Commit

Permalink
Add comments above handlers
Browse files Browse the repository at this point in the history
Adding comments above handlers with slight
description on their purpouse to be displayed
in the godoc for the openfaas-cloud repository

Signed-off-by: Martin Dekov (VMware) <[email protected]>
  • Loading branch information
martindekov authored and alexellis committed Dec 4, 2018
1 parent c361c22 commit 20e7969
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 8 deletions.
4 changes: 3 additions & 1 deletion github-status/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ var (
token = ""
)

// Handle a serverless request
// Handle reports the building process of the
// function along with the function stack by sending
// commit statuses to GitHub on pending, failure or success
func Handle(req []byte) string {

if hmacEnabled() {
Expand Down
4 changes: 3 additions & 1 deletion gitlab-event/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ var (
supportedEvents = [...]string{PushEvent, ProjectUpdateEvent, ProjectDestroyEvent}
)

// Handle a serverless request
// Handle is the function which accepts events from
// GitLab and filters them also checks if the repository
// is installed on the cloud
func Handle(req []byte) string {
eventHeader := os.Getenv("Http_X_Gitlab_Event")
xGitlabToken := os.Getenv("Http_X_Gitlab_Token")
Expand Down
4 changes: 3 additions & 1 deletion gitlab-push/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ const (

var audit sdk.Audit

// Handle a serverless request
// Handle accepts push event from gitlab-event
// and transforms the payload into PushEvent struct
// which is then sent to git-tar for a function to be built
func Handle(req []byte) string {
validateErr := validateRequest(req)
if validateErr != nil {
Expand Down
4 changes: 3 additions & 1 deletion gitlab-status/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import (
"github.com/openfaas/openfaas-cloud/sdk"
)

// Handle a serverless request
// Handle reports the building process of the
// function and the function stack to GitLab by
// sending commit statuses on pending, success, failure
func Handle(req []byte) string {
if validateError := validateRequest(req); validateError != nil {
log.Fatal(validateError)
Expand Down
4 changes: 3 additions & 1 deletion import-secrets/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// Handle a serverless request
// Handle uses SealedSecrets to bind the secrets
// to the cluster so the buildshiprun can bind user
// secrets to function
func Handle(req []byte) string {
event := getEventFromHeader()

Expand Down
5 changes: 4 additions & 1 deletion list-functions/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import (
"github.com/openfaas/openfaas-cloud/sdk"
)

// Handle a serverless request
// Handle takes the functions which are built
// by buildshiprun and exposes the function object
// to be consumed by the dashboard so the function
// can be displayed
func Handle(req []byte) string {

user := string(req)
Expand Down
3 changes: 2 additions & 1 deletion pipeline-log/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (
"github.com/openfaas/openfaas-cloud/sdk"
)

// Handle a serverless request
// Handle sends the function logs to the
// pipeline to be exposed in the dashboard
func Handle(req []byte) string {
method := os.Getenv("Http_Method")

Expand Down
2 changes: 1 addition & 1 deletion system-metrics/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Metrics struct {
Failure int `json:"failure"`
}

// Handle a serverless request
// Handle exposes the OpenFaaS instance metrics
func Handle(req []byte) string {
fnName, err := parseFunctionName()

Expand Down

0 comments on commit 20e7969

Please sign in to comment.