예제 #1
0
func CmdRemove(c *cli.Context) {

	manage_request, err := util.BindManageParameter(c)
	data, err := json.Marshal(manage_request)
	if err != nil {
		log.Fatalf(err.Error())
	}

	resp, err := util.RequestToManageAPI(c.String("endpoint"), "/manage/remove", data)
	if err != nil && resp == nil {
		log.Fatalf(err.Error())
	}
	if resp.StatusCode != http.StatusOK {
		log.Fatalf("Failed!")
	}
	log.Printf("Success.")
}
예제 #2
0
// Check host database
func CmdIs_added(c *cli.Context) {

	manage_request, err := util.BindManageParameter(c)
	data, err := json.Marshal(manage_request)
	if err != nil {
		log.Fatalf(err.Error())
	}

	resp, err := util.RequestToManageAPI(c.String("endpoint"), "/manage/is_added", data)
	if err != nil && resp == nil {
		log.Fatalf(err.Error())
	}
	if resp.StatusCode == http.StatusNotFound {
		log.Printf("Not found.")
		os.Exit(1)
	} else if resp.StatusCode == http.StatusFound {
		log.Printf("Found.")
		os.Exit(0)
	}
	log.Printf("Unknown Status")
	os.Exit(2)
}