// SetTaskList sets the TaskList field's value.
439698
func (s *StartChildWorkflowExecutionDecisionAttributes) SetTaskList(v *TaskList) *StartChildWorkflowExecutionDecisionAttributes {
	s.TaskList = v
	return s
}
136138
func (s *StartChildWorkflowExecutionInitiatedEventAttributes) SetTaskList(v *TaskList) *StartChildWorkflowExecutionInitiatedEventAttributes {
	s.TaskList = v
	return s
}
603886
func (s *ListTagsForResourceOutput) SetTagList(v []*Tag) *ListTagsForResourceOutput {
	s.TagList = v
	return s
}
648699
func (s *WorkflowExecutionContinuedAsNewEventAttributes) SetTaskList(v *TaskList) *WorkflowExecutionContinuedAsNewEventAttributes {
	s.TaskList = v
	return s
}
154454
func (s *DescribeAuditTaskOutput) SetTaskStatus(v string) *DescribeAuditTaskOutput {
	s.TaskStatus = &v
	return s
}
75381
func (s *DecisionTaskScheduledEventAttributes) SetTaskList(v *TaskList) *DecisionTaskScheduledEventAttributes {
	s.TaskList = v
	return s
}
278540
func (s *WorkflowTypeConfiguration) SetDefaultTaskList(v *TaskList) *WorkflowTypeConfiguration {
	s.DefaultTaskList = v
	return s
}
980404
func (f *HostPortFilter) SetTask(t *api.Task) bool {
	if t.Endpoint != nil {
		for _, port := range t.Endpoint.Ports {
			if port.PublishMode == api.PublishModeHost && port.PublishedPort != 0 {
				f.t = t
				return true
			}
		}
	}

	return false
}
343512
func (s *HumanTaskConfig) SetTaskDescription(v string) *HumanTaskConfig {
	s.TaskDescription = &v
	return s
}
491870
func (s *UpdateMaintenanceWindowTaskOutput) SetTaskParameters(v map[string]*MaintenanceWindowTaskParameterValueExpression) *UpdateMaintenanceWindowTaskOutput {
	s.TaskParameters = v
	return s
}
775677
func (s *DescribeMaintenanceWindowTasksOutput) SetTasks(v []*MaintenanceWindowTask) *DescribeMaintenanceWindowTasksOutput {
	s.Tasks = v
	return s
}
96289
func TaskList(args *model.TaskListArgs) (infos []*model.TaskInfo, totalCount int, err error) {
	err = mgr.Do(func(ctx context.Context, cli *client.Client) (err error) {
		var (
			tasks []swarm.Task
			opts  = types.TaskListOptions{
				Filters: filters.NewArgs(),
			}
		)

		if args.PageIndex < 1 {
			args.PageIndex = 1
		}
		if args.PageSize < 1 {
			args.PageSize = math.MaxInt32
		}
		if args.Service != "" {
			opts.Filters.Add("service", args.Service)
		}
		if args.Node != "" {
			opts.Filters.Add("node", args.Node)
		}
		if args.Name != "" {
			opts.Filters.Add("name", args.Name)
		}
		if args.State != "" {
			opts.Filters.Add("desired-state", args.State)
		}

		tasks, err = cli.TaskList(ctx, opts)
		totalCount = len(tasks)
		if err == nil && totalCount > 0 {
			sort.Slice(tasks, func(i, j int) bool {
				return tasks[i].UpdatedAt.After(tasks[j].UpdatedAt)
			})
			start, end := misc.Page(totalCount, args.PageIndex, args.PageSize)
			tasks = tasks[start:end]

			nodes := make(map[string]string)
			for _, t := range tasks {
				if _, ok := nodes[t.NodeID]; !ok {
					if n, _, e := cli.NodeInspectWithRaw(ctx, t.NodeID); e == nil {
						if n.Spec.Name == "" {
							nodes[t.NodeID] = n.Description.Hostname
						} else {
							nodes[t.NodeID] = n.Spec.Name
						}
					} else {
						nodes[t.NodeID] = ""
					}
				}
			}

			infos = make([]*model.TaskInfo, len(tasks))
			for i, t := range tasks {
				infos[i] = model.NewTaskInfo(t, nodes[t.NodeID])
			}
		}
		return
	})
	return
}
441862
func (s *GetMaintenanceWindowTaskOutput) SetTaskType(v string) *GetMaintenanceWindowTaskOutput {
	s.TaskType = &v
	return s
}
556479
func (s *ListAuditTasksInput) SetTaskType(v string) *ListAuditTasksInput {
	s.TaskType = &v
	return s
}
147687
func (s *SynthesisTask) SetTaskStatus(v string) *SynthesisTask {
	s.TaskStatus = &v
	return s
}
1056148
func (s *UpdateServicePrimaryTaskSetOutput) SetTaskSet(v *TaskSet) *UpdateServicePrimaryTaskSetOutput {
	s.TaskSet = v
	return s
}
198709
func (s *WorkflowExecutionInfo) SetTagList(v []*string) *WorkflowExecutionInfo {
	s.TagList = v
	return s
}