func cliListTaskDefs(svc *ecs.ECS, args []string) ([]*string, error) { err := cliListTaskDefsParams(args).Parse(args) resp, err := ListTaskDefs(svc, cli.String(cliFamily), cli.String(cliStatus)) if err != nil { return nil, err } return resp.TaskDefinitionArns, nil }
func cliListTasks(svc *ecs.ECS, args []string) ([]*string, error) { err := cliListTasksParams(args).Parse(args) params := &ecs.ListTasksInput{ Cluster: &cliClusterName, ContainerInstance: cli.String(cliContainerInstance), DesiredStatus: cli.String(cliDesiredStatus), Family: cli.String(cliFamily), MaxResults: &cliMaxResults, ServiceName: cli.String(cliServiceName), } resp, err := ListTasks(svc, params) if err != nil { return nil, err } return resp.TaskArns, err }
func cliStopTask(svc *ecs.ECS, args []string) ([]*string, error) { err := cliStopTaskParams(args).Parse(args) resp, err := StopTask( svc, &cliTaskDef, cli.String(cliClusterName), ) if err != nil { return nil, err } return []*string{resp.Task.TaskArn, resp.Task.DesiredStatus, resp.Task.LastStatus}, nil }
func cliStartTask(svc *ecs.ECS, args []string) ([]*string, error) { err := cliStartTaskParams(args).Parse(args) resp, err := StartTask( svc, &cliTaskDef, aws.StringSlice(strings.Split(cliContainerInstance, ",")), cli.String(cliClusterName), cli.String(cliStartedby), nil, ) if err != nil { return nil, err } fail := cli.Failure(resp.Failures, err) if fail != nil { return nil, fail } var ret = make([]*string, len(resp.Tasks)) for k := range resp.Tasks { ret[k] = resp.Tasks[k].TaskArn } return ret, nil }
func cliStartWait(svc *ecs.ECS, args []string) ([]*string, error) { err := cliStartWaitParams(args).Parse(args) containerInstances := aws.StringSlice(strings.Split(cliContainerInstance, ",")) resp, err := StartWait( svc, &cliMaxTries, &cliTimeout, &cliTaskDef, containerInstances, cli.String(cliClusterName), cli.String(cliStartedby), nil, ) if err != nil { return nil, err } fail := cli.Failure(resp.Failures, err) if fail != nil { return nil, fail } var ret = make([]*string, len(resp.Tasks)) for k := range resp.Tasks { ret[k] = resp.Tasks[k].TaskArn } dns, dnserr := describeEc2Instances(svc, cli.String(cliClusterName), containerInstances) if dnserr != nil { return ret, dnserr } var result = make([]*string, len(ret)+len(dns.Reservations)) copy(result, ret) for _, r := range dns.Reservations { for i, v := range r.Instances { result[len(ret)+i] = v.PublicDnsName } } return result, nil }