net.nemerosa.ontrack.extension.jenkins.client.DefaultJenkinsClientFactory.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ontrack-extension-jenkins Show documentation
Show all versions of ontrack-extension-jenkins Show documentation
Ontrack module: ontrack-extension-jenkins
package net.nemerosa.ontrack.extension.jenkins.client
import net.nemerosa.ontrack.extension.jenkins.JenkinsConfiguration
import net.nemerosa.ontrack.extension.jenkins.JenkinsConfigurationProperties
import org.springframework.boot.web.client.RestTemplateBuilder
import org.springframework.stereotype.Component
import java.time.Duration
@Component
class DefaultJenkinsClientFactory(
private val jenkinsConfigurationProperties: JenkinsConfigurationProperties,
) : JenkinsClientFactory {
override fun getClient(configuration: JenkinsConfiguration): JenkinsClient {
return DefaultJenkinsClient(
url = configuration.url,
client = RestTemplateBuilder()
.rootUri(configuration.url)
.basicAuthentication(configuration.user, configuration.password)
.setReadTimeout(Duration.ofSeconds(jenkinsConfigurationProperties.timeout.toLong()))
.build()
)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy