1// Copyright 2023 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 15syntax = "proto3"; 16 17package google.cloud.networkservices.v1; 18 19import "google/api/field_behavior.proto"; 20import "google/api/resource.proto"; 21import "google/protobuf/field_mask.proto"; 22import "google/protobuf/timestamp.proto"; 23 24option csharp_namespace = "Google.Cloud.NetworkServices.V1"; 25option go_package = "cloud.google.com/go/networkservices/apiv1/networkservicespb;networkservicespb"; 26option java_multiple_files = true; 27option java_outer_classname = "TlsRouteProto"; 28option java_package = "com.google.cloud.networkservices.v1"; 29option php_namespace = "Google\\Cloud\\NetworkServices\\V1"; 30option ruby_package = "Google::Cloud::NetworkServices::V1"; 31 32// TlsRoute defines how traffic should be routed based on SNI and other matching 33// L3 attributes. 34message TlsRoute { 35 option (google.api.resource) = { 36 type: "networkservices.googleapis.com/TlsRoute" 37 pattern: "projects/{project}/locations/{location}/tlsRoutes/{tls_route}" 38 }; 39 40 // Specifies how to match traffic and how to route traffic when traffic is 41 // matched. 42 message RouteRule { 43 // Required. RouteMatch defines the predicate used to match requests to a 44 // given action. Multiple match types are "OR"ed for evaluation. 45 repeated RouteMatch matches = 1 [(google.api.field_behavior) = REQUIRED]; 46 47 // Required. The detailed rule defining how to route matched traffic. 48 RouteAction action = 2 [(google.api.field_behavior) = REQUIRED]; 49 } 50 51 // RouteMatch defines the predicate used to match requests to a given action. 52 // Multiple match types are "AND"ed for evaluation. 53 // If no routeMatch field is specified, this rule will unconditionally match 54 // traffic. 55 message RouteMatch { 56 // Optional. SNI (server name indicator) to match against. 57 // SNI will be matched against all wildcard domains, i.e. `www.example.com` 58 // will be first matched against `www.example.com`, then `*.example.com`, 59 // then `*.com.` 60 // Partial wildcards are not supported, and values like *w.example.com are 61 // invalid. 62 // At least one of sni_host and alpn is required. 63 // Up to 5 sni hosts across all matches can be set. 64 repeated string sni_host = 1 [(google.api.field_behavior) = OPTIONAL]; 65 66 // Optional. ALPN (Application-Layer Protocol Negotiation) to match against. 67 // Examples: "http/1.1", "h2". 68 // At least one of sni_host and alpn is required. 69 // Up to 5 alpns across all matches can be set. 70 repeated string alpn = 2 [(google.api.field_behavior) = OPTIONAL]; 71 } 72 73 // The specifications for routing traffic and applying associated policies. 74 message RouteAction { 75 // Required. The destination services to which traffic should be forwarded. 76 // At least one destination service is required. 77 repeated RouteDestination destinations = 1 78 [(google.api.field_behavior) = REQUIRED]; 79 } 80 81 // Describe the destination for traffic to be routed to. 82 message RouteDestination { 83 // Required. The URL of a BackendService to route traffic to. 84 string service_name = 1 [ 85 (google.api.field_behavior) = REQUIRED, 86 (google.api.resource_reference) = { 87 type: "compute.googleapis.com/BackendService" 88 } 89 ]; 90 91 // Optional. Specifies the proportion of requests forwareded to the backend 92 // referenced by the service_name field. This is computed as: 93 // - weight/Sum(weights in destinations) 94 // Weights in all destinations does not need to sum up to 100. 95 int32 weight = 2 [(google.api.field_behavior) = OPTIONAL]; 96 } 97 98 // Required. Name of the TlsRoute resource. It matches pattern 99 // `projects/*/locations/global/tlsRoutes/tls_route_name>`. 100 string name = 1 [(google.api.field_behavior) = REQUIRED]; 101 102 // Output only. Server-defined URL of this resource 103 string self_link = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; 104 105 // Output only. The timestamp when the resource was created. 106 google.protobuf.Timestamp create_time = 2 107 [(google.api.field_behavior) = OUTPUT_ONLY]; 108 109 // Output only. The timestamp when the resource was updated. 110 google.protobuf.Timestamp update_time = 3 111 [(google.api.field_behavior) = OUTPUT_ONLY]; 112 113 // Optional. A free-text description of the resource. Max length 1024 114 // characters. 115 string description = 4 [(google.api.field_behavior) = OPTIONAL]; 116 117 // Required. Rules that define how traffic is routed and handled. At least one 118 // RouteRule must be supplied. If there are multiple rules then the action 119 // taken will be the first rule to match. 120 repeated RouteRule rules = 5 [(google.api.field_behavior) = REQUIRED]; 121 122 // Optional. Meshes defines a list of meshes this TlsRoute is attached to, as 123 // one of the routing rules to route the requests served by the mesh. 124 // 125 // Each mesh reference should match the pattern: 126 // `projects/*/locations/global/meshes/<mesh_name>` 127 // 128 // The attached Mesh should be of a type SIDECAR 129 repeated string meshes = 6 [ 130 (google.api.field_behavior) = OPTIONAL, 131 (google.api.resource_reference) = { 132 type: "networkservices.googleapis.com/Mesh" 133 } 134 ]; 135 136 // Optional. Gateways defines a list of gateways this TlsRoute is attached to, 137 // as one of the routing rules to route the requests served by the gateway. 138 // 139 // Each gateway reference should match the pattern: 140 // `projects/*/locations/global/gateways/<gateway_name>` 141 repeated string gateways = 7 [ 142 (google.api.field_behavior) = OPTIONAL, 143 (google.api.resource_reference) = { 144 type: "networkservices.googleapis.com/Gateway" 145 } 146 ]; 147} 148 149// Request used with the ListTlsRoutes method. 150message ListTlsRoutesRequest { 151 // Required. The project and location from which the TlsRoutes should be 152 // listed, specified in the format `projects/*/locations/global`. 153 string parent = 1 [ 154 (google.api.field_behavior) = REQUIRED, 155 (google.api.resource_reference) = { 156 child_type: "networkservices.googleapis.com/TlsRoute" 157 } 158 ]; 159 160 // Maximum number of TlsRoutes to return per call. 161 int32 page_size = 2; 162 163 // The value returned by the last `ListTlsRoutesResponse` 164 // Indicates that this is a continuation of a prior `ListTlsRoutes` call, 165 // and that the system should return the next page of data. 166 string page_token = 3; 167} 168 169// Response returned by the ListTlsRoutes method. 170message ListTlsRoutesResponse { 171 // List of TlsRoute resources. 172 repeated TlsRoute tls_routes = 1; 173 174 // If there might be more results than those appearing in this response, then 175 // `next_page_token` is included. To get the next set of results, call this 176 // method again using the value of `next_page_token` as `page_token`. 177 string next_page_token = 2; 178} 179 180// Request used by the GetTlsRoute method. 181message GetTlsRouteRequest { 182 // Required. A name of the TlsRoute to get. Must be in the format 183 // `projects/*/locations/global/tlsRoutes/*`. 184 string name = 1 [ 185 (google.api.field_behavior) = REQUIRED, 186 (google.api.resource_reference) = { 187 type: "networkservices.googleapis.com/TlsRoute" 188 } 189 ]; 190} 191 192// Request used by the TlsRoute method. 193message CreateTlsRouteRequest { 194 // Required. The parent resource of the TlsRoute. Must be in the 195 // format `projects/*/locations/global`. 196 string parent = 1 [ 197 (google.api.field_behavior) = REQUIRED, 198 (google.api.resource_reference) = { 199 child_type: "networkservices.googleapis.com/TlsRoute" 200 } 201 ]; 202 203 // Required. Short name of the TlsRoute resource to be created. 204 string tls_route_id = 2 [(google.api.field_behavior) = REQUIRED]; 205 206 // Required. TlsRoute resource to be created. 207 TlsRoute tls_route = 3 [(google.api.field_behavior) = REQUIRED]; 208} 209 210// Request used by the UpdateTlsRoute method. 211message UpdateTlsRouteRequest { 212 // Optional. Field mask is used to specify the fields to be overwritten in the 213 // TlsRoute resource by the update. 214 // The fields specified in the update_mask are relative to the resource, not 215 // the full request. A field will be overwritten if it is in the mask. If the 216 // user does not provide a mask then all fields will be overwritten. 217 google.protobuf.FieldMask update_mask = 1 218 [(google.api.field_behavior) = OPTIONAL]; 219 220 // Required. Updated TlsRoute resource. 221 TlsRoute tls_route = 2 [(google.api.field_behavior) = REQUIRED]; 222} 223 224// Request used by the DeleteTlsRoute method. 225message DeleteTlsRouteRequest { 226 // Required. A name of the TlsRoute to delete. Must be in the format 227 // `projects/*/locations/global/tlsRoutes/*`. 228 string name = 1 [ 229 (google.api.field_behavior) = REQUIRED, 230 (google.api.resource_reference) = { 231 type: "networkservices.googleapis.com/TlsRoute" 232 } 233 ]; 234} 235