Java tutorial
/* * Copyright 2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.cloudfoundry.community.servicebroker.s3.config; import com.amazonaws.ClientConfiguration; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; /** * @author David Ehringer */ @Component @ConfigurationProperties public class AwsClientConfiguration { private String awsAccessKey; private String awsSecretKey; private String proxyHost; private String proxyPort; private String proxyUsername; private String proxyPassword; private Boolean preemptiveBasicProxyAuth; public ClientConfiguration toClientConfiguration() { ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setProxyHost(proxyHost); if (proxyPort != null) { clientConfiguration.setProxyPort(Integer.parseInt(proxyPort)); } clientConfiguration.setProxyUsername(proxyUsername); clientConfiguration.setProxyPassword(proxyPassword); if (preemptiveBasicProxyAuth != null) { clientConfiguration.setPreemptiveBasicProxyAuth(preemptiveBasicProxyAuth); } return clientConfiguration; } public String getAwsAccessKey() { return awsAccessKey; } public void setAwsAccessKey(String awsAccessKey) { this.awsAccessKey = awsAccessKey; } public String getAwsSecretKey() { return awsSecretKey; } public void setAwsSecretKey(String awsSecretKey) { this.awsSecretKey = awsSecretKey; } public String getProxyHost() { return proxyHost; } public void setProxyHost(String proxyHost) { this.proxyHost = proxyHost; } public String getProxyUsername() { return proxyUsername; } public void setProxyUsername(String proxyUsername) { this.proxyUsername = proxyUsername; } public String getProxyPassword() { return proxyPassword; } public void setProxyPassword(String proxyPassword) { this.proxyPassword = proxyPassword; } public Boolean getPreemptiveBasicProxyAuth() { return preemptiveBasicProxyAuth; } public void setPreemptiveBasicProxyAuth(Boolean preemptiveBasicProxyAuth) { this.preemptiveBasicProxyAuth = preemptiveBasicProxyAuth; } public void setProxyPort(String proxyPort) { this.proxyPort = proxyPort; } }