blob: 64c6b19b8bbb1c74f3fbfe54d42151ae8bdb1b41 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.component;
import com.yahoo.vespa.athenz.api.AthenzIdentity;
import java.net.URI;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* Information necessary to e.g. establish communication with the config servers
*
* @author hakon
*/
public class ConfigServerInfo {
private final URI loadBalancerEndpoint;
private final AthenzIdentity configServerIdentity;
private final Function<String, URI> configServerHostnameToUriMapper;
private final List<URI> configServerURIs;
public ConfigServerInfo(URI loadBalancerEndpoint, List<String> configServerHostNames,
AthenzIdentity configServerAthenzIdentity) {
this.loadBalancerEndpoint = loadBalancerEndpoint;
this.configServerIdentity = configServerAthenzIdentity;
this.configServerHostnameToUriMapper = hostname -> URI.create("https://" + hostname + ":4443");
this.configServerURIs = configServerHostNames.stream()
.map(configServerHostnameToUriMapper)
.toList();
}
public List<URI> getConfigServerUris() {
return configServerURIs;
}
public URI getConfigServerUri(String hostname) {
return configServerHostnameToUriMapper.apply(hostname);
}
public URI getLoadBalancerEndpoint() {
return loadBalancerEndpoint;
}
public AthenzIdentity getConfigServerIdentity() {
return configServerIdentity;
}
}
|