Documentation
¶
Index ¶
- Constants
- func DefaultConfig(indent string) []byte
- func RegisterFlag(prefix string, Command *spfcbr.Command, Viper *spfvpr.Viper) error
- type Component
- type ConfigStatus
- type CptResponse
- type FctHealth
- type FctInfo
- type FctMessage
- type Info
- type InfoResponse
- type Response
- type RouteStatus
- type Status
- type StatusResponse
Constants ¶
View Source
const DefMessageKO = "KO"
View Source
const DefMessageOK = "OK"
Variables ¶
This section is empty.
Functions ¶
func DefaultConfig ¶ added in v1.8.10
Types ¶
type Component ¶ added in v1.5.5
type Component interface {
Get(x *gin.Context) CptResponse
Clean()
}
func NewComponent ¶ added in v1.5.5
type ConfigStatus ¶ added in v1.8.10
type ConfigStatus struct {
// Mandatory define if the component must be available for the api.
// If yes, api status will be KO if this component is down.
// If no, api status can be OK if this component is down.
Mandatory bool `json:"mandatory" yaml:"mandatory" toml:"mandatory" mapstructure:"mandatory"`
// MessageOK define the message if the status is OK. Default is "OK"
MessageOK string `json:"message_ok" yaml:"message_ok" toml:"message_ok" mapstructure:"message_ok" validate:"printascii"`
// MessageKO define the message if the status is KO. Default is "KO"
MessageKO string `json:"message_ko" yaml:"message_ko" toml:"message_ko" mapstructure:"message_ko" validate:"printascii"`
// CacheTimeoutInfo define the time between checking the component information (name, release, ...), to prevent asking it too many. Default is 1 hour.
CacheTimeoutInfo time.Duration `json:"cache_timeout_info" yaml:"cache_timeout_info" toml:"cache_timeout_info" mapstructure:"cache_timeout_info"`
// CacheTimeoutHealth define the time between checking the component health to prevent asking it too many. Default is 5 second.
CacheTimeoutHealth time.Duration `json:"cache_timeout_health" yaml:"cache_timeout_health" toml:"cache_timeout_health" mapstructure:"cache_timeout_health"`
}
func (*ConfigStatus) Component ¶ added in v1.8.10
func (c *ConfigStatus) Component(fctInfo FctInfo, fctHealth FctHealth) Component
func (*ConfigStatus) RegisterStatus ¶ added in v1.8.10
func (c *ConfigStatus) RegisterStatus(sts RouteStatus, key string, fctInfo FctInfo, fctHealth FctHealth)
type CptResponse ¶ added in v1.5.5
type CptResponse struct {
InfoResponse
StatusResponse
}
type FctMessage ¶ added in v1.5.5
type Info ¶ added in v1.5.5
type Info interface {
Get(x *gin.Context) InfoResponse
Clean()
IsValid() bool
}
type InfoResponse ¶ added in v1.5.5
type InfoResponse struct {
Name string `json:"name"`
Release string `json:"release"`
HashBuild string `json:"hash_build"`
Mandatory bool `json:"mandatory"`
}
func (*InfoResponse) Clone ¶ added in v1.5.5
func (i *InfoResponse) Clone() InfoResponse
type Response ¶ added in v1.5.5
type Response struct {
InfoResponse
StatusResponse
Components []CptResponse `json:"components"`
// contains filtered or unexported fields
}
func (Response) IsOkMandatory ¶ added in v1.5.5
type RouteStatus ¶ added in v1.5.5
type RouteStatus interface {
MiddlewareAdd(mdw ...gin.HandlerFunc)
HttpStatusCode(codeOk, codeKO, codeWarning int)
Get(c *gin.Context)
Register(prefix string, register librtr.RegisterRouter)
RegisterGroup(group, prefix string, register librtr.RegisterRouterInGroup)
ComponentNew(key string, cpt Component)
ComponentDel(key string)
ComponentDelAll(containKey string)
}
func NewVersion ¶ added in v1.5.5
type StatusResponse ¶
func (*StatusResponse) Clone ¶ added in v1.5.5
func (s *StatusResponse) Clone() StatusResponse
Click to show internal directories.
Click to hide internal directories.