public AWSClients(String region, AWSCredentials credentials, String proxyHost, int proxyPort) { this.region = region; this.proxyHost = proxyHost; this.proxyPort = proxyPort; //setup proxy connection: ClientConfiguration clientCfg = new ClientConfiguration(); if (proxyHost != null && proxyPort > 0 ) { clientCfg.setProxyHost(proxyHost); clientCfg.setProxyPort(proxyPort); } this.s3 = credentials != null ? new AmazonS3Client(credentials, clientCfg) : new AmazonS3Client(clientCfg); this.codedeploy = credentials != null ? new AmazonCodeDeployClient(credentials, clientCfg) : new AmazonCodeDeployClient(clientCfg); codedeploy.setRegion(Region.getRegion(Regions.fromName(this.region))); s3.setRegion(Region.getRegion(Regions.fromName(this.region))); }
@Bean public AmazonCodeDeploy codeDeploy() { final AmazonCodeDeploy client = new AmazonCodeDeployClient(); client.setRegion(region); return client; }