use of com.amazonaws.auth.RegionAwareSigner in project aws-sdk-android by aws-amplify.
the class AmazonWebServiceClient method computeSignerByServiceRegion.
/**
* Returns the signer for the given service name, region id, 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 regionId the region for sending AWS requests
* @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.
*/
@SuppressWarnings("checkstyle:hiddenfield")
private Signer computeSignerByServiceRegion(final String serviceName, final String regionId, final String signerRegionOverride, final boolean isRegionIdAsSignerParam) {
final String signerType = clientConfiguration.getSignerOverride();
final Signer signer = signerType == null ? SignerFactory.getSigner(serviceName, regionId) : SignerFactory.getSignerByTypeAndService(signerType, serviceName);
if (signer instanceof RegionAwareSigner) {
// Overrides the default region computed
final RegionAwareSigner regionAwareSigner = (RegionAwareSigner) signer;
// when used in the external release
if (signerRegionOverride != null) {
regionAwareSigner.setRegionName(signerRegionOverride);
} else if (regionId != null && isRegionIdAsSignerParam) {
regionAwareSigner.setRegionName(regionId);
}
}
synchronized (this) {
this.region = Region.getRegion(regionId);
}
return signer;
}
Aggregations