diff --git a/internal/app.go b/internal/app.go index bac4a48..46ad4aa 100644 --- a/internal/app.go +++ b/internal/app.go @@ -9,11 +9,16 @@ import ( "strings" "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/ec2" "github.com/aws/aws-sdk-go-v2/service/ecs" ecsTypes "github.com/aws/aws-sdk-go-v2/service/ecs/types" "github.com/spf13/viper" ) +type EC2Client interface { + DescribeInstances(ctx context.Context, params *ec2.DescribeInstancesInput, optFns ...func(*ec2.Options)) (*ec2.DescribeInstancesOutput, error) +} + type ECSClient interface { ListClusters(ctx context.Context, params *ecs.ListClustersInput, optFns ...func(*ecs.Options)) (*ecs.ListClustersOutput, error) ListServices(ctx context.Context, params *ecs.ListServicesInput, optFns ...func(*ecs.Options)) (*ecs.ListServicesOutput, error) diff --git a/internal/internal.go b/internal/internal.go index 4017dfc..d12a3ed 100644 --- a/internal/internal.go +++ b/internal/internal.go @@ -115,7 +115,7 @@ func getPlatformFamily(client ECSClient, clusterName string, task *ecsTypes.Task // getContainerInstanceOS describes the specified container instance and checks against the backing EC2 instance // to determine the platform. -func getContainerInstanceOS(ecsClient ECSClient, ec2Client *ec2.Client, cluster string, containerInstanceArn string) (string, error) { +func getContainerInstanceOS(ecsClient ECSClient, ec2Client EC2Client, cluster string, containerInstanceArn string) (string, error) { res, err := ecsClient.DescribeContainerInstances(context.TODO(), &ecs.DescribeContainerInstancesInput{ Cluster: aws.String(cluster), ContainerInstances: []string{