private void resolveHostForOutpostArnRequest(Request<?> request, Arn arn) {
        S3Resource s3Resource = S3ControlArnConverter.getInstance().convertArn(arn);

        String signingRegion = request.getHandlerContext(HandlerContextKey.SIGNING_REGION);
        String arnRegion = arnRegion(arn);
        String arnPartition = arn.getPartition();
        S3Resource parentS3Resource = s3Resource.getParentS3Resource();

        validateIsTrue(!isFipsInvolved(signingRegion, arnRegion, request),
                        "FIPS is not supported for outpost requests.");

        // Even though we validated that we're not *calling* a FIPS region, the client region may still be a FIPS region if we're
        // using the ARN region. For that reason, we need to strip off the "fips" from the signing region before we get the
        // partition to make sure we're not making a cross-partition call.
        signingRegion = removeFipsIfNeeded(signingRegion);

        String signingPartition = RegionUtils.getRegion(signingRegion).getPartition();


        S3OutpostResource outpostResource = validateIsInstanceOf(S3OutpostResource.class, parentS3Resource,
                                                                 "The ARN passed must have a parent outpost resource.");
        validateIsTrue(!isDualstackEnabled(request), "Dual stack endpoints are not supported for outpost requests.");
        validateIsTrue(arnPartition.equals(signingPartition),
                        "The partition field of the ARN being passed as a bucket parameter to an S3 operation does not match "
                        + "the partition the client has been configured with. Provided partition: '%s'; client partition: '%s'.",
                        arnPartition, signingPartition);
        validateIsTrue(useArnRegion(request) || arnRegion.equals(signingRegion),
                        "The region field of the ARN being passed as a bucket parameter to an operation does not match the "
                        + "region the client was configured with. Provided region: '%s'; client region: '%s'.",
                        arnRegion, signingRegion);

        request.addHandlerContext(HandlerContextKey.SIGNING_REGION, arnRegion);
        request.addHandlerContext(HandlerContextKey.SIGNING_NAME, "s3-outposts");
        request.addHeader(X_AMZ_OUTPOST_ID_HEADER, outpostResource.getOutpostId());

        if (isEndpointOverridden(request)) {
            // Drop endpoint prefix for ARN-based requests
            replaceHost(request, clientEndpoint(request).getHost());
        } else {
            String arnPartitionDnsSuffix = RegionUtils.getRegion(arnRegion).getDomain();
            request.setEndpoint(URI.create(String.format("%s://s3-outposts.%s.%s",
                                                         request.getEndpoint().getScheme(), arnRegion, arnPartitionDnsSuffix)));
        }
    }
{@link RequestHandler2} that modifies the endpoint to handle virtual addressing (account id hoisting),
Dual-Stack, and FIPS.
aws-java-sdk-s3control/src/main/java/com/amazonaws/services/s3control/internal/handlers/EndpointHandler.java