def _generate_api_config_with_root(self, request):
actual_root = self._get_actual_root(request)<EOL>generator = api_config.ApiConfigGenerator()<EOL>api = request.body_json['<STR_LIT>']<EOL>version = request.body_json['<STR_LIT:version>']<EOL>lookup_key = (api, version)<EOL>service_factories = self._backend.api_name_version_map.get(lookup_key)<EOL>if not service_factories:<EOL><INDENT>return None<EOL><DEDENT>service_classes = [service_factory.service_class<EOL>for service_factory in service_factories]<EOL>config_dict = generator.get_config_dict(<EOL>service_classes, hostname=actual_root)<EOL>for config in config_dict.get('<STR_LIT>', []):<EOL><INDENT>lookup_key_with_root = (<EOL>config.get('<STR_LIT:name>', '<STR_LIT>'), config.get('<STR_LIT:version>', '<STR_LIT>'), actual_root)<EOL>self._config_manager.save_config(lookup_key_with_root, config)<EOL><DEDENT>return config_dict<EOL>
Generate an API config with a specific root hostname.

        This uses the backend object and the ApiConfigGenerator to create an API
        config specific to the hostname of the incoming request. This allows for
        flexible API configs for non-standard environments, such as localhost.

        Args:
          request: An ApiRequest, the transformed request sent to the Discovery API.

        Returns:
          A string representation of the generated API config.