talos/api/resource/resource.proto
Andrey Smirnov 9baca49662
refactor: implement COSI resource API for Talos
Overview: deprecate existing Talos resource API, and introduce new COSI
API.

Consequences:

* COSI API can only go via one-2-one proxy (`client.WithNode`)
* client-side API access is way easier with `state.State` wrappers
* lots of small changes on the client side to use new APIs

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-08-12 22:31:54 +04:00

97 lines
1.9 KiB
Protocol Buffer

syntax = "proto3";
package resource;
option go_package = "github.com/talos-systems/talos/pkg/machinery/api/resource";
import "common/common.proto";
import "google/protobuf/timestamp.proto";
// The resource service definition.
//
// ResourceService provides user-facing API for the Talos resources.
service ResourceService {
option (common.remove_deprecated_service) = "v1.5";
option deprecated = true;
rpc Get(GetRequest) returns (GetResponse);
rpc List(ListRequest) returns (stream ListResponse);
rpc Watch(WatchRequest) returns (stream WatchResponse);
}
// common resource definition
message Resource {
Metadata metadata = 1;
Spec spec = 2;
}
message Metadata {
string namespace = 1;
string type = 2;
string id = 3;
string version = 4;
string owner = 7;
string phase = 5;
google.protobuf.Timestamp created = 8;
google.protobuf.Timestamp updated = 9;
repeated string finalizers = 6;
map<string, string> labels = 10;
}
message Spec {
bytes yaml = 1;
}
// rpc Get
message GetRequest {
string namespace = 1;
string type = 2;
string id = 3;
}
// The GetResponse message contains the Resource returned.
message Get {
common.Metadata metadata = 1;
Resource definition = 2;
Resource resource = 3;
}
message GetResponse {
repeated Get messages = 1;
}
// rpc List
// The ListResponse message contains the Resource returned.
message ListRequest {
string namespace = 1;
string type = 2;
}
message ListResponse {
common.Metadata metadata = 1;
Resource definition = 2;
Resource resource = 3;
}
// rpc Watch
// The WatchResponse message contains the Resource returned.
message WatchRequest {
string namespace = 1;
string type = 2;
string id = 3;
uint32 tail_events = 4;
}
enum EventType {
CREATED = 0;
UPDATED = 1;
DESTROYED = 2;
}
message WatchResponse {
common.Metadata metadata = 1;
EventType event_type = 2;
Resource definition = 3;
Resource resource = 4;
}