本文整理汇总了Java中com.amazonaws.regions.Regions.fromName方法的典型用法代码示例。如果您正苦于以下问题:Java Regions.fromName方法的具体用法?Java Regions.fromName怎么用?Java Regions.fromName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.regions.Regions
的用法示例。
在下文中一共展示了Regions.fromName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateRegion
import com.amazonaws.regions.Regions; //导入方法依赖的package包/类
private void validateRegion(
final String region) {
assertArgumentNotNull(
REGION,
region);
try {
Regions.fromName(region);
} catch (IllegalArgumentException illegalArgumentException) {
throw new IllegalArgumentException(
String.format(
INVALID_REGION_PATTERN,
region),
illegalArgumentException);
}
}
示例2: initializeAwsAuthorizationData
import com.amazonaws.regions.Regions; //导入方法依赖的package包/类
private void initializeAwsAuthorizationData(String region) throws SdkClientException {
final Regions awsRegion = Regions.fromName(region);
AmazonECR ecr = AmazonECRClientBuilder.standard().withRegion(awsRegion).build();
GetAuthorizationTokenResult authTokenResult = ecr.getAuthorizationToken(
new GetAuthorizationTokenRequest()
);
AuthorizationData authData = authTokenResult.getAuthorizationData().get(0);
String[] userAuthData = StringUtils.newStringUtf8(Base64.decodeBase64(
authData.getAuthorizationToken())
).split(":");
registryUsername = userAuthData[0];
registryPassword = userAuthData[1];
registryUrl = authData.getProxyEndpoint();
}
示例3: cfgRegion
import com.amazonaws.regions.Regions; //导入方法依赖的package包/类
private void cfgRegion(String regionName){
try {
Regions tmpRegions = Regions.fromName(regionName);
setRegion(Region.getRegion(tmpRegions));
setRegions(tmpRegions);
} catch( IllegalArgumentException e ) {
throw new IllegalArgumentException( "Unrecognized region " + regionName );
}
}
示例4: deserialize
import com.amazonaws.regions.Regions; //导入方法依赖的package包/类
@Override
public Regions deserialize(JsonParser parser, DeserializationContext context)
throws IOException {
return Regions.fromName(parser.getValueAsString());
}
示例5: getKmsRegion
import com.amazonaws.regions.Regions; //导入方法依赖的package包/类
/**
* Returns the the KMS region explicitly specified for the AWS KMS client
* when such client is internally instantiated; or null if no explicit KMS
* region is specified. This KMS region parameter is ignored when the AWS
* KMS client of the S3 encryption client is explicitly passed in by the
* users, instead of being implicitly created.
*
* @Deprecated This method is not forward compatible. Throws
* IllegalArguementException when a new region is encountered.
*
* @use {@link #getAwsKmsRegion()} instead
*/
@Deprecated
public Regions getKmsRegion() {
if (awskmsRegion == null) return null;
return Regions.fromName(awskmsRegion.getName());
}