override fun getParametersProcessor()

in google-storage-server/src/main/kotlin/jetbrains/buildServer/serverSide/artifacts/google/GoogleStorageType.kt [25:51]


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

            GoogleConstants.PARAM_ACCESS_KEY.apply {
                if (it[GoogleConstants.CREDENTIALS_TYPE] != GoogleConstants.CREDENTIALS_ENVIRONMENT &&
                        it[this].isNullOrEmpty()) {
                    invalidProperties.add(InvalidProperty(this, EMPTY_VALUE))
                } else {
                    try {
                        GoogleUtils.getStorage(it)
                    } catch (e: Throwable) {
                        val message = GoogleUtils.getExceptionMessage(e)
                        invalidProperties.add(InvalidProperty(this, message))
                    }
                }
            }

            GoogleConstants.PARAM_BUCKET_NAME.apply {
                if (it[this].isNullOrEmpty()) {
                    invalidProperties.add(InvalidProperty(this, EMPTY_VALUE))
                }
            }

            invalidProperties
        }
    }