本文整理匯總了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());
}