func (at *AppType) UnmarshalJSON(data []byte) error {
	var s string
	if err := json.Unmarshal(data, &s); err != nil {
		return fmt.Errorf("app-type should be a string, got %s", data)
	}
	got, ok := map[string]AppType{
		"TestAppGo":              TestAppGo,
		"TestAppPerf":            TestAppPerf,
		"TestAppPktgen":          TestAppPktgen,
		"TestAppApacheBenchmark": TestAppApacheBenchmark,
		"TestAppLatency":         TestAppLatency,
		"TestAppWrkBenchmark":    TestAppWrkBenchmark,
	}[s]
	if !ok {
		return fmt.Errorf("invalid AppType %q", s)
	}
	*at = got
	return nil
}
UnmarshalJSON unmarshals data and checks app type validity.
package test
import (
	"encoding/json"
	"fmt"
)
type TestStatus int
const (
	TestCreated TestStatus = iota
	TestInitialized
	TestInvalid
	TestRunning
	TestReportedPassed
	TestReportedFailed
	TestTimedOut
	TestInterrupted
)
func (at *TestStatus) UnmarshalJSON(data []byte) error {
	var s string
	if err := json.Unmarshal(data, &s); err != nil {
		return fmt.Errorf("TestStatus should be a string, got %s", data)
	}
	got, ok := map[string]TestStatus{
		"TestCreated":        TestCreated,
		"TestInitialized":    TestInitialized,
		"TestInvalid":        TestInvalid,
		"TestRunning":        TestRunning,
		"TestReportedPassed": TestReportedPassed,
		"TestReportedFailed": TestReportedFailed,
		"TestTimedOut":       TestTimedOut,
		"TestInterrupted":    TestInterrupted,
	}[s]
	if !ok {
		return fmt.Errorf("invalid TestStatus %q", s)
	}
	*at = got
	return nil
}
type AppType int
const (
	TestAppGo AppType = iota
	TestAppPerf
	TestAppPktgen
	TestAppApacheBenchmark
	TestAppLatency
	TestAppWrkBenchmark
)