public String create(final String secret, final String bucket, String region, final String key, final String method, final long expiry) {
        if(StringUtils.isBlank(region)) {
            // Only for AWS
            switch(session.getSignatureVersion()) {
                case AWS4HMACSHA256:
                    // Region is required for AWS4-HMAC-SHA256 signature
                    region = S3LocationFeature.DEFAULT_REGION.getIdentifier();
            }
        }
        final Host bookmark = session.getHost();
        return new RestS3Service(new AWSCredentials(StringUtils.strip(bookmark.getCredentials().getUsername()), StringUtils.strip(secret))) {
            @Override
            public String getEndpoint() {
                if(S3Session.isAwsHostname(bookmark.getHostname())) {
                    return bookmark.getProtocol().getDefaultHostname();
                }
                return bookmark.getHostname();
            }

            @Override
            protected void initializeProxy(final HttpClientBuilder httpClientBuilder) {
                //
            }
        }.createSignedUrlUsingSignatureVersion(
                session.getSignatureVersion().toString(),
                region, method, bucket, key, null, null, expiry / 1000, false, true,
                new HostPreferences(bookmark).getBoolean("s3.bucket.virtualhost.disable"));
    }
@Test
    public void testCreateEuWest() throws Exception {
        final Calendar expiry = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
        expiry.add(Calendar.MILLISECOND, (int) TimeUnit.DAYS.toMillis(7));
        final String url = new S3PresignedUrlProvider(session).create(PROPERTIES.get("s3.secret"),
                "test-eu-west-1-cyberduck", "eu-west-1", "f", "GET", expiry.getTimeInMillis());
        assertNotNull(url);
        assertEquals("test-eu-west-1-cyberduck.s3.amazonaws.com", URI.create(url).getHost());
        final HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
        assertEquals(404, connection.getResponseCode());
    }