本文整理了Java中com.amazonaws.services.kms.AWSKMSClientBuilder
类的一些代码示例,展示了AWSKMSClientBuilder
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AWSKMSClientBuilder
类的具体详情如下:
包路径:com.amazonaws.services.kms.AWSKMSClientBuilder
类名称:AWSKMSClientBuilder
[英]Fluent builder for com.amazonaws.services.kms.AWSKMS. Use of the builder is preferred over using constructors of the client class.
[中]fluentbuilderforcom。亚马逊。服务。公里。AWSKMS。比起使用客户机类的构造函数,更倾向于使用生成器。
代码示例来源:origin: aws/aws-sdk-java
/**
* @return Default client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and
* {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain
*/
public static AWSKMS defaultClient() {
return standard().build();
}
代码示例来源:origin: aws/aws-sdk-java
/**
* @return Create new instance of builder with all defaults set.
*/
public static AWSKMSClientBuilder standard() {
return new AWSKMSClientBuilder();
}
代码示例来源:origin: iterate-ch/cyberduck
private AWSKMS client(final Path container) throws BackgroundException {
final AWSKMSClientBuilder builder = AWSKMSClientBuilder.standard()
.withCredentials(AWSCredentialsConfigurator.toAWSCredentialsProvider(bookmark.getCredentials()))
.withClientConfiguration(configuration);
final Location.Name region = locationFeature.getLocation(container);
if(Location.unknown.equals(region)) {
builder.withRegion(Regions.DEFAULT_REGION);
}
else {
builder.withRegion(region.getIdentifier());
}
return builder.build();
}
代码示例来源:origin: Nextdoor/bender
public static String decrypt(String str, Region region) throws UnsupportedEncodingException {
if (isJUnitTest()) {
return str;
}
AWSKMS kms = AWSKMSClientBuilder.standard().withRegion(region.getName()).build();
/*
* The KMS ciphertext is base64 encoded and must be decoded before the request is made
*/
String cipherString = str;
byte[] cipherBytes = Base64.decode(cipherString);
/*
* Create decode request and decode
*/
ByteBuffer cipherBuffer = ByteBuffer.wrap(cipherBytes);
DecryptRequest req = new DecryptRequest().withCiphertextBlob(cipherBuffer);
DecryptResult resp = kms.decrypt(req);
/*
* Convert the response plaintext bytes to a string
*/
return new String(resp.getPlaintext().array(), Charset.forName("UTF-8"));
}
}
代码示例来源:origin: com.google.crypto.tink/tink
/** Loads AWS credentials from a provider. */
private KmsClient withCredentialsProvider(AWSCredentialsProvider provider)
throws GeneralSecurityException {
try {
this.client = AWSKMSClientBuilder.standard().withCredentials(provider).build();
return this;
} catch (AmazonServiceException e) {
throw new GeneralSecurityException("cannot load credentials from provider", e);
}
}
代码示例来源:origin: aws/aws-encryption-sdk-java
private RegionalClientSupplier clientFactory() {
if (regionalClientSupplier_ != null) {
return regionalClientSupplier_;
}
// Clone again; this MKP builder might be reused to build a second MKP with different creds.
AWSKMSClientBuilder builder = templateBuilder_ != null ? cloneClientBuilder(templateBuilder_)
: AWSKMSClientBuilder.standard();
ConcurrentHashMap
snoopClientCache(clientCache);
return region -> {
AWSKMS kms = clientCache.get(region);
if (kms != null) return kms;
// We can't just use computeIfAbsent as we need to avoid leaking KMS clients if we're asked to decrypt
// an EDK with a bogus region in its ARN. So we'll install a request handler to identify the first
// successful call, and cache it when we see that.
SuccessfulRequestCacher cacher = new SuccessfulRequestCacher(clientCache, region);
ArrayList
if (builder.getRequestHandlers() != null) {
handlers.addAll(builder.getRequestHandlers());
}
handlers.add(cacher);
kms = cloneClientBuilder(builder)
.withRegion(region)
.withRequestHandlers(handlers.toArray(new RequestHandler2[handlers.size()]))
.build();
cacher.client_ = kms;
return kms;
};
}
代码示例来源:origin: aws/aws-encryption-sdk-java
/**
* Returns an instance of this object with the supplied configuration and credentials. all keys
* listed in {@code keyIds} will be used to protect data.
*/
public KmsMasterKeyProvider(final AWSCredentialsProvider creds, final Region region,
final ClientConfiguration clientConfiguration, final List
this(builder().withClientBuilder(AWSKMSClientBuilder.standard()
.withClientConfiguration(clientConfiguration)
.withCredentials(creds))
.clientFactory(),
region.getName(),
keyIds
);
}
代码示例来源:origin: aws/aws-sdk-java
public static AWSKMSClientBuilder builder() {
return AWSKMSClientBuilder.standard();
}
代码示例来源:origin: zalando/spring-cloud-config-aws-kms
@Bean
public AWSKMS kms() {
final AWSKMSClientBuilder builder = AWSKMSClient.builder();
if (Optional.ofNullable(properties.getEndpoint()).isPresent()) {
builder.withEndpointConfiguration(new EndpointConfiguration(properties.getEndpoint().getServiceEndpoint(), properties.getEndpoint().getSigningRegion()));
} else {
Optional.ofNullable(properties.getRegion()).ifPresent(builder::setRegion);
}
return builder.build();
}
代码示例来源:origin: aws/aws-encryption-sdk-java
/**
* Configures the {@link KmsMasterKeyProvider} to use specific credentials. If a builder was previously set,
* this will override whatever credentials it set.
* @param credentialsProvider
* @return
*/
public Builder withCredentials(AWSCredentialsProvider credentialsProvider) {
if (regionalClientSupplier_ != null) {
throw clientSupplierComboException();
}
if (templateBuilder_ == null) {
templateBuilder_ = AWSKMSClientBuilder.standard();
}
templateBuilder_.setCredentials(credentialsProvider);
return this;
}
代码示例来源:origin: tmobile/pacbot
try{
if(!skipRegions.contains(region.getName())){
awskms = AWSKMSClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build();
List
List
代码示例来源:origin: Nextdoor/bender
public static String decrypt(String str, Region region) throws UnsupportedEncodingException {
if (isJUnitTest()) {
return str;
}
AWSKMS kms = AWSKMSClientBuilder.standard().withRegion(region.getName()).build();
/*
* The KMS ciphertext is base64 encoded and must be decoded before the request is made
*/
String cipherString = str;
byte[] cipherBytes = Base64.decode(cipherString);
/*
* Create decode request and decode
*/
ByteBuffer cipherBuffer = ByteBuffer.wrap(cipherBytes);
DecryptRequest req = new DecryptRequest().withCiphertextBlob(cipherBuffer);
DecryptResult resp = kms.decrypt(req);
/*
* Convert the response plaintext bytes to a string
*/
return new String(resp.getPlaintext().array(), Charset.forName("UTF-8"));
}
}
代码示例来源:origin: com.amazonaws/aws-java-sdk-kms
public static AWSKMSClientBuilder builder() {
return AWSKMSClientBuilder.standard();
}
代码示例来源:origin: com.amazonaws/aws-java-sdk-kms
/**
* @return Default client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and
* {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain
*/
public static AWSKMS defaultClient() {
return standard().build();
}
代码示例来源:origin: Nextdoor/bender
public static AWSKMSClientBuilder builder() {
return AWSKMSClientBuilder.standard();
}
代码示例来源:origin: com.amazonaws/aws-java-sdk-kms
/**
* @return Create new instance of builder with all defaults set.
*/
public static AWSKMSClientBuilder standard() {
return new AWSKMSClientBuilder();
}
代码示例来源:origin: Nextdoor/bender
/**
* @return Default client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and
* {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain
*/
public static AWSKMS defaultClient() {
return standard().build();
}
代码示例来源:origin: Nextdoor/bender
/**
* @return Create new instance of builder with all defaults set.
*/
public static AWSKMSClientBuilder standard() {
return new AWSKMSClientBuilder();
}