Exemple #1
0
func cmdNewInstance(cmd *cobra.Command, args []string) {
	initConfig(cmd, "goair_ondemand", true, map[string]FlagValue{})
	client, err := authenticate(false)
	if err != nil {
		log.Fatal(err)
	}

	instanceSpecParams := vcatypes.InstanceSpecParams{
		Name:           "testing",
		PlanID:         "41400e74-4445-49ef-90a4-98da4ccfb16c",
		ServiceGroupID: "4fde19a4-7621-428e-b190-dd4db2e158cd",
	}

	instance, err := client.NewInstance(instanceSpecParams)
	if err != nil {
		log.Fatalf("error Getting instances: %s", err)
	}

	table := gotablethis.Table{
		RowData: reflect.ValueOf(&instance).Elem(),
	}
	table.PrintKeyValueTable()
	fmt.Println()

}
Exemple #2
0
func cmdGetServiceGroupIds(cmd *cobra.Command, args []string) {
	initConfig(cmd, "goair_ondemand", true, map[string]FlagValue{})
	client, err := authenticate(true)
	if err != nil {
		log.Fatal(err)
	}

	table := gotablethis.Table{
		Header:  []string{"ServiceGroupID"},
		RowData: reflect.ValueOf(&client.ServiceGroupIds.ServiceGroupID).Elem(),
	}
	table.PrintColumn()
}
Exemple #3
0
func cmdGetUsers(cmd *cobra.Command, args []string) {
	initConfig(cmd, "goair_ondemand", true, map[string]FlagValue{})
	client, err := authenticate(false)
	if err != nil {
		log.Fatal(err)
	}

	users, err := client.GetUsers()
	if err != nil {
		log.Fatalf("error Getting users: %s", err)
	}

	for _, arg := range users.User {
		table := gotablethis.Table{
			RowData: reflect.ValueOf(&arg).Elem(),
		}
		table.PrintKeyValueTable()
		fmt.Println()
	}

}
Exemple #4
0
func cmdGetBillableCosts(cmd *cobra.Command, args []string) {
	initConfig(cmd, "goair_ondemand", true, map[string]FlagValue{
		"servicegroupid": {serviceGroupID, true, false, ""},
	})
	client, err := authenticate(false)
	if err != nil {
		log.Fatal(err)
	}

	billableCosts, err := client.GetBillableCosts(serviceGroupID)
	if err != nil {
		log.Fatalf("error Getting billable costs: %s", err)

	}

	for _, arg := range billableCosts.Cost {
		table := gotablethis.Table{
			RowData: reflect.ValueOf(&arg).Elem(),
		}
		table.PrintKeyValueTable()
		fmt.Println()
	}

	type tempst struct {
		Currency       string
		LastUpdateTime string
	}
	leftOver := tempst{
		Currency:       billableCosts.Currency,
		LastUpdateTime: billableCosts.LastUpdateTime,
	}

	table := gotablethis.Table{
		RowData: reflect.ValueOf(&leftOver).Elem(),
	}
	table.PrintKeyValueTable()
	fmt.Println()

}