policy_based_routing.proto 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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.networkconnectivity.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/longrunning/operations.proto";
  21. import "google/protobuf/timestamp.proto";
  22. option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1";
  23. option go_package = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1;networkconnectivity";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "PolicyBasedRoutingProto";
  26. option java_package = "com.google.cloud.networkconnectivity.v1";
  27. option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1";
  28. option ruby_package = "Google::Cloud::NetworkConnectivity::V1";
  29. // Policy-Based Routing allows GCP customers to specify flexibile routing
  30. // policies for Layer 4 traffic traversing through the connected service.
  31. service PolicyBasedRoutingService {
  32. option (google.api.default_host) = "networkconnectivity.googleapis.com";
  33. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  34. // Lists PolicyBasedRoutes in a given project and location.
  35. rpc ListPolicyBasedRoutes(ListPolicyBasedRoutesRequest) returns (ListPolicyBasedRoutesResponse) {
  36. option (google.api.http) = {
  37. get: "/v1/{parent=projects/*/locations/global}/policyBasedRoutes"
  38. };
  39. option (google.api.method_signature) = "parent";
  40. }
  41. // Gets details of a single PolicyBasedRoute.
  42. rpc GetPolicyBasedRoute(GetPolicyBasedRouteRequest) returns (PolicyBasedRoute) {
  43. option (google.api.http) = {
  44. get: "/v1/{name=projects/*/locations/global/policyBasedRoutes/*}"
  45. };
  46. option (google.api.method_signature) = "name";
  47. }
  48. // Creates a new PolicyBasedRoute in a given project and location.
  49. rpc CreatePolicyBasedRoute(CreatePolicyBasedRouteRequest) returns (google.longrunning.Operation) {
  50. option (google.api.http) = {
  51. post: "/v1/{parent=projects/*/locations/global}/policyBasedRoutes"
  52. body: "policy_based_route"
  53. };
  54. option (google.api.method_signature) = "parent,policy_based_route,policy_based_route_id";
  55. option (google.longrunning.operation_info) = {
  56. response_type: "PolicyBasedRoute"
  57. metadata_type: "OperationMetadata"
  58. };
  59. }
  60. // Deletes a single PolicyBasedRoute.
  61. rpc DeletePolicyBasedRoute(DeletePolicyBasedRouteRequest) returns (google.longrunning.Operation) {
  62. option (google.api.http) = {
  63. delete: "/v1/{name=projects/*/locations/global/policyBasedRoutes/*}"
  64. };
  65. option (google.api.method_signature) = "name";
  66. option (google.longrunning.operation_info) = {
  67. response_type: "google.protobuf.Empty"
  68. metadata_type: "OperationMetadata"
  69. };
  70. }
  71. }
  72. // Policy Based Routes (PBR) are more powerful routes that allows GCP customers
  73. // to route their L4 network traffic based on not just destination IP, but also
  74. // source IP, protocol and more. A PBR always take precedence when it conflicts
  75. // with other types of routes.
  76. // Next id: 19
  77. message PolicyBasedRoute {
  78. option (google.api.resource) = {
  79. type: "networkconnectivity.googleapis.com/PolicyBasedRoute"
  80. pattern: "projects/{project}/{location}/global/PolicyBasedRoutes/{policy_based_route}"
  81. };
  82. // VM instances to which this policy based route applies to.
  83. message VirtualMachine {
  84. // Optional. A list of VM instance tags to which this policy based route applies to.
  85. // VM instances that have ANY of tags specified here will install this
  86. // PBR.
  87. repeated string tags = 1 [(google.api.field_behavior) = OPTIONAL];
  88. }
  89. // InterconnectAttachment to which this route applies to.
  90. message InterconnectAttachment {
  91. // Optional. Cloud region to install this policy based route on interconnect
  92. // attachment. Use `all` to install it on all interconnect attachments.
  93. string region = 1 [(google.api.field_behavior) = OPTIONAL];
  94. }
  95. // Filter matches L4 traffic.
  96. message Filter {
  97. // The internet protocol version.
  98. enum ProtocolVersion {
  99. // Default value.
  100. PROTOCOL_VERSION_UNSPECIFIED = 0;
  101. // The PBR is for IPv4 internet protocol traffic.
  102. IPV4 = 1;
  103. }
  104. // Optional. The IP protocol that this policy based route applies to. Valid values are
  105. // 'TCP', 'UDP', and 'ALL'. Default is 'ALL'.
  106. string ip_protocol = 1 [(google.api.field_behavior) = OPTIONAL];
  107. // Optional. The source IP range of outgoing packets that this policy based route
  108. // applies to. Default is "0.0.0.0/0" if protocol version is IPv4.
  109. string src_range = 2 [(google.api.field_behavior) = OPTIONAL];
  110. // Optional. The destination IP range of outgoing packets that this policy based route
  111. // applies to. Default is "0.0.0.0/0" if protocol version is IPv4.
  112. string dest_range = 3 [(google.api.field_behavior) = OPTIONAL];
  113. // Required. Internet protocol versions this policy based route applies to. For this
  114. // version, only IPV4 is supported.
  115. ProtocolVersion protocol_version = 6 [(google.api.field_behavior) = REQUIRED];
  116. }
  117. // Informational warning message.
  118. message Warnings {
  119. // Warning code for Policy Based Routing. Expect to add values in the
  120. // future.
  121. enum Code {
  122. // Default value.
  123. WARNING_UNSPECIFIED = 0;
  124. // The policy based route is not active and functioning. Common causes are
  125. // the dependent network was deleted or the resource project was turned
  126. // off.
  127. RESOURCE_NOT_ACTIVE = 1;
  128. // The policy based route is being modified (e.g. created/deleted) at this
  129. // time.
  130. RESOURCE_BEING_MODIFIED = 2;
  131. }
  132. // Output only. A warning code, if applicable.
  133. Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  134. // Output only. Metadata about this warning in key: value format. The key should provides
  135. // more detail on the warning being returned. For example, for warnings
  136. // where there are no results in a list request for a particular zone, this
  137. // key might be scope and the key value might be the zone name. Other
  138. // examples might be a key indicating a deprecated resource and a suggested
  139. // replacement.
  140. map<string, string> data = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  141. // Output only. A human-readable description of the warning code.
  142. string warning_message = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  143. }
  144. // Target specifies network endpoints to which this policy based route applies
  145. // to. If none of the target is specified, the PBR will be installed on all
  146. // network endpoints (e.g. VMs, VPNs, and Interconnects) in the VPC.
  147. oneof target {
  148. // Optional. VM instances to which this policy based route applies to.
  149. VirtualMachine virtual_machine = 18 [(google.api.field_behavior) = OPTIONAL];
  150. // Optional. The interconnect attachments to which this route applies to.
  151. InterconnectAttachment interconnect_attachment = 9 [(google.api.field_behavior) = OPTIONAL];
  152. }
  153. oneof next_hop {
  154. // Optional. The IP of a global access enabled L4 ILB that should be the next hop to
  155. // handle matching packets. For this version, only next_hop_ilb_ip is
  156. // supported.
  157. string next_hop_ilb_ip = 12 [(google.api.field_behavior) = OPTIONAL];
  158. }
  159. // Immutable. A unique name of the resource in the form of
  160. // `projects/{project_number}/locations/global/PolicyBasedRoutes/{policy_based_route_id}`
  161. string name = 1 [(google.api.field_behavior) = IMMUTABLE];
  162. // Output only. Time when the PolicyBasedRoute was created.
  163. google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  164. // Output only. Time when the PolicyBasedRoute was updated.
  165. google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  166. // User-defined labels.
  167. map<string, string> labels = 4;
  168. // Optional. An optional description of this resource. Provide this field when you
  169. // create the resource.
  170. string description = 5 [(google.api.field_behavior) = OPTIONAL];
  171. // Required. Fully-qualified URL of the network that this route applies to. e.g.
  172. // projects/my-project/global/networks/my-network.
  173. string network = 6 [
  174. (google.api.field_behavior) = REQUIRED,
  175. (google.api.resource_reference) = {
  176. type: "compute.googleapis.com/Network"
  177. }
  178. ];
  179. // Required. The filter to match L4 traffic.
  180. Filter filter = 10 [(google.api.field_behavior) = REQUIRED];
  181. // Optional. The priority of this policy based route. Priority is used to break ties in
  182. // cases where there are more than one matching policy based routes found. In
  183. // cases where multiple policy based routes are matched, the one with the
  184. // lowest-numbered priority value wins. The default value is 1000. The
  185. // priority value must be from 1 to 65535, inclusive.
  186. int32 priority = 11 [(google.api.field_behavior) = OPTIONAL];
  187. // Output only. If potential misconfigurations are detected for this route,
  188. // this field will be populated with warning messages.
  189. repeated Warnings warnings = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
  190. // Output only. Server-defined fully-qualified URL for this resource.
  191. string self_link = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
  192. // Output only. Type of this resource. Always networkconnectivity#policyBasedRoute for
  193. // Policy Based Route resources.
  194. string kind = 16 [(google.api.field_behavior) = OUTPUT_ONLY];
  195. }
  196. // Request for [PolicyBasedRouting.ListPolicyBasedRoutes][] method.
  197. message ListPolicyBasedRoutesRequest {
  198. // Required. The parent resource's name.
  199. string parent = 1 [
  200. (google.api.field_behavior) = REQUIRED,
  201. (google.api.resource_reference) = {
  202. type: "locations.googleapis.com/Location"
  203. }
  204. ];
  205. // The maximum number of results per page that should be returned.
  206. int32 page_size = 2;
  207. // The page token.
  208. string page_token = 3;
  209. // A filter expression that filters the results listed in the response.
  210. string filter = 4;
  211. // Sort the results by a certain order.
  212. string order_by = 5;
  213. }
  214. // Response for [PolicyBasedRouting.ListPolicyBasedRoutes][] method.
  215. message ListPolicyBasedRoutesResponse {
  216. // Policy based routes to be returned.
  217. repeated PolicyBasedRoute policy_based_routes = 1;
  218. // The next pagination token in the List response. It should be used as
  219. // page_token for the following request. An empty value means no more result.
  220. string next_page_token = 2;
  221. // Locations that could not be reached.
  222. repeated string unreachable = 3;
  223. }
  224. // Request for [PolicyBasedRouting.GetPolicyBasedRoute][] method.
  225. message GetPolicyBasedRouteRequest {
  226. // Required. Name of the PolicyBasedRoute resource to get.
  227. string name = 1 [
  228. (google.api.field_behavior) = REQUIRED,
  229. (google.api.resource_reference) = {
  230. type: "networkconnectivity.googleapis.com/PolicyBasedRoute"
  231. }
  232. ];
  233. }
  234. // Request for [PolicyBasedRouting.CreatePolicyBasedRoute][] method.
  235. message CreatePolicyBasedRouteRequest {
  236. // Required. The parent resource's name of the PolicyBasedRoute.
  237. string parent = 1 [
  238. (google.api.field_behavior) = REQUIRED,
  239. (google.api.resource_reference) = {
  240. type: "locations.googleapis.com/Location"
  241. }
  242. ];
  243. // Optional. Unique id for the Policy Based Route to create.
  244. string policy_based_route_id = 2 [(google.api.field_behavior) = OPTIONAL];
  245. // Required. Initial values for a new Policy Based Route.
  246. PolicyBasedRoute policy_based_route = 3 [(google.api.field_behavior) = REQUIRED];
  247. // Optional. An optional request ID to identify requests. Specify a unique request ID
  248. // so that if you must retry your request, the server will know to ignore
  249. // the request if it has already been completed. The server will guarantee
  250. // that for at least 60 minutes since the first request.
  251. //
  252. // For example, consider a situation where you make an initial request and t
  253. // he request times out. If you make the request again with the same request
  254. // ID, the server can check if original operation with the same request ID
  255. // was received, and if so, will ignore the second request. This prevents
  256. // clients from accidentally creating duplicate commitments.
  257. //
  258. // The request ID must be a valid UUID with the exception that zero UUID is
  259. // not supported (00000000-0000-0000-0000-000000000000).
  260. string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
  261. }
  262. // Request for [PolicyBasedRouting.DeletePolicyBasedRoute][] method.
  263. message DeletePolicyBasedRouteRequest {
  264. // Required. Name of the PolicyBasedRoute resource to delete.
  265. string name = 1 [
  266. (google.api.field_behavior) = REQUIRED,
  267. (google.api.resource_reference) = {
  268. type: "networkconnectivity.googleapis.com/PolicyBasedRoute"
  269. }
  270. ];
  271. // Optional. An optional request ID to identify requests. Specify a unique request ID
  272. // so that if you must retry your request, the server will know to ignore
  273. // the request if it has already been completed. The server will guarantee
  274. // that for at least 60 minutes after the first request.
  275. //
  276. // For example, consider a situation where you make an initial request and t
  277. // he request times out. If you make the request again with the same request
  278. // ID, the server can check if original operation with the same request ID
  279. // was received, and if so, will ignore the second request. This prevents
  280. // clients from accidentally creating duplicate commitments.
  281. //
  282. // The request ID must be a valid UUID with the exception that zero UUID is
  283. // not supported (00000000-0000-0000-0000-000000000000).
  284. string request_id = 2 [(google.api.field_behavior) = OPTIONAL];
  285. }