Example #1
0
func Show(c *gin.Context) {
	identifier := c.Param("identifier")
	var service interface{}

	if identifier != "" {
		service, _ = services.GetService(identifier)
	} else {
		c.String(404, "Service not found.")
	}

	c.JSON(200, service)
}
Example #2
0
func RescheduleCheck(c *gin.Context) {
	identifier := c.Param("identifier")
	var result string

	if identifier != "" {
		service, _ := services.GetService(identifier)
		service.Reschedule()
		result = "Command sent"
	} else {
		result = "No identifier specified."
	}

	c.JSON(200, gin.H{
		"result": result,
	})
}
Example #3
0
func Update(c *gin.Context) {
	identifier := c.Param("identifier")
	var result string
	if identifier != "" {
		service, _ := services.GetService(identifier)

		err := services.UpdateService(service)
		if err != nil {
			result = "Could not update service."
			log.Error(result, identifier)
		}

	} else {
		result = "No parameter to update!"
	}
	c.JSON(200, gin.H{
		"result": result,
	})
}