Discovery Nats automate

This commit is contained in:
mr 2024-08-22 15:04:01 +02:00
parent c8a1377851
commit 6c28684859
2 changed files with 4 additions and 3 deletions

View File

@ -18,10 +18,11 @@ const (
DB_FALLOUT DB_FALLOUT
TEAPOT TEAPOT
DEAD DEAD
WAITING
) )
func ToState(str string) State { func ToState(str string) State {
for _, s := range []State{ALIVE, REDUCED_SERVICE, UNPROCESSABLE_ENTITY, DB_FALLOUT, TEAPOT, DEAD} { for _, s := range []State{ALIVE, REDUCED_SERVICE, UNPROCESSABLE_ENTITY, DB_FALLOUT, TEAPOT, DEAD, WAITING} {
if s.String() == str { if s.String() == str {
return s return s
} }
@ -31,7 +32,7 @@ func ToState(str string) State {
func (s State) String() string { func (s State) String() string {
return [...]string{"alive", "reduced service", "unprocessable entity", "database fallout", return [...]string{"alive", "reduced service", "unprocessable entity", "database fallout",
"some things boils in here, i'm probably a teapot", "dead"}[s] "some things boils in here, i'm probably a teapot", "dead", "waiting"}[s]
} }
type API struct{} type API struct{}

View File

@ -32,7 +32,7 @@ func (d NATSMethod) GenerateKey(name string) string {
} }
func (d NATSMethod) String() string { func (d NATSMethod) String() string {
return [...]string{"remove", "create"}[d] return [...]string{"remove", "create", "discovery"}[d]
} }
type natsCaller struct{} type natsCaller struct{}