private ObjectNode updateIntegrationWithCors(
            Context<? extends Trait> context,
            OperationObject operationObject,
            OperationShape shape,
            ObjectNode integrationNode,
            CorsTrait cors
    ) {
        ObjectNode responses = integrationNode.getObjectMember(RESPONSES_KEY).orElse(Node.objectNode());

        // Always include a "default" response that has the same HTTP response code.
        if (!responses.getMember(DEFAULT_KEY).isPresent()) {
            responses = responses.withMember(DEFAULT_KEY, Node.objectNode().withMember(STATUS_CODE_KEY, "200"));
        }

        Map<CorsHeader, String> corsHeaders = new HashMap<>();
        corsHeaders.put(CorsHeader.ALLOW_ORIGIN, cors.getOrigin());
        if (context.usesHttpCredentials()) {
            corsHeaders.put(CorsHeader.ALLOW_CREDENTIALS, "true");
        }

        LOGGER.finer(() -> String.format("Adding the following CORS headers to the API Gateway integration of %s: %s",
                shape.getId(),
                corsHeaders));
        Set<String> deducedHeaders = CorsHeader.deduceOperationResponseHeaders(context, operationObject, shape, cors);
        LOGGER.fine(() -> String.format("Detected the following headers for operation %s: %s",
                shape.getId(),
                deducedHeaders));

        // Update each response by adding CORS headers.
        responses = responses.getMembers()
                .entrySet()
                .stream()
                .peek(entry -> LOGGER.fine(() -> String.format(
                        "Updating integration response %s for `%s` with CORS",
                        entry.getKey(),
                        shape.getId())))
                .map(entry -> Pair.of(entry.getKey(),
                        updateIntegrationResponse(
                                shape,
                                corsHeaders,
                                deducedHeaders,
                                entry.getValue().expectObjectNode())))
                .collect(ObjectNode.collect(Pair::getLeft, Pair::getRight));

        return integrationNode.withMember(RESPONSES_KEY, responses);
    }
Adds CORS headers to REST integrations.

<p>If the service is a REST API that has the {@link CorsTrait}, then
integration responses will include a statically computed
Access-Control-Expose-Headers CORS headers that contains every header
exposed by the integration, and Access-Control-Allow-Credentials header
if the operation uses a security scheme that needs it, and
Access-Control-Allow-Origin header that is the result of
{@link CorsTrait#getOrigin()}.
smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddCorsToRestIntegrations.java