private boolean bucketRegionShouldBeCached(Request<?> request) { return clientOptions.isForceGlobalBucketAccessEnabled() || noExplicitRegionProvided(request); }
private void validateRequestBeforeTransmit(Request<?> request) { boolean implicitCrossRegionForbidden = areImplicitGlobalClientsDisabled(); boolean explicitCrossRegionEnabled = clientOptions.isForceGlobalBucketAccessEnabled(); // The region must be set if implicit cross region clients are not allowed if (noExplicitRegionProvided(request) && implicitCrossRegionForbidden && !explicitCrossRegionEnabled) { String error = String.format("While the %s system property is enabled, Amazon S3 clients cannot be used without " + "first configuring a region or explicitly enabling global bucket access discovery " + "in the S3 client builder.", SDKGlobalConfiguration.DISABLE_S3_IMPLICIT_GLOBAL_CLIENTS_SYSTEM_PROPERTY); throw new IllegalStateException(error); } }
private URI getCreateBucketEndpoint(String requestRegion) { // Route to the default endpoint if they're not trying to specify a different one in the request. if(requestRegion == null || requestRegion.equals(clientRegion) || !clientOptions.isForceGlobalBucketAccessEnabled()) { return endpoint; } // If they enabled global bucket access and they're trying to create a bucket in a region different than the default // one specified when they created the client, it will probably fail because only us-east-1 (actually the global // endpoint) is capable of creating buckets outside of its region. Override the endpoint to which the request // is routed so that it will succeed. com.amazonaws.regions.Region targetRegion = com.amazonaws.regions.Region.getRegion(Regions.fromName(requestRegion)); return new DefaultServiceEndpointBuilder(getEndpointPrefix(), clientConfiguration.getProtocol().toString()).withRegion(targetRegion) .getServiceEndpoint(); }
private boolean bucketRegionShouldBeCached(Request<?> request) { return clientOptions.isForceGlobalBucketAccessEnabled() || noExplicitRegionProvided(request); }
private void validateRequestBeforeTransmit(Request<?> request) { boolean implicitCrossRegionForbidden = areImplicitGlobalClientsDisabled(); boolean explicitCrossRegionEnabled = clientOptions.isForceGlobalBucketAccessEnabled(); // The region must be set if implicit cross region clients are not allowed if (noExplicitRegionProvided(request) && implicitCrossRegionForbidden && !explicitCrossRegionEnabled) { String error = String.format("While the %s system property is enabled, Amazon S3 clients cannot be used without " + "first configuring a region or explicitly enabling global bucket access discovery " + "in the S3 client builder.", SDKGlobalConfiguration.DISABLE_S3_IMPLICIT_GLOBAL_CLIENTS_SYSTEM_PROPERTY); throw new IllegalStateException(error); } }
private URI getCreateBucketEndpoint(String requestRegion) { // Route to the default endpoint if they're not trying to specify a different one in the request. if(requestRegion == null || requestRegion.equals(clientRegion) || !clientOptions.isForceGlobalBucketAccessEnabled()) { return endpoint; } // If they enabled global bucket access and they're trying to create a bucket in a region different than the default // one specified when they created the client, it will probably fail because only us-east-1 (actually the global // endpoint) is capable of creating buckets outside of its region. Override the endpoint to which the request // is routed so that it will succeed. com.amazonaws.regions.Region targetRegion = com.amazonaws.regions.Region.getRegion(Regions.fromName(requestRegion)); return new DefaultServiceEndpointBuilder(getEndpointPrefix(), clientConfiguration.getProtocol().toString()).withRegion(targetRegion) .getServiceEndpoint(); }