func verifyTaskMetadata(taskMetadataRawMsg json.RawMessage) error {
	taskMetadataMap := make(map[string]json.RawMessage)
	json.Unmarshal(taskMetadataRawMsg, &taskMetadataMap)

	if taskMetadataMap["Arn"] == nil {
		return notEmptyErrMsg("Arn")
	}

	if taskMetadataMap["DesiredStatus"] == nil {
		return notEmptyErrMsg("DesiredStatus")
	}

	if taskMetadataMap["KnownStatus"] == nil {
		return notEmptyErrMsg("KnownStatus")
	}

	if taskMetadataMap["Family"] == nil {
		return notEmptyErrMsg("Family")
	}

	if taskMetadataMap["Version"] == nil {
		return notEmptyErrMsg("Version")
	}

	if taskMetadataMap["Containers"] == nil {
		return notEmptyErrMsg("Containers")
	}

	var containersMetadataArray []json.RawMessage
	json.Unmarshal(taskMetadataMap["Containers"], &containersMetadataArray)
	if len(containersMetadataArray) != 1 {
		return fmt.Errorf("incorrect number of containers, expected 1, received %d",
			len(containersMetadataArray))
	}

	return verifyContainerMetadata(containersMetadataArray[0])
}
func verifyTaskMetadata(taskMetadataRawMsg json.RawMessage) error {
	taskMetadataMap := make(map[string]json.RawMessage)
	json.Unmarshal(taskMetadataRawMsg, &taskMetadataMap)

	if taskMetadataMap["Arn"] == nil {
		return notEmptyErrMsg("Arn")
	}

	if taskMetadataMap["DesiredStatus"] == nil {
		return notEmptyErrMsg("DesiredStatus")
	}

	if taskMetadataMap["KnownStatus"] == nil {
		return notEmptyErrMsg("KnownStatus")
	}

	if taskMetadataMap["Family"] == nil {
		return notEmptyErrMsg("Family")
	}

	if taskMetadataMap["Version"] == nil {
		return notEmptyErrMsg("Version")
	}

	if taskMetadataMap["Containers"] == nil {
		return notEmptyErrMsg("Containers")
	}

	var containersMetadataArray []json.RawMessage
	json.Unmarshal(taskMetadataMap["Containers"], &containersMetadataArray)
	if len(containersMetadataArray) != 1 {
		return fmt.Errorf("incorrect number of containers, expected 1, received %d",
			len(containersMetadataArray))
	}

	return verifyContainerMetadata(containersMetadataArray[0])
}
func verifyTaskMetadata ( taskMetadataRawMsg json . RawMessage ) error { taskMetadataMap := make ( map [ string ] json . RawMessage ) json . Unmarshal ( taskMetadataRawMsg , & taskMetadataMap ) if taskMetadataMap [ " " ] == nil { return notEmptyErrMsg ( " " ) } if taskMetadataMap [ " " ] == nil { return notEmptyErrMsg ( " " ) } if taskMetadataMap [ " " ] == nil { return notEmptyErrMsg ( " " ) } if taskMetadataMap [ " " ] == nil { return notEmptyErrMsg ( " " ) } if taskMetadataMap [ " " ] == nil { return notEmptyErrMsg ( " " ) } if taskMetadataMap [ " " ] == nil { return notEmptyErrMsg ( " " ) } var containersMetadataArray [ ] json . RawMessage json . Unmarshal ( taskMetadataMap [ " " ] , & containersMetadataArray ) if len ( containersMetadataArray ) != 1 { return fmt . Errorf ( " " , len ( containersMetadataArray ) ) } return verifyContainerMetadata ( containersMetadataArray [ 0 ] ) }
// verifyTaskMetadata verifies the number of containers in task metadata, make
// sure each necessary field is not empty, we cannot check the values of those fields
// since they are dynamic. It also verifies the container metadata.
verifyTaskMetadata verifies the number of containers in task metadata make sure each necessary field is not empty we cannot check the values of those fields since they are dynamic . It also verifies the container metadata .