func TaskFromACS(acsTask *ecsacs.Task, envelope *ecsacs.PayloadMessage) (*Task, error) {
	data, err := jsonutil.BuildJSON(acsTask)
	if err != nil {
		return nil, err
	}
	task := &Task{}
	err = json.Unmarshal(data, task)
	if err != nil {
		return nil, err
	}
	if task.GetDesiredStatus() == apitaskstatus.TaskRunning && envelope.SeqNum != nil {
		task.StartSequenceNumber = *envelope.SeqNum
	} else if task.GetDesiredStatus() == apitaskstatus.TaskStopped && envelope.SeqNum != nil {
		task.StopSequenceNumber = *envelope.SeqNum
	}

	// Overrides the container command if it's set
	for _, container := range task.Containers {
		if (container.Overrides != apicontainer.ContainerOverrides{}) && container.Overrides.Command != nil {
			container.Command = *container.Overrides.Command
		}
		container.TransitionDependenciesMap = make(map[apicontainerstatus.ContainerStatus]apicontainer.TransitionDependencySet)
	}
	// initialize resources map for task
	task.ResourcesMapUnsafe = make(map[string][]taskresource.TaskResource)
	return task, nil
}
func TaskFromACS(acsTask *ecsacs.Task, envelope *ecsacs.PayloadMessage) (*Task, error) {
	data, err := jsonutil.BuildJSON(acsTask)
	if err != nil {
		return nil, err
	}
	task := &Task{}
	err = json.Unmarshal(data, task)
	if err != nil {
		return nil, err
	}
	if task.GetDesiredStatus() == apitaskstatus.TaskRunning && envelope.SeqNum != nil {
		task.StartSequenceNumber = *envelope.SeqNum
	} else if task.GetDesiredStatus() == apitaskstatus.TaskStopped && envelope.SeqNum != nil {
		task.StopSequenceNumber = *envelope.SeqNum
	}

	
	for _, container := range task.Containers {
		if (container.Overrides != apicontainer.ContainerOverrides{}) && container.Overrides.Command != nil {
			container.Command = *container.Overrides.Command
		}
		container.TransitionDependenciesMap = make(map[apicontainerstatus.ContainerStatus]apicontainer.TransitionDependencySet)
	}
	
	task.ResourcesMapUnsafe = make(map[string][]taskresource.TaskResource)
	return task, nil
}
func TaskFromACS ( acsTask * ecsacs . Task , envelope * ecsacs . PayloadMessage ) ( * Task , error ) { data , err := jsonutil . BuildJSON ( acsTask ) if err != nil { return nil , err } task := & Task { } err = json . Unmarshal ( data , task ) if err != nil { return nil , err } if task . GetDesiredStatus ( ) == apitaskstatus . TaskRunning && envelope . SeqNum != nil { task . StartSequenceNumber = * envelope . SeqNum } else if task . GetDesiredStatus ( ) == apitaskstatus . TaskStopped && envelope . SeqNum != nil { task . StopSequenceNumber = * envelope . SeqNum } // Overrides the container command if it's set for _ , container := range task . Containers { if ( container . Overrides != apicontainer . ContainerOverrides { } ) && container . Overrides . Command != nil { container . Command = * container . Overrides . Command } container . TransitionDependenciesMap = make ( map [ apicontainerstatus . ContainerStatus ] apicontainer . TransitionDependencySet ) } // initialize resources map for task task . ResourcesMapUnsafe = make ( map [ string ] [ ] taskresource . TaskResource ) return task , nil }
// TaskFromACS translates ecsacs.Task to apitask.Task by first marshaling the received
// ecsacs.Task to json and unmarshaling it as apitask.Task
TaskFromACS translates ecsacs . Task to apitask . Task by first marshaling the received ecsacs . Task to json and unmarshaling it as apitask . Task