diff --git a/cmd/exec.go b/cmd/exec.go index b31c86a..6ca237a 100644 --- a/cmd/exec.go +++ b/cmd/exec.go @@ -68,19 +68,19 @@ var execCmd = &cobra.Command{ } func runExec(ctx context.Context, client *ecs.Client, region string, clusterId string, serviceId string, taskId string, containerId string, command string, interactive bool) error { - cluster, err := describeCluster(ctx, client, clusterId) + cluster, err := selectCluster(ctx, client, clusterId) if err != nil { return err } - service, err := describeService(ctx, client, *cluster.ClusterArn, serviceId) + service, err := selectService(ctx, client, *cluster.ClusterArn, serviceId) if err != nil { return err } - task, err := describeTask(ctx, client, *cluster.ClusterArn, *service.ServiceName, taskId) + task, err := selectTask(ctx, client, *cluster.ClusterArn, *service.ServiceName, taskId) if err != nil { return err } - container, err := describeContainer(task.Containers, containerId) + container, err := selectContainer(task.Containers, containerId) if err != nil { return err } @@ -125,7 +125,7 @@ func runExec(ctx context.Context, client *ecs.Client, region string, clusterId s return smp.Run() } -func describeContainer(containers []types.Container, containerId string) (*types.Container, error) { +func selectContainer(containers []types.Container, containerId string) (*types.Container, error) { if containerId == "" { var containerNames []string for _, container := range containers { diff --git a/cmd/logs.go b/cmd/logs.go index 54c12b1..71e2bc6 100644 --- a/cmd/logs.go +++ b/cmd/logs.go @@ -55,15 +55,15 @@ var logsCmd = &cobra.Command{ } func runLogs(ctx context.Context, ecsClient *ecs.Client, cwlogsClient *cloudwatchlogs.Client, clusterId string, serviceId string, taskId string, containerId string) error { - cluster, err := describeCluster(ctx, ecsClient, clusterId) + cluster, err := selectCluster(ctx, ecsClient, clusterId) if err != nil { return err } - service, err := describeService(ctx, ecsClient, *cluster.ClusterArn, serviceId) + service, err := selectService(ctx, ecsClient, *cluster.ClusterArn, serviceId) if err != nil { return err } - container, err := describeContainerDefinition(context.TODO(), ecsClient, *service.TaskDefinition, containerId) + container, err := selectContainerDefinition(context.TODO(), ecsClient, *service.TaskDefinition, containerId) if err != nil { return err } @@ -108,7 +108,7 @@ func runLogs(ctx context.Context, ecsClient *ecs.Client, cwlogsClient *cloudwatc return nil } -func describeContainerDefinition(ctx context.Context, client *ecs.Client, taskDefinitionArn string, containerId string) (*ecsTypes.ContainerDefinition, error) { +func selectContainerDefinition(ctx context.Context, client *ecs.Client, taskDefinitionArn string, containerId string) (*ecsTypes.ContainerDefinition, error) { describeTaskDefinition, err := client.DescribeTaskDefinition(ctx, &ecs.DescribeTaskDefinitionInput{ TaskDefinition: &taskDefinitionArn, }) diff --git a/cmd/root.go b/cmd/root.go index 19aee66..7c2a594 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -32,7 +32,7 @@ func Execute() { } } -func describeCluster(ctx context.Context, client *ecs.Client, clusterId string) (*types.Cluster, error) { +func selectCluster(ctx context.Context, client *ecs.Client, clusterId string) (*types.Cluster, error) { if clusterId == "" { listClusters, err := client.ListClusters(ctx, &ecs.ListClustersInput{}) if err != nil { @@ -56,7 +56,7 @@ func describeCluster(ctx context.Context, client *ecs.Client, clusterId string) return nil, fmt.Errorf("no cluster '%v' found", clusterId) } -func describeService(ctx context.Context, client *ecs.Client, clusterId string, serviceId string) (*types.Service, error) { +func selectService(ctx context.Context, client *ecs.Client, clusterId string, serviceId string) (*types.Service, error) { if serviceId == "" { listServices, err := client.ListServices(ctx, &ecs.ListServicesInput{ Cluster: &clusterId, @@ -83,7 +83,7 @@ func describeService(ctx context.Context, client *ecs.Client, clusterId string, return nil, fmt.Errorf("no service '%v' found", serviceId) } -func describeTask(ctx context.Context, client *ecs.Client, clusterId string, serviceId string, taskId string) (*types.Task, error) { +func selectTask(ctx context.Context, client *ecs.Client, clusterId string, serviceId string, taskId string) (*types.Task, error) { if taskId == "" { listTasks, err := client.ListTasks(ctx, &ecs.ListTasksInput{ Cluster: &clusterId,