示例#1
0
文件: main.go 项目: joshie/lochness
func getImages(c *cli.Client) []cli.JMap {
	ret, _ := c.GetMany("images", "images")
	images := make([]cli.JMap, len(ret))
	for i := range ret {
		images[i] = ret[i]
	}
	return images
}
示例#2
0
文件: main.go 项目: joshie/lochness
func deleteGuest(c *cli.Client, id string) cli.JMap {
	guest, resp := c.Delete("guest", "guests/"+id)
	j := cli.JMap{
		"id":    resp.Header.Get("x-guest-job-id"),
		"guest": guest,
	}
	return j
}
示例#3
0
文件: main.go 项目: joshie/lochness
func createGuest(c *cli.Client, spec string) cli.JMap {
	guest, resp := c.Post("guest", "guests", spec)
	j := cli.JMap{
		"id":    resp.Header.Get("x-guest-job-id"),
		"guest": guest,
	}
	return j
}
示例#4
0
文件: main.go 项目: joshie/lochness
func getGuests(c *cli.Client) []cli.JMap {
	ret, _ := c.GetMany("guests", "guests")
	guests := make([]cli.JMap, len(ret))
	for i := range ret {
		guests[i] = ret[i]
	}
	return guests
}
示例#5
0
文件: main.go 项目: joshie/lochness
func getHVs(c *cli.Client) []cli.JMap {
	ret, _ := c.GetMany("hypervisors", "hypervisors")
	// wasteful you say?
	hvs := make([]cli.JMap, len(ret))
	for i := range ret {
		hvs[i] = ret[i]
	}
	return hvs
}
示例#6
0
文件: main.go 项目: joshie/lochness
func guestAction(c *cli.Client, id, action string) cli.JMap {
	guest, resp := c.Post("guest", fmt.Sprintf("guests/%s/%s", id, action), "")
	j := cli.JMap{
		"id":    resp.Header.Get("x-guest-job-id"),
		"guest": guest,
	}

	return j
}
示例#7
0
文件: main.go 项目: joshie/lochness
func modifyGuest(c *cli.Client, id string, spec string) cli.JMap {
	guest, _ := c.Patch("guest", "guests/"+id, spec)
	return guest
}
示例#8
0
文件: main.go 项目: joshie/lochness
func getGuest(c *cli.Client, id string) cli.JMap {
	guest, _ := c.Get("guest", "guests/"+id)
	return guest
}
示例#9
0
文件: main.go 项目: joshie/lochness
func modifyConfig(c *cli.Client, id string, spec string) cli.JMap {
	conf, _ := c.Patch("config", "hypervisors/"+id+"/config", spec)
	return conf
}
示例#10
0
文件: main.go 项目: joshie/lochness
func getHV(c *cli.Client, id string) cli.JMap {
	hv, _ := c.Get("hypervisor", "hypervisors/"+id)
	return hv
}
示例#11
0
文件: main.go 项目: joshie/lochness
func getGuests(c *cli.Client, id string) []string {
	hvs, _ := c.GetList("guests", "hypervisors/"+id+"/guests")
	return hvs
}
示例#12
0
文件: main.go 项目: joshie/lochness
func deleteSubnet(c *cli.Client, hv, subnet string) cli.JMap {
	sub, _ := c.Delete("subnet", "hypervisors/"+hv+"/subnets/"+subnet)
	return sub
}
示例#13
0
文件: main.go 项目: joshie/lochness
func deleteHV(c *cli.Client, id string) cli.JMap {
	hv, _ := c.Delete("hypervisor", "hypervisors/"+id)
	return hv
}
示例#14
0
文件: main.go 项目: joshie/lochness
func modifySubnets(c *cli.Client, id string, spec string) cli.JMap {
	subnets, _ := c.Patch("subnets", "hypervisors/"+id+"/subnets", spec)
	return subnets
}
示例#15
0
文件: main.go 项目: joshie/lochness
func createHV(c *cli.Client, spec string) cli.JMap {
	hv, _ := c.Post("hypervisor", "hypervisors", spec)
	return hv
}
示例#16
0
文件: main.go 项目: joshie/lochness
func getJob(c *cli.Client, id string) cli.JMap {
	job, _ := c.Get("job", "jobs/"+id)
	return job
}
示例#17
0
文件: main.go 项目: joshie/lochness
func modifyHV(c *cli.Client, id string, spec string) cli.JMap {
	hv, _ := c.Patch("hypervisor", "hypervisors/"+id, spec)
	return hv
}