tcp_route.proto 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.networkservices.v1;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/protobuf/field_mask.proto";
  19. import "google/protobuf/timestamp.proto";
  20. option csharp_namespace = "Google.Cloud.NetworkServices.V1";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/networkservices/v1;networkservices";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "TcpRouteProto";
  24. option java_package = "com.google.cloud.networkservices.v1";
  25. option php_namespace = "Google\\Cloud\\NetworkServices\\V1";
  26. option ruby_package = "Google::Cloud::NetworkServices::V1";
  27. option (google.api.resource_definition) = {
  28. type: "compute.googleapis.com/BackendService"
  29. pattern: "projects/{project}/locations/{location}/backendServices/{backend_service}"
  30. };
  31. // TcpRoute is the resource defining how TCP traffic should be routed by a
  32. // Mesh/Gateway resource.
  33. message TcpRoute {
  34. option (google.api.resource) = {
  35. type: "networkservices.googleapis.com/TcpRoute"
  36. pattern: "projects/{project}/locations/{location}/tcpRoutes/{tcp_route}"
  37. };
  38. // Specifies how to match traffic and how to route traffic when traffic is
  39. // matched.
  40. message RouteRule {
  41. // Optional. RouteMatch defines the predicate used to match requests to a given
  42. // action. Multiple match types are "OR"ed for evaluation.
  43. // If no routeMatch field is specified, this rule will unconditionally match
  44. // traffic.
  45. repeated RouteMatch matches = 1 [(google.api.field_behavior) = OPTIONAL];
  46. // Required. The detailed rule defining how to route matched traffic.
  47. RouteAction action = 2 [(google.api.field_behavior) = REQUIRED];
  48. }
  49. // RouteMatch defines the predicate used to match requests to a given action.
  50. // Multiple match types are "OR"ed for evaluation.
  51. // If no routeMatch field is specified, this rule will unconditionally match
  52. // traffic.
  53. message RouteMatch {
  54. // Required. Must be specified in the CIDR range format. A CIDR range consists of an
  55. // IP Address and a prefix length to construct the subnet mask. By default,
  56. // the prefix length is 32 (i.e. matches a single IP address). Only IPV4
  57. // addresses are supported.
  58. // Examples:
  59. // "10.0.0.1" - matches against this exact IP address.
  60. // "10.0.0.0/8" - matches against any IP address within the 10.0.0.0 subnet
  61. // and 255.255.255.0 mask.
  62. // "0.0.0.0/0" - matches against any IP address'.
  63. string address = 1 [(google.api.field_behavior) = REQUIRED];
  64. // Required. Specifies the destination port to match against.
  65. string port = 2 [(google.api.field_behavior) = REQUIRED];
  66. }
  67. // The specifications for routing traffic and applying associated policies.
  68. message RouteAction {
  69. // Optional. The destination services to which traffic should be forwarded. At least
  70. // one destination service is required.
  71. repeated RouteDestination destinations = 1 [(google.api.field_behavior) = OPTIONAL];
  72. // Optional. If true, Router will use the destination IP and port of the original
  73. // connection as the destination of the request. Default is false.
  74. bool original_destination = 3 [(google.api.field_behavior) = OPTIONAL];
  75. }
  76. // Describe the destination for traffic to be routed to.
  77. message RouteDestination {
  78. // Required. The URL of a BackendService to route traffic to.
  79. string service_name = 1 [
  80. (google.api.field_behavior) = REQUIRED,
  81. (google.api.resource_reference) = {
  82. type: "compute.googleapis.com/BackendService"
  83. }
  84. ];
  85. // Optional. Specifies the proportion of requests forwarded to the backend referenced
  86. // by the serviceName field. This is computed as:
  87. // weight/Sum(weights in this destination list).
  88. // For non-zero values, there may be some epsilon from the exact proportion
  89. // defined here depending on the precision an implementation supports.
  90. //
  91. // If only one serviceName is specified and it has a weight greater than 0,
  92. // 100% of the traffic is forwarded to that backend.
  93. //
  94. // If weights are specified for any one service name, they need to be
  95. // specified for all of them.
  96. //
  97. // If weights are unspecified for all services, then, traffic is distributed
  98. // in equal proportions to all of them.
  99. int32 weight = 2 [(google.api.field_behavior) = OPTIONAL];
  100. }
  101. // Required. Name of the TcpRoute resource. It matches pattern
  102. // `projects/*/locations/global/tcpRoutes/tcp_route_name>`.
  103. string name = 1 [(google.api.field_behavior) = REQUIRED];
  104. // Output only. Server-defined URL of this resource
  105. string self_link = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
  106. // Output only. The timestamp when the resource was created.
  107. google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  108. // Output only. The timestamp when the resource was updated.
  109. google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  110. // Optional. A free-text description of the resource. Max length 1024 characters.
  111. string description = 4 [(google.api.field_behavior) = OPTIONAL];
  112. // Required. Rules that define how traffic is routed and handled. At least one RouteRule
  113. // must be supplied. If there are multiple rules then the action taken will be
  114. // the first rule to match.
  115. repeated RouteRule rules = 5 [(google.api.field_behavior) = REQUIRED];
  116. // Optional. Meshes defines a list of meshes this TcpRoute is attached to, as one of the
  117. // routing rules to route the requests served by the mesh.
  118. //
  119. // Each mesh reference should match the pattern:
  120. // `projects/*/locations/global/meshes/<mesh_name>`
  121. //
  122. // The attached Mesh should be of a type SIDECAR
  123. repeated string meshes = 8 [
  124. (google.api.field_behavior) = OPTIONAL,
  125. (google.api.resource_reference) = {
  126. type: "networkservices.googleapis.com/Mesh"
  127. }
  128. ];
  129. // Optional. Gateways defines a list of gateways this TcpRoute is attached to, as one of
  130. // the routing rules to route the requests served by the gateway.
  131. //
  132. // Each gateway reference should match the pattern:
  133. // `projects/*/locations/global/gateways/<gateway_name>`
  134. repeated string gateways = 9 [
  135. (google.api.field_behavior) = OPTIONAL,
  136. (google.api.resource_reference) = {
  137. type: "networkservices.googleapis.com/Gateway"
  138. }
  139. ];
  140. // Optional. Set of label tags associated with the TcpRoute resource.
  141. map<string, string> labels = 10 [(google.api.field_behavior) = OPTIONAL];
  142. }
  143. // Request used with the ListTcpRoutes method.
  144. message ListTcpRoutesRequest {
  145. // Required. The project and location from which the TcpRoutes should be
  146. // listed, specified in the format `projects/*/locations/global`.
  147. string parent = 1 [
  148. (google.api.field_behavior) = REQUIRED,
  149. (google.api.resource_reference) = {
  150. child_type: "networkservices.googleapis.com/TcpRoute"
  151. }
  152. ];
  153. // Maximum number of TcpRoutes to return per call.
  154. int32 page_size = 2;
  155. // The value returned by the last `ListTcpRoutesResponse`
  156. // Indicates that this is a continuation of a prior `ListTcpRoutes` call,
  157. // and that the system should return the next page of data.
  158. string page_token = 3;
  159. }
  160. // Response returned by the ListTcpRoutes method.
  161. message ListTcpRoutesResponse {
  162. // List of TcpRoute resources.
  163. repeated TcpRoute tcp_routes = 1;
  164. // If there might be more results than those appearing in this response, then
  165. // `next_page_token` is included. To get the next set of results, call this
  166. // method again using the value of `next_page_token` as `page_token`.
  167. string next_page_token = 2;
  168. }
  169. // Request used by the GetTcpRoute method.
  170. message GetTcpRouteRequest {
  171. // Required. A name of the TcpRoute to get. Must be in the format
  172. // `projects/*/locations/global/tcpRoutes/*`.
  173. string name = 1 [
  174. (google.api.field_behavior) = REQUIRED,
  175. (google.api.resource_reference) = {
  176. type: "networkservices.googleapis.com/TcpRoute"
  177. }
  178. ];
  179. }
  180. // Request used by the TcpRoute method.
  181. message CreateTcpRouteRequest {
  182. // Required. The parent resource of the TcpRoute. Must be in the
  183. // format `projects/*/locations/global`.
  184. string parent = 1 [
  185. (google.api.field_behavior) = REQUIRED,
  186. (google.api.resource_reference) = {
  187. child_type: "networkservices.googleapis.com/TcpRoute"
  188. }
  189. ];
  190. // Required. Short name of the TcpRoute resource to be created. E.g. TODO(Add an
  191. // example).
  192. string tcp_route_id = 2 [(google.api.field_behavior) = REQUIRED];
  193. // Required. TcpRoute resource to be created.
  194. TcpRoute tcp_route = 3 [(google.api.field_behavior) = REQUIRED];
  195. }
  196. // Request used by the UpdateTcpRoute method.
  197. message UpdateTcpRouteRequest {
  198. // Optional. Field mask is used to specify the fields to be overwritten in the
  199. // TcpRoute resource by the update.
  200. // The fields specified in the update_mask are relative to the resource, not
  201. // the full request. A field will be overwritten if it is in the mask. If the
  202. // user does not provide a mask then all fields will be overwritten.
  203. google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL];
  204. // Required. Updated TcpRoute resource.
  205. TcpRoute tcp_route = 2 [(google.api.field_behavior) = REQUIRED];
  206. }
  207. // Request used by the DeleteTcpRoute method.
  208. message DeleteTcpRouteRequest {
  209. // Required. A name of the TcpRoute to delete. Must be in the format
  210. // `projects/*/locations/global/tcpRoutes/*`.
  211. string name = 1 [
  212. (google.api.field_behavior) = REQUIRED,
  213. (google.api.resource_reference) = {
  214. type: "networkservices.googleapis.com/TcpRoute"
  215. }
  216. ];
  217. }