@Override
    protected Model transformWithConfig(TransformContext context, Config config) {
        if (config.getService() == null || config.getNamespace() == null) {
            throw new SmithyBuildException(
                    "'namespace' and 'service' properties must be set on flattenNamespace transformer.");
        }

        Model model = context.getModel();
        if (!model.getShape(config.getService()).isPresent()) {
            throw new SmithyBuildException("Configured service, " + config.getService()
                    + ", not found in model when performing flattenNamespaces transform.");
        }

        Map<ShapeId, ShapeId> shapesToRename = getRenamedShapes(config, model);
        model = context.getTransformer().renameShapes(model, shapesToRename);

        // Remove service renames since they've now been applied, so consumers don't fail service shape validation
        ShapeId updatedServiceId = shapesToRename.get(config.getService());
        ServiceShape updatedService = model.expectShape(updatedServiceId, ServiceShape.class)
                .toBuilder()
                .clearRename()
                .build();
        return context.getTransformer().replaceShapes(model, ListUtils.of(updatedService));
    }
Gets the set of tags that are retained in the model.

@return Returns the tags to retain.
smithy-build/src/main/java/software/amazon/smithy/build/transforms/FlattenNamespaces.java