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