-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcontroller.go
More file actions
30 lines (24 loc) · 938 Bytes
/
controller.go
File metadata and controls
30 lines (24 loc) · 938 Bytes
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
package gitreceive
import (
"errors"
"fmt"
"strings"
)
var (
errControllerNotFound = errors.New("Deis controller not found. Is it running?")
errControllerServiceUnavailable = errors.New("Deis controller was unavailable. Is it healthy?")
)
type unexpectedControllerStatusCode struct {
endpoint string
expected int
actual int
}
func newUnexpectedControllerStatusCode(endpoint string, expectedCode, actualCode int) unexpectedControllerStatusCode {
return unexpectedControllerStatusCode{endpoint: endpoint, expected: expectedCode, actual: actualCode}
}
func (u unexpectedControllerStatusCode) Error() string {
return fmt.Sprintf("Deis controller endpoint %s: expected status code %d, got %d", u.endpoint, u.expected, u.actual)
}
func controllerURLStr(conf *Config, additionalPath ...string) string {
return fmt.Sprintf("http://%s:%s/%s", conf.WorkflowHost, conf.WorkflowPort, strings.Join(additionalPath, "/"))
}