@Override public ServicePort build() { return new ServicePort("WebServer", 80, false); } },
public InetSocketAddress returnServiceAddress(InstanceInfo instanceInfo) { ServiceEndpoint endpoint = returnServiceEndpoint(instanceInfo); if (endpoint == null) { return null; } String address = endpoint.getAddress().getHostName(); if (address == null) { address = endpoint.getAddress().getIpAddress(); } return new InetSocketAddress(address, endpoint.getServicePort().getPort()); }
@Override protected boolean matches(Boolean value, ServiceEndpoint endpoint) { return endpoint.getServicePort().isSecure() == value; } }
@Override protected boolean matches(String value, ServiceEndpoint endpoint) { return value.equals(endpoint.getServicePort().getName()); } }
private static Observable<Void> redirectTo(InstanceInfo readServerInfo, HttpServerRequest<ByteBuf> request, HttpServerResponse<ByteBuf> response) { ServiceEndpoint serviceEndpoint = HTTP_PUBLIC_SERVICE_SELECTOR.returnServiceEndpoint(readServerInfo); String redirectHost = serviceEndpoint == null ? null : serviceEndpoint.getAddress().getHostName(); if(redirectHost == null) { serviceEndpoint = HTTP_PRIVATE_SERVICE_SELECTOR.returnServiceEndpoint(readServerInfo); redirectHost = serviceEndpoint.getAddress().getIpAddress(); } StringBuilder redirectBuilder = new StringBuilder("http://") .append(redirectHost) .append(':') .append(serviceEndpoint.getServicePort().getPort()) .append(request.getPath()); if (request.getQueryString() != null) { redirectBuilder.append('?').append(request.getQueryString()); } response.getHeaders().add(Names.LOCATION, redirectBuilder.toString()); response.setStatus(HttpResponseStatus.FOUND); return Observable.empty(); } }
@Override public ServicePort build() { return new ServicePort(Names.DISCOVERY, EurekaTransports.DEFAULT_DISCOVERY_PORT, false); } },
@Override public ServicePort build() { return new ServicePort("WebServer", 443, true); } },
@Override public ServicePort build() { return new ServicePort(Names.REGISTRATION, EurekaTransports.DEFAULT_REGISTRATION_PORT, false); } },
@Override public ServicePort build() { return new ServicePort(Names.REPLICATION, EurekaTransports.DEFAULT_REPLICATION_PORT, false); } };
public ServicePort build() { return new ServicePort(name, port, secure, addressLabels); } }
@Override public InstanceInfo.Builder call(HashSet<ServicePort> ports) { ports.add(new ServicePort(Names.EUREKA_HTTP, httpServer.serverPort(), false)); ports.add(new ServicePort(Names.REGISTRATION, registrationServer.serverPort(), false)); ports.add(new ServicePort(Names.REPLICATION, replicationServer.serverPort(), false)); ports.add(new ServicePort(Names.DISCOVERY, discoveryServer.serverPort(), false)); return new InstanceInfo.Builder().withPorts(ports); } })
@Override public InstanceInfo.Builder call(HashSet<ServicePort> ports) { ports.add(new ServicePort(WEB_SOCKET_SERVICE, webSocketServer.serverPort(), false)); return new InstanceInfo.Builder().withPorts(ports); } })
@Override public InstanceInfo.Builder call(HashSet<ServicePort> ports) { ports.add(new ServicePort(Names.DISCOVERY, discoveryServer.serverPort(), false)); return new InstanceInfo.Builder().withPorts(ports); } })
protected Builder templateFor(String name) { HashSet<String> healthCheckUrls = new HashSet<>(); healthCheckUrls.add("http://eureka/healthCheck/" + name); healthCheckUrls.add("https://eureka/healthCheck/" + name); HashSet<Integer> ports = new HashSet<>(); ports.add(80); ports.add(8080); HashSet<Integer> securePorts = new HashSet<>(); securePorts.add(443); securePorts.add(8443); return new Builder() .withId("id#" + name + "_" + UUID.randomUUID().toString()) .withApp("app#" + name) .withAppGroup("group#" + name) .withAsg("asg#" + name) .withHealthCheckUrls(healthCheckUrls) .withHomePageUrl("http://eureka/home/" + name) .withPorts(ExtCollections.asSet(new ServicePort(7200, false), new ServicePort(7210, true))) .withSecureVipAddress("vipSecure#" + name) .withStatus(Status.UP) .withStatusPageUrl("http://eureka/status/" + name) .withVipAddress("vip#" + name) .withMetaData("optionA", "valueA") .withMetaData("optionB", "valueB") .withDataCenterInfo(SampleAwsDataCenterInfo.UsEast1a.build()); }
@Override public InstanceInfo fromV1(com.netflix.appinfo.InstanceInfo v1Info) { InstanceInfo.Builder builder = new InstanceInfo.Builder() .withId(v1Info.getAppName() + "_" + v1Info.getId()) // instanceId is not unique for v1Data .withAppGroup(v1Info.getAppGroupName()) .withApp(v1Info.getAppName()) .withAsg(v1Info.getASGName()) .withVipAddress(v1Info.getVIPAddress()) .withSecureVipAddress(v1Info.getSecureVipAddress()) .withPorts(toSet(new ServicePort(v1Info.getPort(), false), new ServicePort(v1Info.getSecurePort(), true))) .withStatus(fromV1(v1Info.getStatus())) .withHomePageUrl(v1Info.getHomePageUrl()) .withStatusPageUrl(v1Info.getStatusPageUrl()) .withHealthCheckUrls(new HashSet<>(v1Info.getHealthCheckUrls())) .withMetaData(v1Info.getMetadata()) .withDataCenterInfo(dataCenterFromV1(v1Info)); return builder.build(); }