All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.vespa.hosted.controller.api.integration.dns.VpcEndpointService Maven / Gradle / Ivy

There is a newer version: 8.253.3
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.dns;

import ai.vespa.http.DomainName;
import com.yahoo.config.provision.CloudAccount;
import com.yahoo.vespa.hosted.controller.api.identifiers.ClusterId;

import java.time.Instant;
import java.util.List;
import java.util.Optional;

import static java.util.Objects.requireNonNull;

/**
 * @author jonmv
 */
public interface VpcEndpointService {

    /** Create a TXT record with this name and token, and then complete the challenge. */
    record DnsChallenge(RecordName name, RecordData data, ClusterId clusterId, String serviceId,
                        Optional account, Instant createdAt, ChallengeState state) {

            public DnsChallenge {
                requireNonNull(name, "name must be non-null");
                requireNonNull(data, "data must be non-null");
                requireNonNull(clusterId, "clusterId must be non-null");
                requireNonNull(serviceId, "serviceId must be non-null");
                requireNonNull(account, "account must be non-null");
                requireNonNull(createdAt, "createdAt must be non-null");
                requireNonNull(state, "state must be non-null");
            }

            public DnsChallenge withState(ChallengeState state) {
                return new DnsChallenge(name, data, clusterId, serviceId, account, createdAt, state);
            }

    }

    enum ChallengeState { pending, ready, running, done }

    /** Sets the private DNS name for any VPC endpoint for the given cluster, potentially guarded by a challenge. */
    Optional setPrivateDns(DomainName privateDnsName, ClusterId clusterId, Optional account, boolean isGenerated);

    /** Attempts to complete the challenge, and returns the updated challenge state. */
    ChallengeState process(DnsChallenge challenge);

    /** A connection made to an endpoint service. */
    record VpcEndpoint(String endpointId, String stateString, EndpointState stateValue) { }

    enum EndpointState { pending, open, failed, closed }

    /** Lists all endpoints connected to an endpoint service (owned by account) for the given cluster. */
    List getConnections(ClusterId cluster, Optional account);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy