in pkg/selector/outputs/outputs.go [199:253]
func getWideColumnsData(instanceTypes []*instancetypes.Details) []*wideColumnsData {
columnsData := []*wideColumnsData{}
for _, instanceType := range instanceTypes {
none := "none"
cpuArchitectures := []string{}
for _, cpuArch := range instanceType.ProcessorInfo.SupportedArchitectures {
cpuArchitectures = append(cpuArchitectures, string(cpuArch))
}
gpus := int32(0)
gpuMemory := int32(0)
gpuType := []string{}
if instanceType.GpuInfo != nil {
gpuMemory = *instanceType.GpuInfo.TotalGpuMemoryInMiB
for _, gpuInfo := range instanceType.GpuInfo.Gpus {
gpus = gpus + *gpuInfo.Count
gpuType = append(gpuType, *gpuInfo.Manufacturer+" "+*gpuInfo.Name)
}
} else {
gpuType = append(gpuType, none)
}
onDemandPricePerHourStr := "-Not Fetched-"
spotPricePerHourStr := "-Not Fetched-"
if instanceType.OndemandPricePerHour != nil {
onDemandPricePerHourStr = "$" + formatFloat(*instanceType.OndemandPricePerHour)
}
if instanceType.SpotPrice != nil {
spotPricePerHourStr = "$" + formatFloat(*instanceType.SpotPrice)
}
newColumn := wideColumnsData{
instanceName: string(instanceType.InstanceType),
vcpu: *instanceType.VCpuInfo.DefaultVCpus,
memory: formatFloat(float64(*instanceType.MemoryInfo.SizeInMiB) / 1024.0),
hypervisor: string(instanceType.Hypervisor),
currentGen: *instanceType.CurrentGeneration,
hibernationSupport: *instanceType.HibernationSupported,
cpuArch: strings.Join(cpuArchitectures, ", "),
networkPerformance: *instanceType.NetworkInfo.NetworkPerformance,
eni: *instanceType.NetworkInfo.MaximumNetworkInterfaces,
gpu: gpus,
gpuMemory: formatFloat(float64(gpuMemory) / 1024.0),
gpuInfo: strings.Join(gpuType, ", "),
odPrice: onDemandPricePerHourStr,
spotPrice: spotPricePerHourStr,
}
columnsData = append(columnsData, &newColumn)
}
return columnsData
}