zone.proto 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. syntax = "proto3";
  2. package cloudflareApi.zone;
  3. option go_package = "./cloudflareApi/zone";
  4. option java_multiple_files = true;
  5. option java_package = "io.grpc.cloudflare.zone";
  6. option java_outer_classname = "zoneProto";
  7. service ZoneCloudflare {
  8. //Zone CURD
  9. rpc ZoneIDByNameCloudflare (ZoneIDByNameRequestCloudflare) returns (ZoneIDByNameReplyCloudflare) {}
  10. rpc ZoneDetails (ZoneDetailsRequestCloudflare) returns (ZoneDetailsReplyCloudflare){}
  11. rpc GetZones (GetZonesRequestCloudflare) returns (GetZonesReplyCloudflare){}
  12. rpc EditZone (EditZoneRequestCloudflare) returns (EditZoneReplyCloudflare){}
  13. rpc DeleteZone (DeleteZoneRequestCloudflare) returns (DeleteZoneReplyCloudflare){}
  14. rpc ListZones(ListZonesRequestCloudflare) returns (ZonesList){}
  15. rpc ListZonesByAccountId(ListZonesByAccountIdRequestCloudflare) returns (ZonesList){}
  16. rpc ActivationCheck(ActivationCheckRequestCloudflare) returns (ActivationCheckReplyCloudflare){}
  17. //PageRule CURD
  18. rpc ListPageRule(ListPageRuleRequestCloudflare) returns (PageRuleList){}
  19. rpc CreatePageRule(CreatePageRuleRequestCloudflare) returns (PageRule){}
  20. rpc UpdatePageRule(UpdatePageRuleRequestCloudflare) returns (PageRule){}
  21. rpc DeletePageRule(DeletePageRuleRequestCloudflare) returns (PageRule){}
  22. rpc UpdatePageRulesPriorities(UpdatePageRulesPrioritiesRequestCloudflare) returns(PageRuleList){}
  23. //RuleSet UR
  24. rpc UpdateRuleSet(UpdateRuleSetRequestCloudflare) returns (RuleList){}
  25. rpc GetRuleSet(GetRuleSetRequestCloudflare) returns (RuleList){}
  26. }
  27. //Zone CURD
  28. message ZoneCloudflareEntity{
  29. string id = 1;
  30. string name = 2;
  31. Plan plan = 3;
  32. Plan plan_pending = 4;
  33. string status = 5;
  34. bool paused = 6;
  35. string type = 7;
  36. string verification_key = 8;
  37. message Plan {
  38. string id = 1;
  39. string name = 2;
  40. sint64 price = 3;
  41. }
  42. }
  43. message ZoneIDByNameRequestCloudflare {
  44. string apiKey = 1;
  45. string apiEmail = 2;
  46. string zoneName = 3;
  47. }
  48. message ZoneIDByNameReplyCloudflare {
  49. string zoneId = 1;
  50. }
  51. message ZoneDetailsRequestCloudflare {
  52. string apiKey = 1;
  53. string apiEmail = 2;
  54. string zoneId = 3;
  55. }
  56. message ZoneDetailsReplyCloudflare{
  57. ZoneCloudflareEntity result = 1;
  58. }
  59. message GetZonesRequestCloudflare {
  60. string apiKey = 1;
  61. string apiEmail = 2;
  62. string domain = 3;
  63. }
  64. message GetZonesReplyCloudflare{
  65. repeated ZoneCloudflareEntity result = 1;
  66. bool success = 2;
  67. }
  68. message ListZonesRequestCloudflare {
  69. string apiKey = 1;
  70. string apiEmail = 2;
  71. }
  72. message ListZonesByAccountIdRequestCloudflare {
  73. string apiKey = 1;
  74. string apiEmail = 2;
  75. string accountId = 3;
  76. }
  77. message ZonesList{
  78. repeated ZoneCloudflareEntity result = 1;
  79. }
  80. message EditZoneRequestCloudflare {
  81. string apiKey = 1;
  82. string apiEmail = 2;
  83. string zoneId = 3;
  84. optional bool paused = 4;
  85. optional string planId = 5;
  86. optional string type = 6;
  87. }
  88. message EditZoneReplyCloudflare{
  89. ZoneCloudflareEntity result = 1;
  90. bool success = 2;
  91. }
  92. message DeleteZoneRequestCloudflare {
  93. string apiKey = 1;
  94. string apiEmail = 2;
  95. string zoneId = 3;
  96. }
  97. message DeleteZoneReplyCloudflare{
  98. bool success = 1;
  99. string id = 2;
  100. }
  101. message ActivationCheckRequestCloudflare {
  102. string apiKey = 1;
  103. string apiEmail = 2;
  104. string zoneId = 3;
  105. }
  106. message ActivationCheckReplyCloudflare{
  107. bool success = 1;
  108. }
  109. //PageRule CRUD
  110. message PageRule{
  111. optional string id = 1;
  112. string expression = 2;
  113. optional uint32 ttl = 3;
  114. optional string queryArgsType = 4;
  115. repeated string queryArgs = 5;
  116. optional string originHost = 6;
  117. optional uint32 originProtocol = 7;
  118. // int64 priority = 8;
  119. }
  120. message PageRuleList{
  121. repeated PageRule page_rules = 1;
  122. }
  123. message ListPageRuleRequestCloudflare{
  124. string apiKey = 1;
  125. string apiEmail = 2;
  126. string zoneId = 3;
  127. }
  128. message CreatePageRuleRequestCloudflare{
  129. string apiKey = 1;
  130. string apiEmail = 2;
  131. string zoneId = 3;
  132. PageRule page_rule = 4;
  133. }
  134. message UpdatePageRuleRequestCloudflare{
  135. string apiKey = 1;
  136. string apiEmail = 2;
  137. string zoneId = 3;
  138. PageRule page_rule = 4;
  139. }
  140. message DeletePageRuleRequestCloudflare{
  141. string apiKey = 1;
  142. string apiEmail = 2;
  143. string zoneId = 3;
  144. string page_rule_id = 4;
  145. }
  146. //RuleSet UR
  147. enum Phase{
  148. http_request_sanitize = 0; //URL 规范化
  149. http_request_transform = 1; //URL 重写规则
  150. // http_request_origin = 2; //起源规则
  151. // http_request_cache_settings = 3; //缓存规则
  152. // http_config_settings = 4; //配置规则
  153. // http_request_dynamic_redirect = 5; //动态重定向
  154. // ddos_l7 = 6; //HTTP DDoS 攻击防护
  155. // http_request_firewall_custom = 7; //Web 应用程序防火墙 (WAF)
  156. // http_ratelimit = 8; //限速规则
  157. // http_request_firewall_managed = 9; //Web 应用程序防火墙 (WAF)
  158. // http_request_sbfm = 10; //超级机器人战斗模式
  159. // http_request_redirect = 11; //批量重定向
  160. http_request_late_transform = 12; //HTTP 请求头修改规则
  161. // http_custom_errors = 13; //自定义错误响应
  162. http_response_headers_transform = 14; //HTTP响应头修改规则
  163. // http_response_firewall_managed = 15; //Cloudflare 敏感数据检测(数据丢失防护)
  164. // http_log_custom_fields = 16; //日志推送自定义字段
  165. }
  166. message Rule{
  167. string expression = 1;
  168. // optional uint32 ttl = 2;
  169. // optional string queryArgsType = 3;
  170. // repeated string queryArgs = 4;
  171. // optional string originHost = 5;
  172. optional string originPath = 6;
  173. // optional uint32 originProtocol = 7;
  174. map<string, string> requestHeader = 8;
  175. map<string, string> responseHeader = 9;
  176. }
  177. message RuleList{
  178. repeated Rule rules = 1;
  179. }
  180. message GetRuleSetRequestCloudflare{
  181. string apiKey = 1;
  182. string apiEmail = 2;
  183. string zoneId = 3;
  184. Phase phase = 4;
  185. }
  186. message UpdateRuleSetRequestCloudflare{
  187. string apiKey = 1;
  188. string apiEmail = 2;
  189. string zoneId = 3;
  190. Phase phase = 4;
  191. repeated Rule rules = 5;
  192. }
  193. message UpdatePageRulesPrioritiesStruct{
  194. string id = 1;
  195. int64 priority = 2;
  196. }
  197. message UpdatePageRulesPrioritiesRequestCloudflare{
  198. string apiKey = 1;
  199. string apiEmail = 2;
  200. string zoneId = 3;
  201. repeated UpdatePageRulesPrioritiesStruct data = 4;
  202. }