override fun getParametersProcessor()

in azure-storage-server/src/main/kotlin/jetbrains/buildServer/serverSide/artifacts/azure/AzureStorageType.kt [27:59]


    override fun getParametersProcessor(): PropertiesProcessor? {
        return PropertiesProcessor {
            val invalidProperties = arrayListOf<InvalidProperty>()
            val parameters = hashMapOf<String, String>()

            AzureConstants.PARAM_ACCOUNT_NAME.apply {
                if (it[this].isNullOrEmpty()) {
                    invalidProperties.add(InvalidProperty(this, EMPTY_VALUE))
                } else {
                    parameters[this] = it[this]!!
                }
            }

            AzureConstants.PARAM_ACCOUNT_KEY.apply {
                if (it[this].isNullOrEmpty()) {
                    invalidProperties.add(InvalidProperty(this, EMPTY_VALUE))
                } else {
                    parameters[this] = it[this]!!
                }
            }

            if (parameters.size == 2) {
                try {
                    AzureUtils.getBlobClient(parameters).downloadServiceProperties()
                } catch (e: Throwable) {
                    val message = AzureUtils.getExceptionMessage(e)
                    invalidProperties.add(InvalidProperty(AzureConstants.PARAM_ACCOUNT_KEY, message))
                }
            }

            invalidProperties
        }
    }