示例#1
0
func prettyPrint(encrypted []byte, key string, label string) {
	var decrypted, err = decrypt(encrypted, key, label)

	if err != nil {
		return
	}

	var model1 models.DesiredLRPRunInfo
	err = model1.Unmarshal(decrypted)
	if err != nil {
		// NOP
	} else {
		pretty.Println(model1)
		return
	}

	var model2 models.DesiredLRPSchedulingInfo
	err = model2.Unmarshal(decrypted)
	if err != nil {
		// NOP
	} else {
		pretty.Println(model2)
		return
	}

	var model3 models.ActualLRP
	err = model3.Unmarshal(decrypted)
	if err != nil {
		// NOP
	} else {
		pretty.Println(model3)
		return
	}

	var model4 models.Task
	err = model4.Unmarshal(decrypted)
	if err != nil {
		// NOP
	} else {
		pretty.Println(model4)
		return
	}

	var model5 models.DesiredLRP
	err = model5.Unmarshal(decrypted)
	if err != nil {
		log.Println("Unknown data type: ", string(decrypted))
	} else {
		pretty.Println(model5)
		return
	}
}