Search in sources :

Example 1 with PasswordCredentials

use of org.gradle.api.artifacts.repositories.PasswordCredentials in project gradle by gradle.

the class SftpConnectorFactory method createResourceConnector.

@Override
public ExternalResourceConnector createResourceConnector(ResourceConnectorSpecification connectionDetails) {
    PasswordCredentials passwordCredentials = connectionDetails.getCredentials(PasswordCredentials.class);
    SftpResourceAccessor accessor = new SftpResourceAccessor(sftpClientFactory, passwordCredentials);
    SftpResourceLister lister = new SftpResourceLister(sftpClientFactory, passwordCredentials);
    SftpResourceUploader uploader = new SftpResourceUploader(sftpClientFactory, passwordCredentials);
    return new DefaultExternalResourceConnector(accessor, lister, uploader);
}
Also used : PasswordCredentials(org.gradle.api.artifacts.repositories.PasswordCredentials) DefaultExternalResourceConnector(org.gradle.internal.resource.transfer.DefaultExternalResourceConnector)

Example 2 with PasswordCredentials

use of org.gradle.api.artifacts.repositories.PasswordCredentials in project gradle by gradle.

the class S3Client method createConnectionProperties.

private ClientConfiguration createConnectionProperties() {
    ClientConfiguration clientConfiguration = new ClientConfiguration();
    Optional<HttpProxySettings.HttpProxy> proxyOptional = s3ConnectionProperties.getProxy();
    if (proxyOptional.isPresent()) {
        HttpProxySettings.HttpProxy proxy = s3ConnectionProperties.getProxy().get();
        clientConfiguration.setProxyHost(proxy.host);
        clientConfiguration.setProxyPort(proxy.port);
        PasswordCredentials credentials = proxy.credentials;
        if (credentials != null) {
            clientConfiguration.setProxyUsername(credentials.getUsername());
            clientConfiguration.setProxyPassword(credentials.getPassword());
        }
    }
    Optional<Integer> maxErrorRetryCount = s3ConnectionProperties.getMaxErrorRetryCount();
    if (maxErrorRetryCount.isPresent()) {
        clientConfiguration.setMaxErrorRetry(maxErrorRetryCount.get());
    }
    return clientConfiguration;
}
Also used : PasswordCredentials(org.gradle.api.artifacts.repositories.PasswordCredentials) HttpProxySettings(org.gradle.internal.resource.transport.http.HttpProxySettings) ClientConfiguration(com.amazonaws.ClientConfiguration)

Aggregations

PasswordCredentials (org.gradle.api.artifacts.repositories.PasswordCredentials)2 ClientConfiguration (com.amazonaws.ClientConfiguration)1 DefaultExternalResourceConnector (org.gradle.internal.resource.transfer.DefaultExternalResourceConnector)1 HttpProxySettings (org.gradle.internal.resource.transport.http.HttpProxySettings)1