mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-25 01:13:40 +01:00
30 lines
855 B
Go
30 lines
855 B
Go
|
package core
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
// ErrEndpointWithoutSSHUsername is the error with which Gatus will panic if an endpoint with SSH monitoring is configured without a user.
|
||
|
ErrEndpointWithoutSSHUsername = errors.New("you must specify a username for each SSH endpoint")
|
||
|
|
||
|
// ErrEndpointWithoutSSHPassword is the error with which Gatus will panic if an endpoint with SSH monitoring is configured without a password.
|
||
|
ErrEndpointWithoutSSHPassword = errors.New("you must specify a password for each SSH endpoint")
|
||
|
)
|
||
|
|
||
|
type SSH struct {
|
||
|
Username string `yaml:"username,omitempty"`
|
||
|
Password string `yaml:"password,omitempty"`
|
||
|
}
|
||
|
|
||
|
// validate validates the endpoint
|
||
|
func (s *SSH) validate() error {
|
||
|
if len(s.Username) == 0 {
|
||
|
return ErrEndpointWithoutSSHUsername
|
||
|
}
|
||
|
if len(s.Password) == 0 {
|
||
|
return ErrEndpointWithoutSSHPassword
|
||
|
}
|
||
|
return nil
|
||
|
}
|