/* * 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 status = 8; 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]; } message CreateCDNRequest { SourceType source_type = 1 [(validate.rules).enum.defined_only = true]; string host_name = 2 [(validate.rules).string.hostname = true]; string idc = 4 [(validate.rules).string = {min_len: 1, max_len: 1024, ignore_empty: true}]; string location = 5 [(validate.rules).string = {max_len: 1024, ignore_empty: true}]; string ip = 6 [(validate.rules).string.ip = true]; int32 port = 7 [(validate.rules).int32 = {gte: 1024, lt: 65535}]; int32 download_port = 8 [(validate.rules).int32 = {gte: 1024, lt: 65535}]; } 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, ignore_empty: true}]; int32 port = 6 [(validate.rules).int32 = {gte: 1024, lt: 65535, ignore_empty: true}]; int32 download_port = 7 [(validate.rules).int32 = {gte: 1024, lt: 65535, ignore_empty: true}]; } message AddCDNToCDNClusterRequest { SourceType source_type = 1 [(validate.rules).enum.defined_only = true]; uint64 cdn_id = 2 [(validate.rules).uint64 = {ignore_empty: true}]; uint64 cdn_cluster_id = 3 [(validate.rules).uint64 = {ignore_empty: true}]; } 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 status = 9; 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]; } message CreateSchedulerRequest { 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}]; } 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, ignore_empty: true}]; int32 port = 9 [(validate.rules).int32 = {gte: 1024, lt: 65535, ignore_empty: true}]; } message AddSchedulerClusterToSchedulerClusterRequest { SourceType source_type = 1 [(validate.rules).enum.defined_only = true]; uint64 scheduler_id = 2 [(validate.rules).uint64 = {ignore_empty: true}]; uint64 scheduler_cluster_id = 3 [(validate.rules).uint64 = {ignore_empty: true}]; } 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 host_info = 4 [(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]; } // Manager RPC Service service Manager { // Get CDN and CDN cluster configuration rpc GetCDN(GetCDNRequest) returns(CDN); // Create CDN configuration rpc CreateCDN(CreateCDNRequest) returns(CDN); // Update CDN configuration rpc UpdateCDN(UpdateCDNRequest) returns(CDN); // AddCDNToCDNCluster add cdn to cdn cluster rpc AddCDNToCDNCluster(AddCDNToCDNClusterRequest) returns(google.protobuf.Empty); // Get Scheduler and Scheduler cluster configuration rpc GetScheduler(GetSchedulerRequest)returns(Scheduler); // Create scheduler configuration rpc CreateScheduler(CreateSchedulerRequest) returns(Scheduler); // Update scheduler configuration rpc UpdateScheduler(UpdateSchedulerRequest) returns(Scheduler); // AddSchedulerClusterToSchedulerCluster add scheduler to scheduler cluster rpc AddSchedulerClusterToSchedulerCluster(AddSchedulerClusterToSchedulerClusterRequest) returns(google.protobuf.Empty); // List acitve schedulers configuration rpc ListSchedulers(ListSchedulersRequest)returns(ListSchedulersResponse); // KeepAlive with manager rpc KeepAlive(stream KeepAliveRequest)returns(google.protobuf.Empty); }