in aws-ecs-server/src/main/kotlin/jetbrains/buildServer/clouds/ecs/web/EcsProfileEditController.kt [41:61]
override fun doPost(request: HttpServletRequest, response: HttpServletResponse, xmlResponse: Element) {
if (request.getParameter("testConnection").toBoolean()){
val propsBean = BasePropertiesBean(null)
PluginPropertiesUtil.bindPropertiesFromRequest(request, propsBean, true)
val props = propsBean.properties
try {
val api = EcsApiConnectorImpl(props.toAwsCredentialsProvider(), AWSCommonParams.getRegionName(props))
val testConnectionResult = api.testConnection()
if (!testConnectionResult.success) {
val errors = ActionErrors()
errors.addError("connection", testConnectionResult.message)
writeErrors(xmlResponse, errors)
}
} catch (ex: Exception){
LOG.debug(ex)
val errors = ActionErrors()
errors.addError("connection", ex.message)
writeErrors(xmlResponse, errors)
}
}
}