// Copyright 2020 Authors of Cilium
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package relay;

option go_package = "github.com/cilium/cilium/api/v1/relay";

// NodeStatusEvent is a message sent by hubble-relay to inform clients about
// the state of a particular node.
message NodeStatusEvent {
    // state_change contains the new node state
    NodeState state_change = 1;
    // node_names is the list of nodes for which the above state changes applies
    repeated string node_names = 2;
    // message is an optional message attached to the state change (e.g. an
    // error message). The message applies to all nodes in node_names.
    string message = 3;
}

enum NodeState {
    // UNKNOWN_NODE_STATE indicates that the state of this node is unknown.
    UNKNOWN_NODE_STATE = 0;
    // NODE_CONNECTED indicates that we have established a connection
    // to this node. The client can expect to observe flows from this node.
    NODE_CONNECTED = 1;
    // NODE_UNAVAILABLE indicates that the connection to this
    // node is currently unavailable. The client can expect to not see any
    // flows from this node until either the connection is re-established or
    // the node is gone.
    NODE_UNAVAILABLE = 2;
    // NODE_GONE indicates that a node has been removed from the
    // cluster. No reconnection attempts will be made.
    NODE_GONE = 3;
    // NODE_ERROR indicates that a node has reported an error while processing
    // the request. No reconnection attempts will be made.
    NODE_ERROR = 4;
}
