Пример #1
0
func HandlePUTTags(w http.ResponseWriter, r *http.Request, context *ctp.ApiContext) {
	var res TaggedResource
	var update TaggedResource

	handler := ctp.NewPUTHandler(ctp.AdminRoleTag)

	handler.ShowTags = true

	handler.Handle(w, r, context, &res, &update)
}
Пример #2
0
func HandlePUTMeasurement(w http.ResponseWriter, r *http.Request, context *ctp.ApiContext) {
	var measurement Measurement
	var update Measurement
	var access ctp.Tags

	switch context.QueryParam {
	case "userActivated":
		access = ctp.UserRoleTag
	case "result":
		access = ctp.AgentRoleTag
	case "objective":
		access = ctp.AdminRoleTag
	}
	handler := ctp.NewPUTHandler(access)

	handler.Handle(w, r, context, &measurement, &update)
}