本文整理汇总了Java中com.amazonaws.util.AwsHostNameUtils.parseRegionName方法的典型用法代码示例。如果您正苦于以下问题:Java AwsHostNameUtils.parseRegionName方法的具体用法?Java AwsHostNameUtils.parseRegionName怎么用?Java AwsHostNameUtils.parseRegionName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.util.AwsHostNameUtils
的用法示例。
在下文中一共展示了AwsHostNameUtils.parseRegionName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AWS4SignerRequestParams
import com.amazonaws.util.AwsHostNameUtils; //导入方法依赖的package包/类
/**
* Generates an instance of AWS4signerRequestParams that holds the
* parameters used for computing a AWS 4 signature for a request
*/
public AWS4SignerRequestParams(SignableRequest<?> request,
Date signingDateOverride, String regionNameOverride,
String serviceName, String signingAlgorithm) {
if (request == null) {
throw new IllegalArgumentException("Request cannot be null");
}
if (signingAlgorithm == null) {
throw new IllegalArgumentException(
"Signing Algorithm cannot be null");
}
this.request = request;
this.signingDateTimeMilli = signingDateOverride != null ? signingDateOverride
.getTime() : getSigningDate(request);
this.formattedSigningDate = AWS4SignerUtils
.formatDateStamp(signingDateTimeMilli);
this.serviceName = serviceName;
this.regionName = regionNameOverride != null ? regionNameOverride
: AwsHostNameUtils.parseRegionName(request.getEndpoint()
.getHost(), this.serviceName);
this.scope = generateScope(request, formattedSigningDate, this.serviceName,
regionName);
this.formattedSigningDateTime = AWS4SignerUtils
.formatTimestamp(signingDateTimeMilli);
this.signingAlgorithm = signingAlgorithm;
}
示例2: setEndpoint
import com.amazonaws.util.AwsHostNameUtils; //导入方法依赖的package包/类
/**
* @deprecated use {@link AmazonS3ClientBuilder#setEndpointConfiguration(AwsClientBuilder.EndpointConfiguration)}
*/
@Override
@Deprecated
public synchronized void setEndpoint(String endpoint) {
if (ServiceUtils.isS3AccelerateEndpoint(endpoint)) {
throw new IllegalStateException("To enable accelerate mode, please use AmazonS3ClientBuilder.withAccelerateModeEnabled(true)");
} else {
super.setEndpoint(endpoint);
/*
* Extract the region string from the endpoint if it's not known to be a
* global S3 endpoint.
*/
if (!ServiceUtils.isS3USStandardEndpoint(endpoint)) {
clientRegion = AwsHostNameUtils.parseRegionName(this.endpoint.getHost(), S3_SERVICE_NAME);
}
}
}
示例3: computeSignerByURI
import com.amazonaws.util.AwsHostNameUtils; //导入方法依赖的package包/类
/**
* Returns the signer for the given uri and the current client
* configuration.
* <p>
* Note, however, the signer returned for S3 is incomplete at this stage as
* the information on the S3 bucket and key is not yet known.
*
* @param signerRegionOverride
* the overriding signer region; or null if there is none.
* @param isRegionIdAsSignerParam
* true if the "regionId" is used to configure the signer if
* applicable; false if this method is called for the purpose of
* purely setting the communication end point of this AWS client,
* and therefore the "regionId" parameter will not be used
* directly for configuring the signer.
*/
private Signer computeSignerByURI(URI uri, String signerRegionOverride,
boolean isRegionIdAsSignerParam) {
if (uri == null) {
throw new IllegalArgumentException(
"Endpoint is not set. Use setEndpoint to set an endpoint before performing any request.");
}
String service = getServiceNameIntern();
String region = AwsHostNameUtils.parseRegionName(uri.getHost(), service);
return computeSignerByServiceRegion(
service, region, signerRegionOverride, isRegionIdAsSignerParam);
}