dragonfly/pkg/rpc/manager/manager.proto

152 lines
4.8 KiB
Protocol Buffer

/*
* Copyright 2020 The Dragonfly Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto3";
package manager;
import "google/protobuf/empty.proto";
import "validate/validate.proto";
option go_package = "d7y.io/dragonfly/v2/pkg/rpc/manager";
enum SourceType {
SCHEDULER_SOURCE = 0;
CLIENT_SOURCE = 1;
CDN_SOURCE = 2;
}
message CDNCluster {
uint64 id = 1;
string name = 2;
string bio = 3;
bytes config = 4;
SecurityGroup security_group = 6;
}
message SecurityGroup {
uint64 id = 1;
string name = 2;
string bio = 3;
string domain = 4;
string proxy_domain = 5;
}
message CDN {
uint64 id = 1;
string host_name = 2;
string idc = 3;
string location = 4;
string ip = 5;
int32 port = 6;
int32 download_port = 7;
string state = 8;
uint64 cdn_cluster_id = 9;
CDNCluster cdn_cluster = 10;
}
message GetCDNRequest {
SourceType source_type = 1 [(validate.rules).enum.defined_only = true];
string host_name = 2 [(validate.rules).string.hostname = true];
uint64 cdn_cluster_id = 3 [(validate.rules).uint64 = {gte: 1}];
}
message UpdateCDNRequest {
SourceType source_type = 1 [(validate.rules).enum.defined_only = true];
string host_name = 2 [(validate.rules).string.hostname = true];
string idc = 3 [(validate.rules).string = {min_len: 1, max_len: 1024, ignore_empty: true}];
string location = 4 [(validate.rules).string = {max_len: 1024, ignore_empty: true}];
string ip = 5 [(validate.rules).string = {ip: true}];
int32 port = 6 [(validate.rules).int32 = {gte: 1024, lt: 65535}];
int32 download_port = 7 [(validate.rules).int32 = {gte: 1024, lt: 65535}];
uint64 cdn_cluster_id = 8 [(validate.rules).uint64 = {gte: 1}];
}
message SchedulerCluster {
uint64 id = 1;
string name = 2;
string bio = 3;
bytes config = 4;
bytes client_config = 5;
SecurityGroup security_group = 7;
}
message Scheduler {
uint64 id = 1;
string host_name = 2;
string vips = 3;
string idc = 4;
string location = 5;
bytes net_config = 6;
string ip = 7;
int32 port = 8;
string state = 9;
uint64 scheduler_cluster_id = 10;
SchedulerCluster scheduler_cluster = 11;
repeated CDN cdns = 12;
}
message GetSchedulerRequest {
SourceType source_type = 1 [(validate.rules).enum.defined_only = true];
string host_name = 2 [(validate.rules).string.hostname = true];
uint64 scheduler_cluster_id = 3 [(validate.rules).uint64 = {gte: 1}];
}
message UpdateSchedulerRequest {
SourceType source_type = 1 [(validate.rules).enum.defined_only = true];
string host_name = 2 [(validate.rules).string.hostname = true];
string vips = 4 [(validate.rules).string = {min_len: 1, max_len: 1024, ignore_empty: true}];
string idc = 5 [(validate.rules).string = {min_len: 1, max_len: 1024, ignore_empty: true}];
string location = 6 [(validate.rules).string = {max_len: 1024, ignore_empty: true}];
bytes net_config = 7 [(validate.rules).bytes = {min_len: 1, ignore_empty: true}];
string ip = 8 [(validate.rules).string = {ip: true}];
int32 port = 9 [(validate.rules).int32 = {gte: 1024, lt: 65535}];
uint64 scheduler_cluster_id = 3 [(validate.rules).uint64 = {gte: 1}];
}
message ListSchedulersRequest {
SourceType source_type = 1 [(validate.rules).enum.defined_only = true];
string host_name = 2 [(validate.rules).string.hostname = true];
string ip = 3 [(validate.rules).string.ip = true];
map<string, string> host_info = 5 [(validate.rules).map.ignore_empty = true];
}
message ListSchedulersResponse {
repeated Scheduler schedulers = 1;
}
message KeepAliveRequest {
SourceType source_type = 1 [(validate.rules).enum.defined_only = true];
string host_name = 2 [(validate.rules).string.hostname = true];
uint64 cluster_id = 3 [(validate.rules).uint64 = {gte: 1}];
}
// Manager RPC Service
service Manager {
// Get CDN and CDN cluster configuration
rpc GetCDN(GetCDNRequest) returns(CDN);
// Update CDN configuration
rpc UpdateCDN(UpdateCDNRequest) returns(CDN);
// Get Scheduler and Scheduler cluster configuration
rpc GetScheduler(GetSchedulerRequest)returns(Scheduler);
// Update scheduler configuration
rpc UpdateScheduler(UpdateSchedulerRequest) returns(Scheduler);
// List acitve schedulers configuration
rpc ListSchedulers(ListSchedulersRequest)returns(ListSchedulersResponse);
// KeepAlive with manager
rpc KeepAlive(stream KeepAliveRequest)returns(google.protobuf.Empty);
}