syntax = "proto3";

option go_package = "v1";
option java_package = "io.stackrox.proto.api.v1";

import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "storage/network_flow.proto";

package v1;

message NetworkEdgeProperties {
    uint32     port     = 1;
    storage.L4Protocol protocol = 2;

    google.protobuf.Timestamp last_active_timestamp = 3;
}

message NetworkEdgePropertiesBundle {
    repeated NetworkEdgeProperties properties = 1;
}

message NetworkNode {
    storage.NetworkEntityInfo entity          = 1;
    bool              internet_access = 2;
    repeated string   policy_ids      = 3;

    map<int32, NetworkEdgePropertiesBundle> out_edges = 4;
}

message NetworkGraphRequest {
    string cluster_id               = 1;
    string query                    = 2;
    google.protobuf.Timestamp since = 3;
}

message NetworkGraph {
    uint32               epoch = 1;
    repeated NetworkNode nodes = 2;
}

service NetworkGraphService {
    rpc GetNetworkGraph (NetworkGraphRequest) returns (NetworkGraph) {
        option (google.api.http) = {
            get: "/v1/networkgraph/cluster/{cluster_id}"
        };
    }

}
