consul/proto-public/pbresource/resource.proto

174 lines
3.4 KiB
Protocol Buffer

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
syntax = "proto3";
package hashicorp.consul.resource;
import "annotations/ratelimit/ratelimit.proto";
import "google/protobuf/any.proto";
message Type {
string group = 1;
string group_version = 2;
string kind = 3;
}
message Tenancy {
string partition = 1;
string namespace = 2;
string peer_name = 3;
}
message ID {
string uid = 1;
string name = 2;
Type type = 3;
Tenancy tenancy = 4;
}
message Resource {
ID id = 1;
ID owner = 2;
string version = 3;
string generation = 4;
map<string, string> metadata = 5;
map<string, Status> status = 6;
google.protobuf.Any data = 7;
}
message Status {
string observed_generation = 1;
repeated Condition conditions = 2;
}
message Condition {
enum State {
// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX
STATE_UNKNOWN = 0;
STATE_TRUE = 1;
STATE_FALSE = 2;
}
string type = 1;
State state = 2;
string reason = 3;
string message = 4;
Reference resource = 5;
}
message Reference {
Type type = 1;
Tenancy tenancy = 2;
string name = 3;
string section = 4;
}
message WatchEvent {
enum Operation {
OPERATION_UNSPECIFIED = 0;
OPERATION_UPSERT = 1;
OPERATION_DELETE = 2;
}
Operation operation = 1;
Resource resource = 2;
}
service ResourceService {
rpc Read(ReadRequest) returns (ReadResponse) {
option (hashicorp.consul.internal.ratelimit.spec) = {
operation_type: OPERATION_TYPE_READ,
operation_category: OPERATION_CATEGORY_RESOURCE
};
}
rpc Write(WriteRequest) returns (WriteResponse) {
option (hashicorp.consul.internal.ratelimit.spec) = {
operation_type: OPERATION_TYPE_WRITE,
operation_category: OPERATION_CATEGORY_RESOURCE
};
}
rpc WriteStatus(WriteStatusRequest) returns (WriteStatusResponse) {
option (hashicorp.consul.internal.ratelimit.spec) = {
operation_type: OPERATION_TYPE_WRITE,
operation_category: OPERATION_CATEGORY_RESOURCE
};
}
rpc List(ListRequest) returns (ListResponse) {
option (hashicorp.consul.internal.ratelimit.spec) = {
operation_type: OPERATION_TYPE_READ,
operation_category: OPERATION_CATEGORY_RESOURCE
};
}
rpc Delete(DeleteRequest) returns (DeleteResponse) {
option (hashicorp.consul.internal.ratelimit.spec) = {
operation_type: OPERATION_TYPE_WRITE,
operation_category: OPERATION_CATEGORY_RESOURCE
};
}
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
rpc WatchList(WatchListRequest) returns (stream WatchEvent) {
option (hashicorp.consul.internal.ratelimit.spec) = {
operation_type: OPERATION_TYPE_READ,
operation_category: OPERATION_CATEGORY_RESOURCE
};
}
}
message ReadRequest {
ID id = 1;
}
message ReadResponse {
Resource resource = 1;
}
message ListRequest {
Type type = 1;
Tenancy tenancy = 2;
string name_prefix = 3;
}
message ListResponse {
repeated Resource resources = 1;
}
message WriteRequest {
Resource resource = 1;
}
message WriteResponse {
Resource resource = 1;
}
message WriteStatusRequest {
ID id = 1;
string version = 2;
string key = 3;
Status status = 4;
}
message WriteStatusResponse {
Resource resource = 1;
}
message DeleteRequest {
ID id = 1;
string version = 2;
}
message DeleteResponse {}
message WatchListRequest {
Type type = 1;
Tenancy tenancy = 2;
string name_prefix = 3;
}