syntax = "proto3";
package v1alpha1;

option go_package = "k8s.io/kubelet/pkg/apis/pods/v1alpha1";

service Pods {
    // WatchPods will initially return an ADDED WatchPodsEvent for each
    // existing Pod, followed by an INITIAL_SYNC_COMPLETE WatchPodsEvent.
    // It then returns a WatchPodsEvent whenever a Pod is created, deleted, or updated.
    rpc WatchPods(WatchPodsRequest) returns (stream WatchPodsEvent) {}

    // ListPods returns a of List of Pods
    rpc ListPods(ListPodsRequest) returns (ListPodsResponse) {}

    // GetPod returns a Pod for given pod's UID
    rpc GetPod(GetPodRequest) returns (GetPodResponse) {}
}

enum EventType {
    UNSPECIFIED = 0;
    ADDED = 1;
    MODIFIED = 2;
    DELETED = 3;
    INITIAL_SYNC_COMPLETE = 4;
}


// This is sent for each update in the Watch stream
// Pod bytes are generated by calling v1.Pod#Marshal().
// They are convertable to a pod by calling v1.Pod#Unmarshal().
message WatchPodsEvent {
    // ADDED, MODIFIED, DELETED, INITIAL_SYNC_COMPLETE
    EventType type = 1;
    // pod is nil for INITIAL_SYNC_COMPLETE.
    // For DELETED events, only the pod name, namespace, and UID are guaranteed to be set.
    bytes pod = 2;
}

// ListPodsResponse returns a list of Pods.
// Pod bytes are generated by calling v1.Pod#Marshal().
// They are convertable to a pod by calling v1.Pod#Unmarshal().
message ListPodsResponse {
    repeated bytes pods = 1;
}

// GetPodResponse returns a Pod.
// Pod bytes are generated by calling v1.Pod#Marshal().
// They are convertable to a pod by calling v1.Pod#Unmarshal().
message GetPodResponse {
    bytes pod = 1;
}



message WatchPodsRequest {}

message ListPodsRequest {}

message GetPodRequest {
    string podUID = 1;
}
