Esempio n. 1
0
File: osc.go Progetto: angst/roscoe
func DoListServers(c *client.Client, opts interface{}) error {
	if getField(opts, "Servers").FieldByName("All").Bool() {
		fmt.Printf("all\n")
	}
	servers, err := server.List(c, "")
	fmt.Printf("c: %+v\n\n", *servers)
	return err
}
Esempio n. 2
0
func main() {
	options := struct {
		Debug   bool `goptions:"-x, --debug, description='Enable debugging'"`
		Verbose bool `goptions:"-v, --verbose, description='Be not quiet with output'"`
	}{
		Debug:   false,
		Verbose: false,
	}
	goptions.Parse(&options)

	// Propagate debug setting to packages
	client.Debug = &options.Debug

	// Get auth values from the environment
	var creds osclib.Creds
	c, err := client.NewClient(creds)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Print("Servers: \n")
	servers, err := server.List(c, "")
	if err != nil {
		log.Fatal(err)
	}
	if servers != nil {
		if options.Verbose == true {
			fmt.Printf("c: %+v\n\n", *servers)
		} else {
			fmt.Printf("c: %+v\n\n", *servers)
		}
	}

	flavors, err := flavor.List(c, "")
	if err != nil {
		log.Fatal(err)
	}
	//    osclib.OutputData([]string{"a","b","c"}, []interface{}(flavors))
	for k, v := range flavors.Flavors {
		fmt.Printf("%d: %s\n", k, v.Id)
	}

}