Add TCP Middlewares support
This commit is contained in:
parent
679def0151
commit
fc9f41b955
134 changed files with 5865 additions and 1852 deletions
|
@ -112,3 +112,33 @@ func (s *TCPServiceInfo) AddError(err error, critical bool) {
|
|||
s.Status = StatusWarning
|
||||
}
|
||||
}
|
||||
|
||||
// TCPMiddlewareInfo holds information about a currently running middleware.
|
||||
type TCPMiddlewareInfo struct {
|
||||
*dynamic.TCPMiddleware // dynamic configuration
|
||||
// Err contains all the errors that occurred during service creation.
|
||||
Err []string `json:"error,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
UsedBy []string `json:"usedBy,omitempty"` // list of TCP routers and services using that middleware.
|
||||
}
|
||||
|
||||
// AddError adds err to s.Err, if it does not already exist.
|
||||
// If critical is set, m is marked as disabled.
|
||||
func (m *TCPMiddlewareInfo) AddError(err error, critical bool) {
|
||||
for _, value := range m.Err {
|
||||
if value == err.Error() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
m.Err = append(m.Err, err.Error())
|
||||
if critical {
|
||||
m.Status = StatusDisabled
|
||||
return
|
||||
}
|
||||
|
||||
// only set it to "warning" if not already in a worse state
|
||||
if m.Status != StatusDisabled {
|
||||
m.Status = StatusWarning
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue