165 lines
3.7 KiB
Protocol Buffer
165 lines
3.7 KiB
Protocol Buffer
syntax = "proto3";
|
|
// /home/andrey/Applications/protoc/bin/protoc -I ./ proto/system.proto --go_out=plugins=grpc:./
|
|
option java_multiple_files = true;
|
|
option java_package = "io.grpc.configService";
|
|
option java_outer_classname = "ConfigServiceProto";
|
|
|
|
package config.service;
|
|
|
|
import "google/api/annotations.proto";
|
|
import "google/protobuf/struct.proto";
|
|
|
|
service ConfigService {
|
|
// ===== INSTANCE =====
|
|
rpc GetInstances (RequestByIdentities) returns (InstancesResponse) {
|
|
option (google.api.http) = {
|
|
post: "/api/instances"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc CreateUpdateInstance (Instance) returns (Instance) {
|
|
option (google.api.http) = {
|
|
post: "/api/instances/save"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc DeleteInstance (RequestByIdentities) returns (DeleteResponse) {
|
|
option (google.api.http) = {
|
|
post: "/api/instances/delete"
|
|
body: "*"
|
|
};
|
|
}
|
|
// ===== INSTANCE END =====
|
|
|
|
// ===== MODULE =====
|
|
rpc GetModules (RequestByIdentities) returns (ModulesResponse) {
|
|
option (google.api.http) = {
|
|
post: "/api/modules"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc GetActiveModules (Empty) returns (ModulesResponse) {
|
|
option (google.api.http).get = "/api/modules/actives";
|
|
}
|
|
|
|
rpc CreateUpdateModule (Module) returns (Module) {
|
|
option (google.api.http) = {
|
|
post: "/api/modules/save"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc DeleteModule (RequestByIdentities) returns (DeleteResponse) {
|
|
option (google.api.http) = {
|
|
post: "/api/modules/delete"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc GetConnectedModules (Empty) returns (ConnectedModules) {
|
|
option (google.api.http).get = "/api/modules/connected";
|
|
}
|
|
// ===== MODULE END =====
|
|
|
|
// ===== CONFIG =====
|
|
rpc GetConfigs (RequestByIdentities) returns (ConfigsResponse) {
|
|
option (google.api.http) = {
|
|
post: "/api/configs"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc GetConfigByInstanceUUIDAndModuleName (RequestConfig) returns (Config) {
|
|
option (google.api.http).get = "/api/configs_by_module_names/{name}";
|
|
}
|
|
|
|
rpc CreateUpdateConfig (Config) returns (Config) {
|
|
option (google.api.http) = {
|
|
post: "/api/configs/save"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc DeleteConfig (RequestByIdentities) returns (DeleteResponse) {
|
|
option (google.api.http) = {
|
|
post: "/api/configs/delete"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc MarkConfigAsActive (RequestByLongIdentity) returns (Config) {
|
|
option (google.api.http) = {
|
|
post: "/api/configs/active"
|
|
body: "*"
|
|
};
|
|
}
|
|
// ===== CONFIG END =====
|
|
}
|
|
|
|
message RequestByLongIdentity {
|
|
int64 id = 1;
|
|
}
|
|
|
|
message RequestByIdentities {
|
|
repeated int32 ids = 1;
|
|
}
|
|
|
|
message RequestConfig {
|
|
string instanceUuid = 1;
|
|
string name = 2;
|
|
}
|
|
|
|
message ConnectedModules {
|
|
google.protobuf.Struct items = 1;
|
|
}
|
|
|
|
message Instance {
|
|
int32 id = 1;
|
|
string uuid = 2;
|
|
string name = 3;
|
|
string createdAt = 4;
|
|
}
|
|
|
|
message Module {
|
|
int32 id = 1;
|
|
int32 instanceId = 2;
|
|
string name = 3;
|
|
bool active = 4;
|
|
string createdAt = 5;
|
|
string lastConnectedAt = 6;
|
|
string lastDisconnectedAt = 7;
|
|
}
|
|
|
|
message Config {
|
|
int64 id = 1;
|
|
int32 moduleId = 2;
|
|
int32 version = 3;
|
|
bool active = 4;
|
|
string createdAt = 5;
|
|
string updatedAt = 6;
|
|
google.protobuf.Struct data = 7;
|
|
}
|
|
|
|
message InstancesResponse {
|
|
repeated Instance items = 1;
|
|
}
|
|
|
|
message ModulesResponse {
|
|
repeated Module items = 1;
|
|
}
|
|
|
|
message ConfigsResponse {
|
|
repeated Config items = 1;
|
|
}
|
|
|
|
message DeleteResponse {
|
|
int32 deleted = 1;
|
|
}
|
|
|
|
message Empty {
|
|
|
|
}
|