Skip to content

Commit c18703e

Browse files
committed
Extract task ID from ARN in listTasks
1 parent 946cbd0 commit c18703e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/ecs/list.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ func listTasks(ctx context.Context, svc *ecs.Client, cluster string, service str
7474
runningTime = "Unknown"
7575
}
7676

77+
taskID := extractLastPart(*task.TaskArn)
78+
7779
output = append(output, fmt.Sprintf(
7880
"%s: %s (Cpu) / %s (Memory) (Running for: %s)",
79-
*task.TaskArn,
81+
taskID,
8082
*task.Cpu,
8183
*task.Memory,
8284
runningTime,

pkg/ecs/utils.go

+6
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ func extractProcessID(taskArn string) string {
1010

1111
return taskArn
1212
}
13+
14+
func extractLastPart(arn string) string {
15+
parts := strings.Split(arn, "/")
16+
17+
return parts[len(parts)-1]
18+
}

0 commit comments

Comments
 (0)