private void walk(Model model, ShapeId service, EntityShape current, Trait trait) {
        Trait updatedTrait = extractTrait(current, trait);
        Map<ShapeId, Trait> serviceMapping = traits.get(service);
        serviceMapping.put(current.getId(), updatedTrait);

        for (ShapeId resource : current.getResources()) {
            model.getShape(resource)
                    .flatMap(Shape::asResourceShape)
                    .ifPresent(resourceShape -> walk(model, service, resourceShape, updatedTrait));
        }

        for (ShapeId operation : current.getAllOperations()) {
            model.getShape(operation).ifPresent(op -> serviceMapping.put(operation, extractTrait(op, updatedTrait)));
        }
    }
Get the integration trait for a particular operation, resource, or
service bound within a service of a specific type.

@param service Service shape or ShapeId thereof.
@param shape Operation, service, or resource shape in the service.
 When the service shape ID is provided, the integration trait of the
 service is returned if present.
@param type Integration trait type.
@param <T> Type of trait to retrieve.

@return The integration trait or an empty optional if none set or
 if not of the expected type.
smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/IntegrationTraitIndex.java