private String keyForBaseOfPath() {
        if (key == null) {
            return "";
        }

        // If the key name starts with a slash, prepend it with "/" so that it doesn't get treated as a redundant slash and get
        // pruned out in later path normalization logic.
        if (key.startsWith("/")) {
            return "/" + key;
        }

        return key;
    }
Set the request's endpoint and resource path with the new region provided

@param request Request to set endpoint for
@param regionString  New region to determine endpoint to hit
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/S3RequestEndpointResolver.java