Exemple #1
0
func (this *DeviceController) GetDeviceIP() {
	id := this.Ctx.Input.Param(":id")
	_, ip, err := master.GetDevice(id)
	if err != nil {
		this.Ctx.Output.SetStatus(404)
		this.Ctx.Output.Body([]byte("Device not found"))
		return
	}
	this.Ctx.Output.Body([]byte(ip))
}
Exemple #2
0
func (this *DeviceController) GetDevice() {
	id := this.Ctx.Input.Param(":id")
	device, _, err := master.GetDevice(id)
	if err != nil {
		this.Ctx.Output.SetStatus(404)
		this.Ctx.Output.Body([]byte("Device not found"))
		return
	}
	this.Data["json"] = device
	this.ServeJSON()
}