Ejemplo n.º 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))
}
Ejemplo n.º 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()
}