/** * Construct a synchronous implementation of AmazonSNS using the current builder configuration. * * @param params * Current builder configuration represented as a parameter object. * @return Fully configured implementation of AmazonSNS. */ @Override protected AmazonSNS build(AwsSyncClientParams params) { return new AmazonSNSClient(params); }
public JobStatusMonitor(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration) { sqs = new AmazonSQSClient(credentialsProvider, clientConfiguration); sns = new AmazonSNSClient(credentialsProvider, clientConfiguration); setupQueueAndTopic(); }
/** * Create client using aws credentials provider. This is the preferred way for creating clients */ @Override protected AmazonSNSClient createClient(final ProcessContext context, final AWSCredentialsProvider credentialsProvider, final ClientConfiguration config) { getLogger().info("Creating client using aws credentials provider"); return new AmazonSNSClient(credentialsProvider, config); }
/** * Create client using AWSCredentials * * @deprecated use {@link #createClient(ProcessContext, AWSCredentialsProvider, ClientConfiguration)} instead */ @Override protected AmazonSNSClient createClient(final ProcessContext context, final AWSCredentials credentials, final ClientConfiguration config) { getLogger().info("Creating client using aws credentials"); return new AmazonSNSClient(credentials, config); } }
/** * The Synchronous SNS client is used for creating topics and subscribing queues. */ private AmazonSNSClient createSNSClient( final Region region ) { final UsergridAwsCredentialsProvider ugProvider = new UsergridAwsCredentialsProvider(); final AmazonSNSClient sns = new AmazonSNSClient( ugProvider.getCredentials(), clientConfiguration ); sns.setRegion( region ); return sns; }
public AmazonSNSClient newInstance() { return new AmazonSNSClient(); } }
public AmazonSNSClient newInstance() { return new AmazonSNSClient(); } }
/** * If SNS notifications are desired and no existing client has been created elsewhere * in the application create a default client here. * * @return The configured SNS client */ //TODO: See what spring-cloud-aws would provide automatically... @Bean @ConditionalOnMissingBean(AmazonSNS.class) public AmazonSNS amazonSNS() { return new AmazonSNSClient(DefaultAWSCredentialsProviderChain.getInstance()); }
@Provides @Singleton protected AmazonSNS provideAmazonSNS(Region region, AWSCredentialsProvider credentialsProvider) { AmazonSNS amazonSNS = new AmazonSNSClient(credentialsProvider); amazonSNS.setRegion(region); return amazonSNS; }
/** * Create client using AWSCredentials * * @deprecated use {@link #createClient(ProcessContext, AWSCredentialsProvider, ClientConfiguration)} instead */ @Override protected AmazonSNSClient createClient(final ProcessContext context, final AWSCredentials credentials, final ClientConfiguration config) { getLogger().info("Creating client using aws credentials"); return new AmazonSNSClient(credentials, config); } }
public JobStatusMonitor(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration) { sqs = new AmazonSQSClient(credentialsProvider, clientConfiguration); sns = new AmazonSNSClient(credentialsProvider, clientConfiguration); setupQueueAndTopic(); }
/** * Create client using aws credentials provider. This is the preferred way for creating clients */ @Override protected AmazonSNSClient createClient(final ProcessContext context, final AWSCredentialsProvider credentialsProvider, final ClientConfiguration config) { getLogger().info("Creating client using aws credentials provider"); return new AmazonSNSClient(credentialsProvider, config); }
snsClient = new AmazonSNSClient(new BasicAWSCredentials(awsAccessKey, awsSecretKey));
public void download(String vaultName, String archiveId, String downloadFilePath) { String msg = "Downloading " + archiveId + " from Glacier vault " + vaultName; System.out.println(msg); sqsClient = new AmazonSQSClient(credentials); sqsClient.setEndpoint("https://sqs." + region + ".amazonaws.com"); snsClient = new AmazonSNSClient(credentials); snsClient.setEndpoint("https://sns." + region + ".amazonaws.com"); try { ArchiveTransferManager atm = new ArchiveTransferManager(client, sqsClient, snsClient); atm.download(vaultName, archiveId, new File(downloadFilePath)); } catch (Exception e) { throw new RuntimeException("Error " + msg, e); } }
/** * Construct a service implementation that talks to the specified AWS * region. The low-level client will be created via the default no-arg * constructor, which means it will have all the default client * configurations and it will use the default provider chain to retrieve AWS * credentials. If you need more flexible control over the low-level client, * use {@link #SNSImpl(AmazonSNS)} instead. * * @param region The AWS region where the service API calls will be sent to. */ public SNSImpl(Regions region) { this(new AmazonSNSClient()); this.client().setRegion(Region.getRegion(region)); }
/** * Construct a service implementation that talks to the specified AWS * region. The low-level client will be created via the default no-arg * constructor, which means it will have all the default client * configurations and it will use the default provider chain to retrieve AWS * credentials. If you need more flexible control over the low-level client, * use {@link #SNSImpl(AmazonSNS)} instead. * * @param region The AWS region where the service API calls will be sent to. */ public SNSImpl(Regions region) { this(new AmazonSNSClient()); this.client().setRegion(Region.getRegion(region)); }
public AmazonAwsSQSConnector(String awsAccessKey, String awsSecretKey, boolean isSecure, long receiveCheckIntervalMs, boolean isAsync) { super(receiveCheckIntervalMs, isAsync); AWSCredentials awsCredentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey); ClientConfiguration clientConfiguration = new ClientConfiguration(); String proxyHost = System.getProperty("http.proxyHost"); String proxyPort = System.getProperty("http.proxyPort"); if(proxyHost != null){ clientConfiguration.setProxyHost(proxyHost); if(proxyPort != null){ clientConfiguration.setProxyPort(Integer.parseInt(proxyPort)); } } clientConfiguration.setProtocol(isSecure ? Protocol.HTTPS : Protocol.HTTP); if (isAsync) { ExecutorService executorService = Executors.newSingleThreadExecutor(); _amazonSQS = new AmazonSQSAsyncClient(awsCredentials, clientConfiguration, executorService); _amazonSNS = new AmazonSNSAsyncClient(awsCredentials, clientConfiguration, executorService); } else { _amazonSQS = new AmazonSQSClient(awsCredentials, clientConfiguration); _amazonSNS = new AmazonSNSClient(awsCredentials, clientConfiguration); } }
public void inventory(String vaultName, String snsTopicName, String sqsQueueName, String fileName) { String msg = "Requesting inventory from Glacier vault " + vaultName + ". It might take around 4 hours."; System.out.println(msg); sqsClient = new AmazonSQSClient(credentials); sqsClient.setEndpoint("https://sqs." + region + ".amazonaws.com"); snsClient = new AmazonSNSClient(credentials); snsClient.setEndpoint("https://sns." + region + ".amazonaws.com"); try { QueueConfig config = setupSQS(sqsQueueName); config = setupSNS(config, snsTopicName); String jobId = initiateJobRequest(vaultName, config.snsTopicARN); System.out.println("Jobid = " + jobId); Boolean success = waitForJobToComplete(jobId, config.sqsQueueURL); if (!success) { throw new Exception("Job did not complete successfully."); } downloadJobOutput(vaultName, jobId, fileName); cleanUp(config); } catch (Exception e) { System.err.println("Archive retrieval failed."); System.err.println(e); } }
s3.setRegion(euCentral); snsClient = new AmazonSNSClient(credentials); snsClient.setRegion(Region.getRegion(Regions.EU_WEST_1));
public StreamMonitor(AutoscalingConfiguration config) throws Exception { this.config = config; Region setRegion = Region.getRegion(Regions.fromName(this.config.getRegion())); this.scaler = new StreamScaler(setRegion); this.cloudWatchClient = new AmazonCloudWatchClient(new DefaultAWSCredentialsProviderChain()); this.cloudWatchClient.setRegion(setRegion); this.kinesisClient = new AmazonKinesisClient(new DefaultAWSCredentialsProviderChain()); this.kinesisClient.setRegion(setRegion); this.snsClient = new AmazonSNSClient(new DefaultAWSCredentialsProviderChain()); this.snsClient.setRegion(setRegion); }