gridscale-check/servers_list.go

38 lines
592 B
Go
Raw Normal View History

2018-04-24 23:55:15 +02:00
// Copyright 2018 Felix Kronlage <fkr@hazardous.org>
package main
import (
2020-03-26 20:01:50 +01:00
"context"
2018-04-24 23:55:15 +02:00
"fmt"
)
type ListServersCommand struct {
}
var listServersCommand ListServersCommand
func (x *ListServersCommand) Execute(args []string) error {
config(Checker.ConfigFile)
2020-03-26 20:01:50 +01:00
ctx := context.Background()
servers, error := Config.Client.GetServerList(ctx)
2018-04-24 23:55:15 +02:00
if error != nil {
2019-09-09 22:41:45 +02:00
Unknown(fmt.Sprintf("Error while retrieving servers: %s", error))
2018-04-24 23:55:15 +02:00
}
2019-09-09 22:41:45 +02:00
for key, server := range servers {
2019-09-10 22:21:15 +02:00
fmt.Printf("%d: %+v\n\n", key, server.Properties)
2018-04-24 23:55:15 +02:00
}
Ok((""))
// never reached
return nil
}
func init() {
}