You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: generator.go
    path of file: ./repos/kuma/pkg/plugins/runtime/gateway
    
    the code of the file until where you have to start completion: package gateway

import (
	"context"
	"fmt"
	"sort"
	"strings"

	envoy_service_runtime_v3 "github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3"
	"github.com/pkg/errors"
	"golang.org/x/exp/maps"

	mesh_proto "github.com/kumahq/kuma/api/mesh/v1alpha1"
	"github.com/kumahq/kuma/pkg/core/permissions"
	core_mesh "github.com/kumahq/kuma/pkg/core/resources/apis/mesh"
	"github.com/kumahq/kuma/pkg/core/resources/model"
	core_xds "github.com/kumahq/kuma/pkg/core/xds"
	meshhttproute_api "github.com/kumahq/kuma/pkg/plugins/policies/meshhttproute/api/v1alpha1"
	meshtcproute_api "github.com/kumahq/kuma/pkg/plugins/policies/meshtcproute/api/v1alpha1"
	"github.com/kumahq/kuma/pkg/plugins/runtime/gateway/match"
	"github.com/kumahq/kuma/pkg/plugi
    
func (g Generator) generateRDS(ctx xds_context.Context, info GatewayListenerInfo) (*core_xds.ResourceSet, error) {
	switch info.Listener.Protocol {
	case mesh_proto.MeshGateway_Listener_HTTPS,
		mesh_proto.MeshGateway_Listener_HTTP:
	default:
		return nil, nil
	}

	hostInfosByHostname := info.ListenerHostnames

	resources := core_xds.NewResourceSet()
	for _, hostInfos := range hostInfosByHostname {
		routeName := hostInfos.EnvoyRouteName(info.Listener.EnvoyListenerName)
		routeConfig := GenerateRouteConfig(info.Proxy, info.Listener.Protocol, routeName)

		// Make a pass over the generators for each virtual host.
		for _, hostInfo := range hostInfos.HostInfos {
			vh, err := GenerateVirtualHost(ctx, info, hostInfo.Host, hostInfo.Entries())
			if err != nil {
				return nil, err
			}

			routeConfig.Configure(envoy_routes.VirtualHost(vh))
		}

		res, err := BuildResourceSet(routeConfig)
		if err != nil {
			return nil, errors.Wrapf(err, "failed to build route configuration resource")
		}
		resources.AddSet(res)
	}

	return resources, nil
}