34 lines
553 B
Go
34 lines
553 B
Go
package main
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
var result []Pool = []Pool{}
|
|
cephConn, err := connect()
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
if wrapped := errors.Unwrap(err); wrapped != nil {
|
|
fmt.Println(wrapped)
|
|
}
|
|
os.Exit(1)
|
|
}
|
|
defer cephConn.conn.Shutdown()
|
|
fmt.Println("Successfully connected")
|
|
|
|
poolList, err := cephConn.conn.ListPools()
|
|
if err != nil {
|
|
errors.New("Cannot get list of pools")
|
|
}
|
|
|
|
for _, v := range poolList {
|
|
x, _ := PoolFactory(cephConn, v)
|
|
result = append(result, x)
|
|
}
|
|
fmt.Println(result)
|
|
|
|
}
|