mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
improv api, datastore, postgres, runner
This commit is contained in:
@@ -14,16 +14,43 @@ var (
|
||||
ErrRoutesNotFound = errors.New("Route not found")
|
||||
)
|
||||
|
||||
type Routes []Route
|
||||
type Routes []*Route
|
||||
|
||||
type Route struct {
|
||||
Name string `json:"name"`
|
||||
AppName string `json:"appname"`
|
||||
Path string `json:"path"`
|
||||
Image string `json:"image"`
|
||||
Type string `json:"type"`
|
||||
ContainerPath string `json:"container_path"`
|
||||
Headers http.Header `json:"headers"`
|
||||
Type string `json:"type,omitempty"`
|
||||
ContainerPath string `json:"container_path,omitempty"`
|
||||
Headers http.Header `json:"headers,omitempty"`
|
||||
}
|
||||
|
||||
var (
|
||||
ErrRoutesValidationName = errors.New("Missing route Name")
|
||||
ErrRoutesValidationImage = errors.New("Missing route Image")
|
||||
ErrRoutesValidationAppName = errors.New("Missing route AppName")
|
||||
ErrRoutesValidationPath = errors.New("Missing route Path")
|
||||
)
|
||||
|
||||
func (r *Route) Validate() error {
|
||||
if r.Name == "" {
|
||||
return ErrRoutesValidationName
|
||||
}
|
||||
|
||||
if r.Image == "" {
|
||||
return ErrRoutesValidationImage
|
||||
}
|
||||
|
||||
if r.AppName == "" {
|
||||
return ErrRoutesValidationAppName
|
||||
}
|
||||
|
||||
if r.Path == "" {
|
||||
return ErrRoutesValidationPath
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type RouteFilter struct {
|
||||
|
||||
Reference in New Issue
Block a user