gridscale-check/storages_list.go

39 lines
598 B
Go
Raw Permalink Normal View History

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