override fun downloadVersion()

in jetbrains-core/src/software/aws/toolkits/jetbrains/services/ssm/SsmPlugin.kt [41:59]


    override fun downloadVersion(version: FourPartVersion, destinationDir: Path, indicator: ProgressIndicator?): Path {
        // TODO: Move to CpuArch, FIX_WHEN_MIN_IS_211
        val downloadUrl = when {
            SystemInfo.isWindows -> windowsUrl(version)
            SystemInfo.isMac -> macUrl(version)
            SystemInfo.isLinux && hasDpkg && isArm64() -> ubuntuArm64Url(version)
            SystemInfo.isLinux && hasDpkg && isIntel64() -> ubuntuI64Url(version)
            SystemInfo.isLinux && hasRpm2Cpio && isArm64() -> linuxArm64Url(version)
            SystemInfo.isLinux && hasRpm2Cpio && isIntel64() -> linuxI64Url(version)
            else -> throw IllegalStateException("Failed to find compatible SSM plugin: SystemInfo=${SystemInfo.OS_NAME}, Arch=${SystemInfo.OS_ARCH}")
        }

        val fileName = downloadUrl.substringAfterLast("/")
        val destination = destinationDir.resolve(fileName)

        saveFileFromUrl(downloadUrl, destination, indicator)

        return destination
    }