public static Listener createListener(boolean ads,
      io.envoyproxy.envoy.api.v2.core.ApiVersion rdsTransportVersion,
      io.envoyproxy.envoy.api.v2.core.ApiVersion rdsResourceVersion, String listenerName,
      int port, String routeName) {
    ConfigSource.Builder configSourceBuilder = ConfigSource.newBuilder()
        .setResourceApiVersion(rdsResourceVersion);
    ConfigSource rdsSource = ads
        ? configSourceBuilder
        .setAds(AggregatedConfigSource.getDefaultInstance())
        .build()
        : configSourceBuilder
            .setApiConfigSource(ApiConfigSource.newBuilder()
                .setApiType(ApiType.GRPC)
                .setTransportApiVersion(rdsTransportVersion)
                .addGrpcServices(GrpcService.newBuilder()
                    .setEnvoyGrpc(EnvoyGrpc.newBuilder()
                        .setClusterName(XDS_CLUSTER))))
            .build();
    HttpConnectionManager manager = HttpConnectionManager.newBuilder()
        .setCodecType(CodecType.AUTO)
        .setStatPrefix("http")
        .setRds(Rds.newBuilder()
            .setConfigSource(rdsSource)
            .setRouteConfigName(routeName))
        .addHttpFilters(HttpFilter.newBuilder()
            .setName(Resources.FILTER_ENVOY_ROUTER))
        .build();
    return Listener.newBuilder()
        .setName(listenerName)
        .setAddress(Address.newBuilder()
            .setSocketAddress(SocketAddress.newBuilder()
                .setAddress(ANY_ADDRESS)
                .setPortValue(port)
                .setProtocol(Protocol.TCP)))
        .addFilterChains(FilterChain.newBuilder()
            .addFilters(Filter.newBuilder()
                .setName(Resources.FILTER_HTTP_CONNECTION_MANAGER)
                .setTypedConfig(Any.pack(manager))))
        .build();
  }
public static Listener createListener(boolean ads,
      io.envoyproxy.envoy.api.v2.core.ApiVersion rdsTransportVersion,
      io.envoyproxy.envoy.api.v2.core.ApiVersion rdsResourceVersion, String listenerName,
      int port, String routeName) {
    ConfigSource.Builder configSourceBuilder = ConfigSource.newBuilder()
        .setResourceApiVersion(rdsResourceVersion);
    ConfigSource rdsSource = ads
        ? configSourceBuilder
        .setAds(AggregatedConfigSource.getDefaultInstance())
        .build()
        : configSourceBuilder
            .setApiConfigSource(ApiConfigSource.newBuilder()
                .setApiType(ApiType.GRPC)
                .setTransportApiVersion(rdsTransportVersion)
                .addGrpcServices(GrpcService.newBuilder()
                    .setEnvoyGrpc(EnvoyGrpc.newBuilder()
                        .setClusterName(XDS_CLUSTER))))
            .build();
    HttpConnectionManager manager = HttpConnectionManager.newBuilder()
        .setCodecType(CodecType.AUTO)
        .setStatPrefix("http")
        .setRds(Rds.newBuilder()
            .setConfigSource(rdsSource)
            .setRouteConfigName(routeName))
        .addHttpFilters(HttpFilter.newBuilder()
            .setName(Resources.FILTER_ENVOY_ROUTER))
        .build();
    return Listener.newBuilder()
        .setName(listenerName)
        .setAddress(Address.newBuilder()
            .setSocketAddress(SocketAddress.newBuilder()
                .setAddress(ANY_ADDRESS)
                .setPortValue(port)
                .setProtocol(Protocol.TCP)))
        .addFilterChains(FilterChain.newBuilder()
            .addFilters(Filter.newBuilder()
                .setName(Resources.FILTER_HTTP_CONNECTION_MANAGER)
                .setTypedConfig(Any.pack(manager))))
        .build();
  }
public static listener createlistener(boolean ads, io.envoyproxy.envoy.api.v2.core.apiversion rdstransportversion, io.envoyproxy.envoy.api.v2.core.apiversion rdsresourceversion, string listenername, int port, string routename) { configsource.builder configsourcebuilder = configsource.newbuilder() .setresourceapiversion(rdsresourceversion); configsource rdssource = ads ? configsourcebuilder .setads(aggregatedconfigsource.getdefaultinstance()) .build() : configsourcebuilder .setapiconfigsource(apiconfigsource.newbuilder() .setapitype(apitype.grpc) .settransportapiversion(rdstransportversion) .addgrpcservices(grpcservice.newbuilder() .setenvoygrpc(envoygrpc.newbuilder() .setclustername(xds_cluster)))) .build(); httpconnectionmanager manager = httpconnectionmanager.newbuilder() .setcodectype(codectype.auto) .setstatprefix("http") .setrds(rds.newbuilder() .setconfigsource(rdssource) .setrouteconfigname(routename)) .addhttpfilters(httpfilter.newbuilder() .setname(resources.filter_envoy_router)) .build(); return listener.newbuilder() .setname(listenername) .setaddress(address.newbuilder() .setsocketaddress(socketaddress.newbuilder() .setaddress(any_address) .setportvalue(port) .setprotocol(protocol.tcp))) .addfilterchains(filterchain.newbuilder() .addfilters(filter.newbuilder() .setname(resources.filter_http_connection_manager) .settypedconfig(any.pack(manager)))) .build(); }