本文整理汇总了Java中com.amazonaws.auth.DefaultAWSCredentialsProviderChain.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultAWSCredentialsProviderChain.getInstance方法的具体用法?Java DefaultAWSCredentialsProviderChain.getInstance怎么用?Java DefaultAWSCredentialsProviderChain.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.auth.DefaultAWSCredentialsProviderChain
的用法示例。
在下文中一共展示了DefaultAWSCredentialsProviderChain.getInstance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSQSAsync
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; //导入方法依赖的package包/类
@Override
public AmazonSQS createSQSAsync(final SQSQueue queue) {
AWSCredentialsProvider credentials = queue.hasCredentials() ? queue.lookupAwsCredentials() : DefaultAWSCredentialsProviderChain.getInstance();
AmazonSQSAsyncClientBuilder sqsAsyncBuilder = createStandardAsyncClientBuilder(queue, credentials);
final QueueBufferConfig queueBufferConfig = this.getQueueBufferConfig(queue);
final AmazonSQSBufferedAsyncClient sqsBufferedAsync = new AmazonSQSBufferedAsyncClient(sqsAsyncBuilder.build(), queueBufferConfig);
return sqsBufferedAsync;
}
示例2: LinkGeneratorLambdaHandler
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; //导入方法依赖的package包/类
@SuppressWarnings({"unused", "WeakerAccess"})
public LinkGeneratorLambdaHandler() throws IOException, TemplateException {
this(
getEnv("AUTH_REGION"),
getEnv("JWT_ENCRYPT_KEY_ARN"),
getEnv("PAGE_STORAGE_BUCKET"),
getEnv("AUTH_ENDPOINT_URL"),
DefaultAWSCredentialsProviderChain.getInstance(),
"intro.html.ftl");
}
示例3: amazonSNS
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; //导入方法依赖的package包/类
/**
* If SNS notifications are desired and no existing client has been created elsewhere
* in the application create a default client here.
* @param config The system configuration abstraction to use
* @param registry registry for spectator
* @return The configured SNS client
*/
//TODO: See what spring-cloud-aws would provide automatically...
@Bean
@ConditionalOnMissingBean(AmazonSNSAsync.class)
public AmazonSNSAsync amazonSNS(final Config config, final Registry registry) {
final ExecutorService executor = Executors.newFixedThreadPool(config.getSNSClientThreadCount(),
new ThreadFactoryBuilder().setNameFormat("metacat-sns-pool-%d").build());
RegistryUtil.registerThreadPool(registry, "metacat-sns-pool", (ThreadPoolExecutor) executor);
return new AmazonSNSAsyncClient(DefaultAWSCredentialsProviderChain.getInstance(), executor);
}
示例4: getAwsCredentialsProvider
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; //导入方法依赖的package包/类
private static AWSCredentialsProvider getAwsCredentialsProvider() {
DefaultAWSCredentialsProviderChain backingCredentialsProvider = DefaultAWSCredentialsProviderChain
.getInstance();
// Eagerly fetch credentials preventing lag during the first, actual login.
AWSCredentials firstAccess = backingCredentialsProvider.getCredentials();
AtomicReference<AWSCredentials> once = new AtomicReference<>(firstAccess);
return new AWSCredentialsProvider() {
@Override
public AWSCredentials getCredentials() {
if (once.compareAndSet(firstAccess, null)) {
return firstAccess;
}
return backingCredentialsProvider.getCredentials();
}
@Override
public void refresh() {
backingCredentialsProvider.refresh();
}
};
}
示例5: getAwsCredentialsProvider
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; //导入方法依赖的package包/类
public static AWSCredentialsProvider getAwsCredentialsProvider(String accessKeyId, String secretKey) {
if (accessKeyId != null && secretKey != null) {
return new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKeyId, secretKey));
} else {
return DefaultAWSCredentialsProviderChain.getInstance();
}
}
示例6: credentialsProvider
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; //导入方法依赖的package包/类
private AWSCredentialsProvider credentialsProvider() {
return DefaultAWSCredentialsProviderChain.getInstance();
}
示例7: resolveCredentials
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; //导入方法依赖的package包/类
/**
* If the builder isn't explicitly configured with credentials we use the {@link
* DefaultAWSCredentialsProviderChain}.
*/
private AWSCredentialsProvider resolveCredentials() {
return (credentials == null) ? DefaultAWSCredentialsProviderChain.getInstance() : credentials;
}
示例8: AWSKMSAsyncClient
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; //导入方法依赖的package包/类
/**
* Constructs a new asynchronous client to invoke service methods on KMS. A credentials provider chain will be used
* that searches for credentials in this order:
* <ul>
* <li>Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY</li>
* <li>Java System Properties - aws.accessKeyId and aws.secretKey</li>
* <li>Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI</li>
* <li>Instance profile credentials delivered through the Amazon EC2 metadata service</li>
* </ul>
* <p>
* Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default
* maximum number of concurrent connections to the service).
*
* @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain
* @see java.util.concurrent.Executors#newFixedThreadPool(int)
* @deprecated use {@link AWSKMSAsyncClientBuilder#defaultClient()}
*/
@Deprecated
public AWSKMSAsyncClient() {
this(DefaultAWSCredentialsProviderChain.getInstance());
}