diff options
author | jonmv <venstad@gmail.com> | 2022-12-06 14:07:13 +0100 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2022-12-06 14:07:13 +0100 |
commit | 7225c5e1b7136d481c5dc104008c668859b90ff3 (patch) | |
tree | 60e9b2bfc6e9971414dd4834e46bb7c717a8e3bd /controller-api | |
parent | e9df2e33f0192e0461c690146b2f8a3d85fa99cc (diff) |
Get and show vpc endpoints for clusters with service
Diffstat (limited to 'controller-api')
2 files changed, 23 insertions, 4 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MockVpcEndpointService.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MockVpcEndpointService.java index e4f14c7a7b6..f101339ed06 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MockVpcEndpointService.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MockVpcEndpointService.java @@ -4,6 +4,7 @@ import ai.vespa.http.DomainName; import com.yahoo.config.provision.CloudAccount; import com.yahoo.vespa.hosted.controller.api.identifiers.ClusterId; +import java.util.List; import java.util.Optional; /** @@ -11,13 +12,24 @@ import java.util.Optional; */ public class MockVpcEndpointService implements VpcEndpointService { - public static final VpcEndpointService empty = (name, cluster, account) -> Optional.empty(); + public interface Stub extends VpcEndpointService { + @Override default List<VpcEndpoint> getConnections(ClusterId clusterId, Optional<CloudAccount> account) { + return List.of(new VpcEndpoint("endpoint-1", "available")); + } + } + + public static final Stub empty = (name, cluster, account) -> Optional.empty(); - public VpcEndpointService delegate = empty; + public Stub delegate = empty; @Override public Optional<DnsChallenge> setPrivateDns(DomainName privateDnsName, ClusterId clusterId, Optional<CloudAccount> account) { return delegate.setPrivateDns(privateDnsName, clusterId, account); } + @Override + public List<VpcEndpoint> getConnections(ClusterId cluster, Optional<CloudAccount> account) { + return List.of(new VpcEndpoint("endpoint-1", "available")); + } + } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/VpcEndpointService.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/VpcEndpointService.java index 109b084f672..5069a429b27 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/VpcEndpointService.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/VpcEndpointService.java @@ -4,6 +4,7 @@ import ai.vespa.http.DomainName; import com.yahoo.config.provision.CloudAccount; import com.yahoo.vespa.hosted.controller.api.identifiers.ClusterId; +import java.util.List; import java.util.Optional; /** @@ -11,10 +12,16 @@ import java.util.Optional; */ public interface VpcEndpointService { + /** Create a TXT record with this name and token, then run the trigger, to pass this challenge. */ + record DnsChallenge(RecordName name, RecordData data, Runnable trigger) { } + /** Sets the private DNS name for any VPC endpoint for the given cluster, potentially guarded by a challenge. */ Optional<DnsChallenge> setPrivateDns(DomainName privateDnsName, ClusterId clusterId, Optional<CloudAccount> account); - /** Create a TXT record with this name and token, then run the trigger, to pass this challenge. */ - record DnsChallenge(RecordName name, RecordData data, Runnable trigger) { } + /** A connection made to an endpoint service. */ + record VpcEndpoint(String endpointId, String state) { } + + /** Lists all endpoints connected to an endpoint service (owned by account) for the given cluster. */ + List<VpcEndpoint> getConnections(ClusterId cluster, Optional<CloudAccount> account); } |