/** * @return Default client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and * {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain */ public static AmazonSNS defaultClient() { return standard().build(); }
@Inject public AWSSnsNotificationService( IConfiguration config, IAMCredential iamCredential, BackupMetrics backupMetrics, InstanceInfo instanceInfo) { this.configuration = config; this.backupMetrics = backupMetrics; String ec2_region = instanceInfo.getRegion(); snsClient = AmazonSNSClient.builder() .withCredentials(iamCredential.getAwsCredentialProvider()) .withRegion(ec2_region) .build(); }
private SqsSubscriberAdmin(Builder builder) { super(SqsSubscriberAdmin.class, builder); accountId_ = builder.accountId_; region_ = builder.region_; tags_ = ImmutableMap.copyOf(builder.tags_); sqsClient_ = builder.sqsBuilder_.build(); snsClient_ = builder.snsBuilder_.build(); log_.info("Starting SQSSubscriberAdmin in " + region_ + "..."); }
/** * Initializes client wrapper with the default SNS client. * * <p> * This is a simplified version for AWS internal services, like AWS Lambda, which relies on environment * permissions. * </p> * * @param objectMapper JSON handler. * @param topicArn SNS topic ARN. */ public TopicClient(ObjectMapper objectMapper, String topicArn) { this(AmazonSNSClientBuilder.standard().build(), objectMapper, topicArn); }
protected SnsPublisherBase(Class<T> type, Builder<?,T> builder) { super(type, builder); region_ = builder.region_; accountId_ = builder.accountId_; snsClient_ = builder.snsBuilder_.build(); subscriberAccountIds_ = ImmutableList.copyOf( builder.config_.getConfiguration("amazon").getListOfString("subscriberAccountIds", new ArrayList<>())); int errorCnt = 0; for(TopicName topicName : builder.topicNames_) { if(!validateTopic(topicName)) errorCnt++; } if(errorCnt > 0) { throw new IllegalStateException("There are " + errorCnt + " topic validation errors"); } for(TopicName topicName : builder.topicNames_) { publisherNameMap_.put(topicName, new SnsPublisher(topicName, getTopicARN(topicName), this)); } }
/** * Creates a client for accessing Amazon SNS. * * @param awsParamsDto the AWS related parameters DTO that includes optional proxy information * * @return the Amazon SNS client */ @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public AmazonSNS getAmazonSNSClient(AwsParamsDto awsParamsDto) { // Construct and return a new client to invoke service methods on Amazon SNS using default credentials provider chain. return AmazonSNSClientBuilder.standard().withClientConfiguration(awsHelper.getClientConfiguration(awsParamsDto)) .withRegion(awsParamsDto.getAwsRegionName()).build(); }
@Override public AmazonSNS createSnsPublisher() { return AmazonSNSClientBuilder.standard() .withCredentials(getCredentialsProvider()) .withRegion(region) .build(); } }
/** * Creates a client for accessing Amazon SNS. * * @param awsParamsDto the AWS related parameters DTO that includes optional proxy information * * @return the Amazon SNS client */ @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public AmazonSNS getAmazonSNSClient(AwsParamsDto awsParamsDto) { // Construct and return a new client to invoke service methods on Amazon SNS using default credentials provider chain. return AmazonSNSClientBuilder.standard().withClientConfiguration(awsHelper.getClientConfiguration(awsParamsDto)) .withRegion(awsParamsDto.getAwsRegionName()).build(); }
public static AmazonSNSClient createNotificationClient() { BasicCredentialsProvider credentials = BasicCredentialsProvider.standard(); AmazonSNSClient client = !credentials.isValid() ? null : (AmazonSNSClient) AmazonSNSClientBuilder.standard() .withCredentials(credentials) .withRegion("eu-west-1") .build(); return client; }
public static AmazonSNSClient createNotificationClient() { BasicCredentialsProvider credentials = BasicCredentialsProvider.standard(); AmazonSNSClient client = !credentials.isValid() ? null : (AmazonSNSClient) AmazonSNSClientBuilder.standard() .withCredentials(credentials) .withRegion("eu-west-1") .build(); return client; }
public AmazonSNS createSnsClient(String accessKey, String secretKey, String region) { String decryptedAccessKey = encryptionService.decrypt(accessKey, true); String decryptedSecretKey = encryptionService.decrypt(secretKey, true); BasicAWSCredentials credentials = new BasicAWSCredentials(decryptedAccessKey, decryptedSecretKey); AmazonSNS snsClient = AmazonSNSClientBuilder.standard().withRegion(Regions.fromName(region)).withCredentials(new AWSStaticCredentialsProvider(credentials)).build(); return snsClient; }
if(!skipRegions.contains(region.getName())){ List<Subscription> subscriptionList = new ArrayList<>(); snsClient = (AmazonSNSClient) AmazonSNSClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build(); String nextToken = null; ListSubscriptionsResult listSubscriptionDefinitionsResult;
.withClientConfiguration(new ClientConfiguration()) .withRegion(queueArn.getRegion()) .build(), AmazonSQSClientBuilder .standard()
.withCredentials(credentialsProvider) .withRegion(Regions.fromName(region)) .build();