Skip to content

Commit ce616ab

Browse files
feat: add policy based routing" will work (#160)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 485359269 Source-Link: https://togithub.com/googleapis/googleapis/commit/016f3a2c5f2c05908cc9d41fbf12525239a16758 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/c28193b4648aca3adcd69128dc73609e4d8860a8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzI4MTkzYjQ2NDhhY2EzYWRjZDY5MTI4ZGM3MzYwOWU0ZDg4NjBhOCJ9
1 parent 9e2aaa7 commit ce616ab

29 files changed

+13251
-1760
lines changed

packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/common.proto

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ syntax = "proto3";
1717
package google.cloud.networkconnectivity.v1;
1818

1919
import "google/api/field_behavior.proto";
20+
import "google/api/resource.proto";
2021
import "google/protobuf/timestamp.proto";
2122

2223
option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1";
@@ -26,6 +27,14 @@ option java_outer_classname = "CommonProto";
2627
option java_package = "com.google.cloud.networkconnectivity.v1";
2728
option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1";
2829
option ruby_package = "Google::Cloud::NetworkConnectivity::V1";
30+
option (google.api.resource_definition) = {
31+
type: "compute.googleapis.com/InterconnectAttachment"
32+
pattern: "projects/{project}/regions/{region}/interconnectAttachments/{resource_id}"
33+
};
34+
option (google.api.resource_definition) = {
35+
type: "compute.googleapis.com/Network"
36+
pattern: "projects/{project}/global/networks/{resource_id}"
37+
};
2938

3039
// Represents the metadata of the long-running operation.
3140
message OperationMetadata {

packages/google-cloud-networkconnectivity/protos/google/cloud/networkconnectivity/v1/hub.proto

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

0 commit comments

Comments
 (0)