• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 // Generated by the protocol buffer compiler.  DO NOT EDIT!
17 // source: google/api/routing.proto
18 
19 package com.google.api;
20 
21 /**
22  *
23  *
24  * <pre>
25  * Specifies the routing information that should be sent along with the request
26  * in the form of routing header.
27  * **NOTE:** All service configuration rules follow the "last one wins" order.
28  * The examples below will apply to an RPC which has the following request type:
29  * Message Definition:
30  *     message Request {
31  *       // The name of the Table
32  *       // Values can be of the following formats:
33  *       // - `projects/&lt;project&gt;/tables/&lt;table&gt;`
34  *       // - `projects/&lt;project&gt;/instances/&lt;instance&gt;/tables/&lt;table&gt;`
35  *       // - `region/&lt;region&gt;/zones/&lt;zone&gt;/tables/&lt;table&gt;`
36  *       string table_name = 1;
37  *       // This value specifies routing for replication.
38  *       // It can be in the following formats:
39  *       // - `profiles/&lt;profile_id&gt;`
40  *       // - a legacy `profile_id` that can be any string
41  *       string app_profile_id = 2;
42  *     }
43  * Example message:
44  *     {
45  *       table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
46  *       app_profile_id: profiles/prof_qux
47  *     }
48  * The routing header consists of one or multiple key-value pairs. Every key
49  * and value must be percent-encoded, and joined together in the format of
50  * `key1=value1&amp;key2=value2`.
51  * In the examples below I am skipping the percent-encoding for readablity.
52  * Example 1
53  * Extracting a field from the request to put into the routing header
54  * unchanged, with the key equal to the field name.
55  * annotation:
56  *     option (google.api.routing) = {
57  *       // Take the `app_profile_id`.
58  *       routing_parameters {
59  *         field: "app_profile_id"
60  *       }
61  *     };
62  * result:
63  *     x-goog-request-params: app_profile_id=profiles/prof_qux
64  * Example 2
65  * Extracting a field from the request to put into the routing header
66  * unchanged, with the key different from the field name.
67  * annotation:
68  *     option (google.api.routing) = {
69  *       // Take the `app_profile_id`, but name it `routing_id` in the header.
70  *       routing_parameters {
71  *         field: "app_profile_id"
72  *         path_template: "{routing_id=**}"
73  *       }
74  *     };
75  * result:
76  *     x-goog-request-params: routing_id=profiles/prof_qux
77  * Example 3
78  * Extracting a field from the request to put into the routing
79  * header, while matching a path template syntax on the field's value.
80  * NB: it is more useful to send nothing than to send garbage for the purpose
81  * of dynamic routing, since garbage pollutes cache. Thus the matching.
82  * Sub-example 3a
83  * The field matches the template.
84  * annotation:
85  *     option (google.api.routing) = {
86  *       // Take the `table_name`, if it's well-formed (with project-based
87  *       // syntax).
88  *       routing_parameters {
89  *         field: "table_name"
90  *         path_template: "{table_name=projects/&#42;&#47;instances/&#42;&#47;&#42;*}"
91  *       }
92  *     };
93  * result:
94  *     x-goog-request-params:
95  *     table_name=projects/proj_foo/instances/instance_bar/table/table_baz
96  * Sub-example 3b
97  * The field does not match the template.
98  * annotation:
99  *     option (google.api.routing) = {
100  *       // Take the `table_name`, if it's well-formed (with region-based
101  *       // syntax).
102  *       routing_parameters {
103  *         field: "table_name"
104  *         path_template: "{table_name=regions/&#42;&#47;zones/&#42;&#47;&#42;*}"
105  *       }
106  *     };
107  * result:
108  *     &lt;no routing header will be sent&gt;
109  * Sub-example 3c
110  * Multiple alternative conflictingly named path templates are
111  * specified. The one that matches is used to construct the header.
112  * annotation:
113  *     option (google.api.routing) = {
114  *       // Take the `table_name`, if it's well-formed, whether
115  *       // using the region- or projects-based syntax.
116  *       routing_parameters {
117  *         field: "table_name"
118  *         path_template: "{table_name=regions/&#42;&#47;zones/&#42;&#47;&#42;*}"
119  *       }
120  *       routing_parameters {
121  *         field: "table_name"
122  *         path_template: "{table_name=projects/&#42;&#47;instances/&#42;&#47;&#42;*}"
123  *       }
124  *     };
125  * result:
126  *     x-goog-request-params:
127  *     table_name=projects/proj_foo/instances/instance_bar/table/table_baz
128  * Example 4
129  * Extracting a single routing header key-value pair by matching a
130  * template syntax on (a part of) a single request field.
131  * annotation:
132  *     option (google.api.routing) = {
133  *       // Take just the project id from the `table_name` field.
134  *       routing_parameters {
135  *         field: "table_name"
136  *         path_template: "{routing_id=projects/&#42;}/&#42;*"
137  *       }
138  *     };
139  * result:
140  *     x-goog-request-params: routing_id=projects/proj_foo
141  * Example 5
142  * Extracting a single routing header key-value pair by matching
143  * several conflictingly named path templates on (parts of) a single request
144  * field. The last template to match "wins" the conflict.
145  * annotation:
146  *     option (google.api.routing) = {
147  *       // If the `table_name` does not have instances information,
148  *       // take just the project id for routing.
149  *       // Otherwise take project + instance.
150  *       routing_parameters {
151  *         field: "table_name"
152  *         path_template: "{routing_id=projects/&#42;}/&#42;*"
153  *       }
154  *       routing_parameters {
155  *         field: "table_name"
156  *         path_template: "{routing_id=projects/&#42;&#47;instances/&#42;}/&#42;*"
157  *       }
158  *     };
159  * result:
160  *     x-goog-request-params:
161  *     routing_id=projects/proj_foo/instances/instance_bar
162  * Example 6
163  * Extracting multiple routing header key-value pairs by matching
164  * several non-conflicting path templates on (parts of) a single request field.
165  * Sub-example 6a
166  * Make the templates strict, so that if the `table_name` does not
167  * have an instance information, nothing is sent.
168  * annotation:
169  *     option (google.api.routing) = {
170  *       // The routing code needs two keys instead of one composite
171  *       // but works only for the tables with the "project-instance" name
172  *       // syntax.
173  *       routing_parameters {
174  *         field: "table_name"
175  *         path_template: "{project_id=projects/&#42;}/instances/&#42;&#47;&#42;*"
176  *       }
177  *       routing_parameters {
178  *         field: "table_name"
179  *         path_template: "projects/&#42;&#47;{instance_id=instances/&#42;}/&#42;*"
180  *       }
181  *     };
182  * result:
183  *     x-goog-request-params:
184  *     project_id=projects/proj_foo&amp;instance_id=instances/instance_bar
185  * Sub-example 6b
186  * Make the templates loose, so that if the `table_name` does not
187  * have an instance information, just the project id part is sent.
188  * annotation:
189  *     option (google.api.routing) = {
190  *       // The routing code wants two keys instead of one composite
191  *       // but will work with just the `project_id` for tables without
192  *       // an instance in the `table_name`.
193  *       routing_parameters {
194  *         field: "table_name"
195  *         path_template: "{project_id=projects/&#42;}/&#42;*"
196  *       }
197  *       routing_parameters {
198  *         field: "table_name"
199  *         path_template: "projects/&#42;&#47;{instance_id=instances/&#42;}/&#42;*"
200  *       }
201  *     };
202  * result (is the same as 6a for our example message because it has the instance
203  * information):
204  *     x-goog-request-params:
205  *     project_id=projects/proj_foo&amp;instance_id=instances/instance_bar
206  * Example 7
207  * Extracting multiple routing header key-value pairs by matching
208  * several path templates on multiple request fields.
209  * NB: note that here there is no way to specify sending nothing if one of the
210  * fields does not match its template. E.g. if the `table_name` is in the wrong
211  * format, the `project_id` will not be sent, but the `routing_id` will be.
212  * The backend routing code has to be aware of that and be prepared to not
213  * receive a full complement of keys if it expects multiple.
214  * annotation:
215  *     option (google.api.routing) = {
216  *       // The routing needs both `project_id` and `routing_id`
217  *       // (from the `app_profile_id` field) for routing.
218  *       routing_parameters {
219  *         field: "table_name"
220  *         path_template: "{project_id=projects/&#42;}/&#42;*"
221  *       }
222  *       routing_parameters {
223  *         field: "app_profile_id"
224  *         path_template: "{routing_id=**}"
225  *       }
226  *     };
227  * result:
228  *     x-goog-request-params:
229  *     project_id=projects/proj_foo&amp;routing_id=profiles/prof_qux
230  * Example 8
231  * Extracting a single routing header key-value pair by matching
232  * several conflictingly named path templates on several request fields. The
233  * last template to match "wins" the conflict.
234  * annotation:
235  *     option (google.api.routing) = {
236  *       // The `routing_id` can be a project id or a region id depending on
237  *       // the table name format, but only if the `app_profile_id` is not set.
238  *       // If `app_profile_id` is set it should be used instead.
239  *       routing_parameters {
240  *         field: "table_name"
241  *         path_template: "{routing_id=projects/&#42;}/&#42;*"
242  *       }
243  *       routing_parameters {
244  *          field: "table_name"
245  *          path_template: "{routing_id=regions/&#42;}/&#42;*"
246  *       }
247  *       routing_parameters {
248  *         field: "app_profile_id"
249  *         path_template: "{routing_id=**}"
250  *       }
251  *     };
252  * result:
253  *     x-goog-request-params: routing_id=profiles/prof_qux
254  * Example 9
255  * Bringing it all together.
256  * annotation:
257  *     option (google.api.routing) = {
258  *       // For routing both `table_location` and a `routing_id` are needed.
259  *       //
260  *       // table_location can be either an instance id or a region+zone id.
261  *       //
262  *       // For `routing_id`, take the value of `app_profile_id`
263  *       // - If it's in the format `profiles/&lt;profile_id&gt;`, send
264  *       // just the `&lt;profile_id&gt;` part.
265  *       // - If it's any other literal, send it as is.
266  *       // If the `app_profile_id` is empty, and the `table_name` starts with
267  *       // the project_id, send that instead.
268  *       routing_parameters {
269  *         field: "table_name"
270  *         path_template: "projects/&#42;&#47;{table_location=instances/&#42;}/tables/&#42;"
271  *       }
272  *       routing_parameters {
273  *         field: "table_name"
274  *         path_template: "{table_location=regions/&#42;&#47;zones/&#42;}/tables/&#42;"
275  *       }
276  *       routing_parameters {
277  *         field: "table_name"
278  *         path_template: "{routing_id=projects/&#42;}/&#42;*"
279  *       }
280  *       routing_parameters {
281  *         field: "app_profile_id"
282  *         path_template: "{routing_id=**}"
283  *       }
284  *       routing_parameters {
285  *         field: "app_profile_id"
286  *         path_template: "profiles/{routing_id=*}"
287  *       }
288  *     };
289  * result:
290  *     x-goog-request-params:
291  *     table_location=instances/instance_bar&amp;routing_id=prof_qux
292  * </pre>
293  *
294  * Protobuf type {@code google.api.RoutingRule}
295  */
296 public final class RoutingRule extends com.google.protobuf.GeneratedMessageV3
297     implements
298     // @@protoc_insertion_point(message_implements:google.api.RoutingRule)
299     RoutingRuleOrBuilder {
300   private static final long serialVersionUID = 0L;
301   // Use RoutingRule.newBuilder() to construct.
RoutingRule(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)302   private RoutingRule(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
303     super(builder);
304   }
305 
RoutingRule()306   private RoutingRule() {
307     routingParameters_ = java.util.Collections.emptyList();
308   }
309 
310   @java.lang.Override
311   @SuppressWarnings({"unused"})
newInstance(UnusedPrivateParameter unused)312   protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
313     return new RoutingRule();
314   }
315 
316   @java.lang.Override
getUnknownFields()317   public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
318     return this.unknownFields;
319   }
320 
getDescriptor()321   public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
322     return com.google.api.RoutingProto.internal_static_google_api_RoutingRule_descriptor;
323   }
324 
325   @java.lang.Override
326   protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()327       internalGetFieldAccessorTable() {
328     return com.google.api.RoutingProto.internal_static_google_api_RoutingRule_fieldAccessorTable
329         .ensureFieldAccessorsInitialized(
330             com.google.api.RoutingRule.class, com.google.api.RoutingRule.Builder.class);
331   }
332 
333   public static final int ROUTING_PARAMETERS_FIELD_NUMBER = 2;
334 
335   @SuppressWarnings("serial")
336   private java.util.List<com.google.api.RoutingParameter> routingParameters_;
337   /**
338    *
339    *
340    * <pre>
341    * A collection of Routing Parameter specifications.
342    * **NOTE:** If multiple Routing Parameters describe the same key
343    * (via the `path_template` field or via the `field` field when
344    * `path_template` is not provided), "last one wins" rule
345    * determines which Parameter gets used.
346    * See the examples for more details.
347    * </pre>
348    *
349    * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
350    */
351   @java.lang.Override
getRoutingParametersList()352   public java.util.List<com.google.api.RoutingParameter> getRoutingParametersList() {
353     return routingParameters_;
354   }
355   /**
356    *
357    *
358    * <pre>
359    * A collection of Routing Parameter specifications.
360    * **NOTE:** If multiple Routing Parameters describe the same key
361    * (via the `path_template` field or via the `field` field when
362    * `path_template` is not provided), "last one wins" rule
363    * determines which Parameter gets used.
364    * See the examples for more details.
365    * </pre>
366    *
367    * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
368    */
369   @java.lang.Override
370   public java.util.List<? extends com.google.api.RoutingParameterOrBuilder>
getRoutingParametersOrBuilderList()371       getRoutingParametersOrBuilderList() {
372     return routingParameters_;
373   }
374   /**
375    *
376    *
377    * <pre>
378    * A collection of Routing Parameter specifications.
379    * **NOTE:** If multiple Routing Parameters describe the same key
380    * (via the `path_template` field or via the `field` field when
381    * `path_template` is not provided), "last one wins" rule
382    * determines which Parameter gets used.
383    * See the examples for more details.
384    * </pre>
385    *
386    * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
387    */
388   @java.lang.Override
getRoutingParametersCount()389   public int getRoutingParametersCount() {
390     return routingParameters_.size();
391   }
392   /**
393    *
394    *
395    * <pre>
396    * A collection of Routing Parameter specifications.
397    * **NOTE:** If multiple Routing Parameters describe the same key
398    * (via the `path_template` field or via the `field` field when
399    * `path_template` is not provided), "last one wins" rule
400    * determines which Parameter gets used.
401    * See the examples for more details.
402    * </pre>
403    *
404    * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
405    */
406   @java.lang.Override
getRoutingParameters(int index)407   public com.google.api.RoutingParameter getRoutingParameters(int index) {
408     return routingParameters_.get(index);
409   }
410   /**
411    *
412    *
413    * <pre>
414    * A collection of Routing Parameter specifications.
415    * **NOTE:** If multiple Routing Parameters describe the same key
416    * (via the `path_template` field or via the `field` field when
417    * `path_template` is not provided), "last one wins" rule
418    * determines which Parameter gets used.
419    * See the examples for more details.
420    * </pre>
421    *
422    * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
423    */
424   @java.lang.Override
getRoutingParametersOrBuilder(int index)425   public com.google.api.RoutingParameterOrBuilder getRoutingParametersOrBuilder(int index) {
426     return routingParameters_.get(index);
427   }
428 
429   private byte memoizedIsInitialized = -1;
430 
431   @java.lang.Override
isInitialized()432   public final boolean isInitialized() {
433     byte isInitialized = memoizedIsInitialized;
434     if (isInitialized == 1) return true;
435     if (isInitialized == 0) return false;
436 
437     memoizedIsInitialized = 1;
438     return true;
439   }
440 
441   @java.lang.Override
writeTo(com.google.protobuf.CodedOutputStream output)442   public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
443     for (int i = 0; i < routingParameters_.size(); i++) {
444       output.writeMessage(2, routingParameters_.get(i));
445     }
446     getUnknownFields().writeTo(output);
447   }
448 
449   @java.lang.Override
getSerializedSize()450   public int getSerializedSize() {
451     int size = memoizedSize;
452     if (size != -1) return size;
453 
454     size = 0;
455     for (int i = 0; i < routingParameters_.size(); i++) {
456       size +=
457           com.google.protobuf.CodedOutputStream.computeMessageSize(2, routingParameters_.get(i));
458     }
459     size += getUnknownFields().getSerializedSize();
460     memoizedSize = size;
461     return size;
462   }
463 
464   @java.lang.Override
equals(final java.lang.Object obj)465   public boolean equals(final java.lang.Object obj) {
466     if (obj == this) {
467       return true;
468     }
469     if (!(obj instanceof com.google.api.RoutingRule)) {
470       return super.equals(obj);
471     }
472     com.google.api.RoutingRule other = (com.google.api.RoutingRule) obj;
473 
474     if (!getRoutingParametersList().equals(other.getRoutingParametersList())) return false;
475     if (!getUnknownFields().equals(other.getUnknownFields())) return false;
476     return true;
477   }
478 
479   @java.lang.Override
hashCode()480   public int hashCode() {
481     if (memoizedHashCode != 0) {
482       return memoizedHashCode;
483     }
484     int hash = 41;
485     hash = (19 * hash) + getDescriptor().hashCode();
486     if (getRoutingParametersCount() > 0) {
487       hash = (37 * hash) + ROUTING_PARAMETERS_FIELD_NUMBER;
488       hash = (53 * hash) + getRoutingParametersList().hashCode();
489     }
490     hash = (29 * hash) + getUnknownFields().hashCode();
491     memoizedHashCode = hash;
492     return hash;
493   }
494 
parseFrom(java.nio.ByteBuffer data)495   public static com.google.api.RoutingRule parseFrom(java.nio.ByteBuffer data)
496       throws com.google.protobuf.InvalidProtocolBufferException {
497     return PARSER.parseFrom(data);
498   }
499 
parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)500   public static com.google.api.RoutingRule parseFrom(
501       java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
502       throws com.google.protobuf.InvalidProtocolBufferException {
503     return PARSER.parseFrom(data, extensionRegistry);
504   }
505 
parseFrom(com.google.protobuf.ByteString data)506   public static com.google.api.RoutingRule parseFrom(com.google.protobuf.ByteString data)
507       throws com.google.protobuf.InvalidProtocolBufferException {
508     return PARSER.parseFrom(data);
509   }
510 
parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)511   public static com.google.api.RoutingRule parseFrom(
512       com.google.protobuf.ByteString data,
513       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
514       throws com.google.protobuf.InvalidProtocolBufferException {
515     return PARSER.parseFrom(data, extensionRegistry);
516   }
517 
parseFrom(byte[] data)518   public static com.google.api.RoutingRule parseFrom(byte[] data)
519       throws com.google.protobuf.InvalidProtocolBufferException {
520     return PARSER.parseFrom(data);
521   }
522 
parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)523   public static com.google.api.RoutingRule parseFrom(
524       byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
525       throws com.google.protobuf.InvalidProtocolBufferException {
526     return PARSER.parseFrom(data, extensionRegistry);
527   }
528 
parseFrom(java.io.InputStream input)529   public static com.google.api.RoutingRule parseFrom(java.io.InputStream input)
530       throws java.io.IOException {
531     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
532   }
533 
parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)534   public static com.google.api.RoutingRule parseFrom(
535       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
536       throws java.io.IOException {
537     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
538         PARSER, input, extensionRegistry);
539   }
540 
parseDelimitedFrom(java.io.InputStream input)541   public static com.google.api.RoutingRule parseDelimitedFrom(java.io.InputStream input)
542       throws java.io.IOException {
543     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
544   }
545 
parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)546   public static com.google.api.RoutingRule parseDelimitedFrom(
547       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
548       throws java.io.IOException {
549     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
550         PARSER, input, extensionRegistry);
551   }
552 
parseFrom(com.google.protobuf.CodedInputStream input)553   public static com.google.api.RoutingRule parseFrom(com.google.protobuf.CodedInputStream input)
554       throws java.io.IOException {
555     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
556   }
557 
parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)558   public static com.google.api.RoutingRule parseFrom(
559       com.google.protobuf.CodedInputStream input,
560       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
561       throws java.io.IOException {
562     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
563         PARSER, input, extensionRegistry);
564   }
565 
566   @java.lang.Override
newBuilderForType()567   public Builder newBuilderForType() {
568     return newBuilder();
569   }
570 
newBuilder()571   public static Builder newBuilder() {
572     return DEFAULT_INSTANCE.toBuilder();
573   }
574 
newBuilder(com.google.api.RoutingRule prototype)575   public static Builder newBuilder(com.google.api.RoutingRule prototype) {
576     return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
577   }
578 
579   @java.lang.Override
toBuilder()580   public Builder toBuilder() {
581     return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
582   }
583 
584   @java.lang.Override
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)585   protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
586     Builder builder = new Builder(parent);
587     return builder;
588   }
589   /**
590    *
591    *
592    * <pre>
593    * Specifies the routing information that should be sent along with the request
594    * in the form of routing header.
595    * **NOTE:** All service configuration rules follow the "last one wins" order.
596    * The examples below will apply to an RPC which has the following request type:
597    * Message Definition:
598    *     message Request {
599    *       // The name of the Table
600    *       // Values can be of the following formats:
601    *       // - `projects/&lt;project&gt;/tables/&lt;table&gt;`
602    *       // - `projects/&lt;project&gt;/instances/&lt;instance&gt;/tables/&lt;table&gt;`
603    *       // - `region/&lt;region&gt;/zones/&lt;zone&gt;/tables/&lt;table&gt;`
604    *       string table_name = 1;
605    *       // This value specifies routing for replication.
606    *       // It can be in the following formats:
607    *       // - `profiles/&lt;profile_id&gt;`
608    *       // - a legacy `profile_id` that can be any string
609    *       string app_profile_id = 2;
610    *     }
611    * Example message:
612    *     {
613    *       table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
614    *       app_profile_id: profiles/prof_qux
615    *     }
616    * The routing header consists of one or multiple key-value pairs. Every key
617    * and value must be percent-encoded, and joined together in the format of
618    * `key1=value1&amp;key2=value2`.
619    * In the examples below I am skipping the percent-encoding for readablity.
620    * Example 1
621    * Extracting a field from the request to put into the routing header
622    * unchanged, with the key equal to the field name.
623    * annotation:
624    *     option (google.api.routing) = {
625    *       // Take the `app_profile_id`.
626    *       routing_parameters {
627    *         field: "app_profile_id"
628    *       }
629    *     };
630    * result:
631    *     x-goog-request-params: app_profile_id=profiles/prof_qux
632    * Example 2
633    * Extracting a field from the request to put into the routing header
634    * unchanged, with the key different from the field name.
635    * annotation:
636    *     option (google.api.routing) = {
637    *       // Take the `app_profile_id`, but name it `routing_id` in the header.
638    *       routing_parameters {
639    *         field: "app_profile_id"
640    *         path_template: "{routing_id=**}"
641    *       }
642    *     };
643    * result:
644    *     x-goog-request-params: routing_id=profiles/prof_qux
645    * Example 3
646    * Extracting a field from the request to put into the routing
647    * header, while matching a path template syntax on the field's value.
648    * NB: it is more useful to send nothing than to send garbage for the purpose
649    * of dynamic routing, since garbage pollutes cache. Thus the matching.
650    * Sub-example 3a
651    * The field matches the template.
652    * annotation:
653    *     option (google.api.routing) = {
654    *       // Take the `table_name`, if it's well-formed (with project-based
655    *       // syntax).
656    *       routing_parameters {
657    *         field: "table_name"
658    *         path_template: "{table_name=projects/&#42;&#47;instances/&#42;&#47;&#42;*}"
659    *       }
660    *     };
661    * result:
662    *     x-goog-request-params:
663    *     table_name=projects/proj_foo/instances/instance_bar/table/table_baz
664    * Sub-example 3b
665    * The field does not match the template.
666    * annotation:
667    *     option (google.api.routing) = {
668    *       // Take the `table_name`, if it's well-formed (with region-based
669    *       // syntax).
670    *       routing_parameters {
671    *         field: "table_name"
672    *         path_template: "{table_name=regions/&#42;&#47;zones/&#42;&#47;&#42;*}"
673    *       }
674    *     };
675    * result:
676    *     &lt;no routing header will be sent&gt;
677    * Sub-example 3c
678    * Multiple alternative conflictingly named path templates are
679    * specified. The one that matches is used to construct the header.
680    * annotation:
681    *     option (google.api.routing) = {
682    *       // Take the `table_name`, if it's well-formed, whether
683    *       // using the region- or projects-based syntax.
684    *       routing_parameters {
685    *         field: "table_name"
686    *         path_template: "{table_name=regions/&#42;&#47;zones/&#42;&#47;&#42;*}"
687    *       }
688    *       routing_parameters {
689    *         field: "table_name"
690    *         path_template: "{table_name=projects/&#42;&#47;instances/&#42;&#47;&#42;*}"
691    *       }
692    *     };
693    * result:
694    *     x-goog-request-params:
695    *     table_name=projects/proj_foo/instances/instance_bar/table/table_baz
696    * Example 4
697    * Extracting a single routing header key-value pair by matching a
698    * template syntax on (a part of) a single request field.
699    * annotation:
700    *     option (google.api.routing) = {
701    *       // Take just the project id from the `table_name` field.
702    *       routing_parameters {
703    *         field: "table_name"
704    *         path_template: "{routing_id=projects/&#42;}/&#42;*"
705    *       }
706    *     };
707    * result:
708    *     x-goog-request-params: routing_id=projects/proj_foo
709    * Example 5
710    * Extracting a single routing header key-value pair by matching
711    * several conflictingly named path templates on (parts of) a single request
712    * field. The last template to match "wins" the conflict.
713    * annotation:
714    *     option (google.api.routing) = {
715    *       // If the `table_name` does not have instances information,
716    *       // take just the project id for routing.
717    *       // Otherwise take project + instance.
718    *       routing_parameters {
719    *         field: "table_name"
720    *         path_template: "{routing_id=projects/&#42;}/&#42;*"
721    *       }
722    *       routing_parameters {
723    *         field: "table_name"
724    *         path_template: "{routing_id=projects/&#42;&#47;instances/&#42;}/&#42;*"
725    *       }
726    *     };
727    * result:
728    *     x-goog-request-params:
729    *     routing_id=projects/proj_foo/instances/instance_bar
730    * Example 6
731    * Extracting multiple routing header key-value pairs by matching
732    * several non-conflicting path templates on (parts of) a single request field.
733    * Sub-example 6a
734    * Make the templates strict, so that if the `table_name` does not
735    * have an instance information, nothing is sent.
736    * annotation:
737    *     option (google.api.routing) = {
738    *       // The routing code needs two keys instead of one composite
739    *       // but works only for the tables with the "project-instance" name
740    *       // syntax.
741    *       routing_parameters {
742    *         field: "table_name"
743    *         path_template: "{project_id=projects/&#42;}/instances/&#42;&#47;&#42;*"
744    *       }
745    *       routing_parameters {
746    *         field: "table_name"
747    *         path_template: "projects/&#42;&#47;{instance_id=instances/&#42;}/&#42;*"
748    *       }
749    *     };
750    * result:
751    *     x-goog-request-params:
752    *     project_id=projects/proj_foo&amp;instance_id=instances/instance_bar
753    * Sub-example 6b
754    * Make the templates loose, so that if the `table_name` does not
755    * have an instance information, just the project id part is sent.
756    * annotation:
757    *     option (google.api.routing) = {
758    *       // The routing code wants two keys instead of one composite
759    *       // but will work with just the `project_id` for tables without
760    *       // an instance in the `table_name`.
761    *       routing_parameters {
762    *         field: "table_name"
763    *         path_template: "{project_id=projects/&#42;}/&#42;*"
764    *       }
765    *       routing_parameters {
766    *         field: "table_name"
767    *         path_template: "projects/&#42;&#47;{instance_id=instances/&#42;}/&#42;*"
768    *       }
769    *     };
770    * result (is the same as 6a for our example message because it has the instance
771    * information):
772    *     x-goog-request-params:
773    *     project_id=projects/proj_foo&amp;instance_id=instances/instance_bar
774    * Example 7
775    * Extracting multiple routing header key-value pairs by matching
776    * several path templates on multiple request fields.
777    * NB: note that here there is no way to specify sending nothing if one of the
778    * fields does not match its template. E.g. if the `table_name` is in the wrong
779    * format, the `project_id` will not be sent, but the `routing_id` will be.
780    * The backend routing code has to be aware of that and be prepared to not
781    * receive a full complement of keys if it expects multiple.
782    * annotation:
783    *     option (google.api.routing) = {
784    *       // The routing needs both `project_id` and `routing_id`
785    *       // (from the `app_profile_id` field) for routing.
786    *       routing_parameters {
787    *         field: "table_name"
788    *         path_template: "{project_id=projects/&#42;}/&#42;*"
789    *       }
790    *       routing_parameters {
791    *         field: "app_profile_id"
792    *         path_template: "{routing_id=**}"
793    *       }
794    *     };
795    * result:
796    *     x-goog-request-params:
797    *     project_id=projects/proj_foo&amp;routing_id=profiles/prof_qux
798    * Example 8
799    * Extracting a single routing header key-value pair by matching
800    * several conflictingly named path templates on several request fields. The
801    * last template to match "wins" the conflict.
802    * annotation:
803    *     option (google.api.routing) = {
804    *       // The `routing_id` can be a project id or a region id depending on
805    *       // the table name format, but only if the `app_profile_id` is not set.
806    *       // If `app_profile_id` is set it should be used instead.
807    *       routing_parameters {
808    *         field: "table_name"
809    *         path_template: "{routing_id=projects/&#42;}/&#42;*"
810    *       }
811    *       routing_parameters {
812    *          field: "table_name"
813    *          path_template: "{routing_id=regions/&#42;}/&#42;*"
814    *       }
815    *       routing_parameters {
816    *         field: "app_profile_id"
817    *         path_template: "{routing_id=**}"
818    *       }
819    *     };
820    * result:
821    *     x-goog-request-params: routing_id=profiles/prof_qux
822    * Example 9
823    * Bringing it all together.
824    * annotation:
825    *     option (google.api.routing) = {
826    *       // For routing both `table_location` and a `routing_id` are needed.
827    *       //
828    *       // table_location can be either an instance id or a region+zone id.
829    *       //
830    *       // For `routing_id`, take the value of `app_profile_id`
831    *       // - If it's in the format `profiles/&lt;profile_id&gt;`, send
832    *       // just the `&lt;profile_id&gt;` part.
833    *       // - If it's any other literal, send it as is.
834    *       // If the `app_profile_id` is empty, and the `table_name` starts with
835    *       // the project_id, send that instead.
836    *       routing_parameters {
837    *         field: "table_name"
838    *         path_template: "projects/&#42;&#47;{table_location=instances/&#42;}/tables/&#42;"
839    *       }
840    *       routing_parameters {
841    *         field: "table_name"
842    *         path_template: "{table_location=regions/&#42;&#47;zones/&#42;}/tables/&#42;"
843    *       }
844    *       routing_parameters {
845    *         field: "table_name"
846    *         path_template: "{routing_id=projects/&#42;}/&#42;*"
847    *       }
848    *       routing_parameters {
849    *         field: "app_profile_id"
850    *         path_template: "{routing_id=**}"
851    *       }
852    *       routing_parameters {
853    *         field: "app_profile_id"
854    *         path_template: "profiles/{routing_id=*}"
855    *       }
856    *     };
857    * result:
858    *     x-goog-request-params:
859    *     table_location=instances/instance_bar&amp;routing_id=prof_qux
860    * </pre>
861    *
862    * Protobuf type {@code google.api.RoutingRule}
863    */
864   public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
865       implements
866       // @@protoc_insertion_point(builder_implements:google.api.RoutingRule)
867       com.google.api.RoutingRuleOrBuilder {
getDescriptor()868     public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
869       return com.google.api.RoutingProto.internal_static_google_api_RoutingRule_descriptor;
870     }
871 
872     @java.lang.Override
873     protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()874         internalGetFieldAccessorTable() {
875       return com.google.api.RoutingProto.internal_static_google_api_RoutingRule_fieldAccessorTable
876           .ensureFieldAccessorsInitialized(
877               com.google.api.RoutingRule.class, com.google.api.RoutingRule.Builder.class);
878     }
879 
880     // Construct using com.google.api.RoutingRule.newBuilder()
Builder()881     private Builder() {}
882 
Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)883     private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
884       super(parent);
885     }
886 
887     @java.lang.Override
clear()888     public Builder clear() {
889       super.clear();
890       bitField0_ = 0;
891       if (routingParametersBuilder_ == null) {
892         routingParameters_ = java.util.Collections.emptyList();
893       } else {
894         routingParameters_ = null;
895         routingParametersBuilder_.clear();
896       }
897       bitField0_ = (bitField0_ & ~0x00000001);
898       return this;
899     }
900 
901     @java.lang.Override
getDescriptorForType()902     public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
903       return com.google.api.RoutingProto.internal_static_google_api_RoutingRule_descriptor;
904     }
905 
906     @java.lang.Override
getDefaultInstanceForType()907     public com.google.api.RoutingRule getDefaultInstanceForType() {
908       return com.google.api.RoutingRule.getDefaultInstance();
909     }
910 
911     @java.lang.Override
build()912     public com.google.api.RoutingRule build() {
913       com.google.api.RoutingRule result = buildPartial();
914       if (!result.isInitialized()) {
915         throw newUninitializedMessageException(result);
916       }
917       return result;
918     }
919 
920     @java.lang.Override
buildPartial()921     public com.google.api.RoutingRule buildPartial() {
922       com.google.api.RoutingRule result = new com.google.api.RoutingRule(this);
923       buildPartialRepeatedFields(result);
924       if (bitField0_ != 0) {
925         buildPartial0(result);
926       }
927       onBuilt();
928       return result;
929     }
930 
buildPartialRepeatedFields(com.google.api.RoutingRule result)931     private void buildPartialRepeatedFields(com.google.api.RoutingRule result) {
932       if (routingParametersBuilder_ == null) {
933         if (((bitField0_ & 0x00000001) != 0)) {
934           routingParameters_ = java.util.Collections.unmodifiableList(routingParameters_);
935           bitField0_ = (bitField0_ & ~0x00000001);
936         }
937         result.routingParameters_ = routingParameters_;
938       } else {
939         result.routingParameters_ = routingParametersBuilder_.build();
940       }
941     }
942 
buildPartial0(com.google.api.RoutingRule result)943     private void buildPartial0(com.google.api.RoutingRule result) {
944       int from_bitField0_ = bitField0_;
945     }
946 
947     @java.lang.Override
clone()948     public Builder clone() {
949       return super.clone();
950     }
951 
952     @java.lang.Override
setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)953     public Builder setField(
954         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
955       return super.setField(field, value);
956     }
957 
958     @java.lang.Override
clearField(com.google.protobuf.Descriptors.FieldDescriptor field)959     public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
960       return super.clearField(field);
961     }
962 
963     @java.lang.Override
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)964     public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
965       return super.clearOneof(oneof);
966     }
967 
968     @java.lang.Override
setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)969     public Builder setRepeatedField(
970         com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
971       return super.setRepeatedField(field, index, value);
972     }
973 
974     @java.lang.Override
addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)975     public Builder addRepeatedField(
976         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
977       return super.addRepeatedField(field, value);
978     }
979 
980     @java.lang.Override
mergeFrom(com.google.protobuf.Message other)981     public Builder mergeFrom(com.google.protobuf.Message other) {
982       if (other instanceof com.google.api.RoutingRule) {
983         return mergeFrom((com.google.api.RoutingRule) other);
984       } else {
985         super.mergeFrom(other);
986         return this;
987       }
988     }
989 
mergeFrom(com.google.api.RoutingRule other)990     public Builder mergeFrom(com.google.api.RoutingRule other) {
991       if (other == com.google.api.RoutingRule.getDefaultInstance()) return this;
992       if (routingParametersBuilder_ == null) {
993         if (!other.routingParameters_.isEmpty()) {
994           if (routingParameters_.isEmpty()) {
995             routingParameters_ = other.routingParameters_;
996             bitField0_ = (bitField0_ & ~0x00000001);
997           } else {
998             ensureRoutingParametersIsMutable();
999             routingParameters_.addAll(other.routingParameters_);
1000           }
1001           onChanged();
1002         }
1003       } else {
1004         if (!other.routingParameters_.isEmpty()) {
1005           if (routingParametersBuilder_.isEmpty()) {
1006             routingParametersBuilder_.dispose();
1007             routingParametersBuilder_ = null;
1008             routingParameters_ = other.routingParameters_;
1009             bitField0_ = (bitField0_ & ~0x00000001);
1010             routingParametersBuilder_ =
1011                 com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
1012                     ? getRoutingParametersFieldBuilder()
1013                     : null;
1014           } else {
1015             routingParametersBuilder_.addAllMessages(other.routingParameters_);
1016           }
1017         }
1018       }
1019       this.mergeUnknownFields(other.getUnknownFields());
1020       onChanged();
1021       return this;
1022     }
1023 
1024     @java.lang.Override
isInitialized()1025     public final boolean isInitialized() {
1026       return true;
1027     }
1028 
1029     @java.lang.Override
mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1030     public Builder mergeFrom(
1031         com.google.protobuf.CodedInputStream input,
1032         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1033         throws java.io.IOException {
1034       if (extensionRegistry == null) {
1035         throw new java.lang.NullPointerException();
1036       }
1037       try {
1038         boolean done = false;
1039         while (!done) {
1040           int tag = input.readTag();
1041           switch (tag) {
1042             case 0:
1043               done = true;
1044               break;
1045             case 18:
1046               {
1047                 com.google.api.RoutingParameter m =
1048                     input.readMessage(com.google.api.RoutingParameter.parser(), extensionRegistry);
1049                 if (routingParametersBuilder_ == null) {
1050                   ensureRoutingParametersIsMutable();
1051                   routingParameters_.add(m);
1052                 } else {
1053                   routingParametersBuilder_.addMessage(m);
1054                 }
1055                 break;
1056               } // case 18
1057             default:
1058               {
1059                 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
1060                   done = true; // was an endgroup tag
1061                 }
1062                 break;
1063               } // default:
1064           } // switch (tag)
1065         } // while (!done)
1066       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
1067         throw e.unwrapIOException();
1068       } finally {
1069         onChanged();
1070       } // finally
1071       return this;
1072     }
1073 
1074     private int bitField0_;
1075 
1076     private java.util.List<com.google.api.RoutingParameter> routingParameters_ =
1077         java.util.Collections.emptyList();
1078 
ensureRoutingParametersIsMutable()1079     private void ensureRoutingParametersIsMutable() {
1080       if (!((bitField0_ & 0x00000001) != 0)) {
1081         routingParameters_ =
1082             new java.util.ArrayList<com.google.api.RoutingParameter>(routingParameters_);
1083         bitField0_ |= 0x00000001;
1084       }
1085     }
1086 
1087     private com.google.protobuf.RepeatedFieldBuilderV3<
1088             com.google.api.RoutingParameter,
1089             com.google.api.RoutingParameter.Builder,
1090             com.google.api.RoutingParameterOrBuilder>
1091         routingParametersBuilder_;
1092 
1093     /**
1094      *
1095      *
1096      * <pre>
1097      * A collection of Routing Parameter specifications.
1098      * **NOTE:** If multiple Routing Parameters describe the same key
1099      * (via the `path_template` field or via the `field` field when
1100      * `path_template` is not provided), "last one wins" rule
1101      * determines which Parameter gets used.
1102      * See the examples for more details.
1103      * </pre>
1104      *
1105      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1106      */
getRoutingParametersList()1107     public java.util.List<com.google.api.RoutingParameter> getRoutingParametersList() {
1108       if (routingParametersBuilder_ == null) {
1109         return java.util.Collections.unmodifiableList(routingParameters_);
1110       } else {
1111         return routingParametersBuilder_.getMessageList();
1112       }
1113     }
1114     /**
1115      *
1116      *
1117      * <pre>
1118      * A collection of Routing Parameter specifications.
1119      * **NOTE:** If multiple Routing Parameters describe the same key
1120      * (via the `path_template` field or via the `field` field when
1121      * `path_template` is not provided), "last one wins" rule
1122      * determines which Parameter gets used.
1123      * See the examples for more details.
1124      * </pre>
1125      *
1126      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1127      */
getRoutingParametersCount()1128     public int getRoutingParametersCount() {
1129       if (routingParametersBuilder_ == null) {
1130         return routingParameters_.size();
1131       } else {
1132         return routingParametersBuilder_.getCount();
1133       }
1134     }
1135     /**
1136      *
1137      *
1138      * <pre>
1139      * A collection of Routing Parameter specifications.
1140      * **NOTE:** If multiple Routing Parameters describe the same key
1141      * (via the `path_template` field or via the `field` field when
1142      * `path_template` is not provided), "last one wins" rule
1143      * determines which Parameter gets used.
1144      * See the examples for more details.
1145      * </pre>
1146      *
1147      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1148      */
getRoutingParameters(int index)1149     public com.google.api.RoutingParameter getRoutingParameters(int index) {
1150       if (routingParametersBuilder_ == null) {
1151         return routingParameters_.get(index);
1152       } else {
1153         return routingParametersBuilder_.getMessage(index);
1154       }
1155     }
1156     /**
1157      *
1158      *
1159      * <pre>
1160      * A collection of Routing Parameter specifications.
1161      * **NOTE:** If multiple Routing Parameters describe the same key
1162      * (via the `path_template` field or via the `field` field when
1163      * `path_template` is not provided), "last one wins" rule
1164      * determines which Parameter gets used.
1165      * See the examples for more details.
1166      * </pre>
1167      *
1168      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1169      */
setRoutingParameters(int index, com.google.api.RoutingParameter value)1170     public Builder setRoutingParameters(int index, com.google.api.RoutingParameter value) {
1171       if (routingParametersBuilder_ == null) {
1172         if (value == null) {
1173           throw new NullPointerException();
1174         }
1175         ensureRoutingParametersIsMutable();
1176         routingParameters_.set(index, value);
1177         onChanged();
1178       } else {
1179         routingParametersBuilder_.setMessage(index, value);
1180       }
1181       return this;
1182     }
1183     /**
1184      *
1185      *
1186      * <pre>
1187      * A collection of Routing Parameter specifications.
1188      * **NOTE:** If multiple Routing Parameters describe the same key
1189      * (via the `path_template` field or via the `field` field when
1190      * `path_template` is not provided), "last one wins" rule
1191      * determines which Parameter gets used.
1192      * See the examples for more details.
1193      * </pre>
1194      *
1195      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1196      */
setRoutingParameters( int index, com.google.api.RoutingParameter.Builder builderForValue)1197     public Builder setRoutingParameters(
1198         int index, com.google.api.RoutingParameter.Builder builderForValue) {
1199       if (routingParametersBuilder_ == null) {
1200         ensureRoutingParametersIsMutable();
1201         routingParameters_.set(index, builderForValue.build());
1202         onChanged();
1203       } else {
1204         routingParametersBuilder_.setMessage(index, builderForValue.build());
1205       }
1206       return this;
1207     }
1208     /**
1209      *
1210      *
1211      * <pre>
1212      * A collection of Routing Parameter specifications.
1213      * **NOTE:** If multiple Routing Parameters describe the same key
1214      * (via the `path_template` field or via the `field` field when
1215      * `path_template` is not provided), "last one wins" rule
1216      * determines which Parameter gets used.
1217      * See the examples for more details.
1218      * </pre>
1219      *
1220      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1221      */
addRoutingParameters(com.google.api.RoutingParameter value)1222     public Builder addRoutingParameters(com.google.api.RoutingParameter value) {
1223       if (routingParametersBuilder_ == null) {
1224         if (value == null) {
1225           throw new NullPointerException();
1226         }
1227         ensureRoutingParametersIsMutable();
1228         routingParameters_.add(value);
1229         onChanged();
1230       } else {
1231         routingParametersBuilder_.addMessage(value);
1232       }
1233       return this;
1234     }
1235     /**
1236      *
1237      *
1238      * <pre>
1239      * A collection of Routing Parameter specifications.
1240      * **NOTE:** If multiple Routing Parameters describe the same key
1241      * (via the `path_template` field or via the `field` field when
1242      * `path_template` is not provided), "last one wins" rule
1243      * determines which Parameter gets used.
1244      * See the examples for more details.
1245      * </pre>
1246      *
1247      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1248      */
addRoutingParameters(int index, com.google.api.RoutingParameter value)1249     public Builder addRoutingParameters(int index, com.google.api.RoutingParameter value) {
1250       if (routingParametersBuilder_ == null) {
1251         if (value == null) {
1252           throw new NullPointerException();
1253         }
1254         ensureRoutingParametersIsMutable();
1255         routingParameters_.add(index, value);
1256         onChanged();
1257       } else {
1258         routingParametersBuilder_.addMessage(index, value);
1259       }
1260       return this;
1261     }
1262     /**
1263      *
1264      *
1265      * <pre>
1266      * A collection of Routing Parameter specifications.
1267      * **NOTE:** If multiple Routing Parameters describe the same key
1268      * (via the `path_template` field or via the `field` field when
1269      * `path_template` is not provided), "last one wins" rule
1270      * determines which Parameter gets used.
1271      * See the examples for more details.
1272      * </pre>
1273      *
1274      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1275      */
addRoutingParameters(com.google.api.RoutingParameter.Builder builderForValue)1276     public Builder addRoutingParameters(com.google.api.RoutingParameter.Builder builderForValue) {
1277       if (routingParametersBuilder_ == null) {
1278         ensureRoutingParametersIsMutable();
1279         routingParameters_.add(builderForValue.build());
1280         onChanged();
1281       } else {
1282         routingParametersBuilder_.addMessage(builderForValue.build());
1283       }
1284       return this;
1285     }
1286     /**
1287      *
1288      *
1289      * <pre>
1290      * A collection of Routing Parameter specifications.
1291      * **NOTE:** If multiple Routing Parameters describe the same key
1292      * (via the `path_template` field or via the `field` field when
1293      * `path_template` is not provided), "last one wins" rule
1294      * determines which Parameter gets used.
1295      * See the examples for more details.
1296      * </pre>
1297      *
1298      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1299      */
addRoutingParameters( int index, com.google.api.RoutingParameter.Builder builderForValue)1300     public Builder addRoutingParameters(
1301         int index, com.google.api.RoutingParameter.Builder builderForValue) {
1302       if (routingParametersBuilder_ == null) {
1303         ensureRoutingParametersIsMutable();
1304         routingParameters_.add(index, builderForValue.build());
1305         onChanged();
1306       } else {
1307         routingParametersBuilder_.addMessage(index, builderForValue.build());
1308       }
1309       return this;
1310     }
1311     /**
1312      *
1313      *
1314      * <pre>
1315      * A collection of Routing Parameter specifications.
1316      * **NOTE:** If multiple Routing Parameters describe the same key
1317      * (via the `path_template` field or via the `field` field when
1318      * `path_template` is not provided), "last one wins" rule
1319      * determines which Parameter gets used.
1320      * See the examples for more details.
1321      * </pre>
1322      *
1323      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1324      */
addAllRoutingParameters( java.lang.Iterable<? extends com.google.api.RoutingParameter> values)1325     public Builder addAllRoutingParameters(
1326         java.lang.Iterable<? extends com.google.api.RoutingParameter> values) {
1327       if (routingParametersBuilder_ == null) {
1328         ensureRoutingParametersIsMutable();
1329         com.google.protobuf.AbstractMessageLite.Builder.addAll(values, routingParameters_);
1330         onChanged();
1331       } else {
1332         routingParametersBuilder_.addAllMessages(values);
1333       }
1334       return this;
1335     }
1336     /**
1337      *
1338      *
1339      * <pre>
1340      * A collection of Routing Parameter specifications.
1341      * **NOTE:** If multiple Routing Parameters describe the same key
1342      * (via the `path_template` field or via the `field` field when
1343      * `path_template` is not provided), "last one wins" rule
1344      * determines which Parameter gets used.
1345      * See the examples for more details.
1346      * </pre>
1347      *
1348      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1349      */
clearRoutingParameters()1350     public Builder clearRoutingParameters() {
1351       if (routingParametersBuilder_ == null) {
1352         routingParameters_ = java.util.Collections.emptyList();
1353         bitField0_ = (bitField0_ & ~0x00000001);
1354         onChanged();
1355       } else {
1356         routingParametersBuilder_.clear();
1357       }
1358       return this;
1359     }
1360     /**
1361      *
1362      *
1363      * <pre>
1364      * A collection of Routing Parameter specifications.
1365      * **NOTE:** If multiple Routing Parameters describe the same key
1366      * (via the `path_template` field or via the `field` field when
1367      * `path_template` is not provided), "last one wins" rule
1368      * determines which Parameter gets used.
1369      * See the examples for more details.
1370      * </pre>
1371      *
1372      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1373      */
removeRoutingParameters(int index)1374     public Builder removeRoutingParameters(int index) {
1375       if (routingParametersBuilder_ == null) {
1376         ensureRoutingParametersIsMutable();
1377         routingParameters_.remove(index);
1378         onChanged();
1379       } else {
1380         routingParametersBuilder_.remove(index);
1381       }
1382       return this;
1383     }
1384     /**
1385      *
1386      *
1387      * <pre>
1388      * A collection of Routing Parameter specifications.
1389      * **NOTE:** If multiple Routing Parameters describe the same key
1390      * (via the `path_template` field or via the `field` field when
1391      * `path_template` is not provided), "last one wins" rule
1392      * determines which Parameter gets used.
1393      * See the examples for more details.
1394      * </pre>
1395      *
1396      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1397      */
getRoutingParametersBuilder(int index)1398     public com.google.api.RoutingParameter.Builder getRoutingParametersBuilder(int index) {
1399       return getRoutingParametersFieldBuilder().getBuilder(index);
1400     }
1401     /**
1402      *
1403      *
1404      * <pre>
1405      * A collection of Routing Parameter specifications.
1406      * **NOTE:** If multiple Routing Parameters describe the same key
1407      * (via the `path_template` field or via the `field` field when
1408      * `path_template` is not provided), "last one wins" rule
1409      * determines which Parameter gets used.
1410      * See the examples for more details.
1411      * </pre>
1412      *
1413      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1414      */
getRoutingParametersOrBuilder(int index)1415     public com.google.api.RoutingParameterOrBuilder getRoutingParametersOrBuilder(int index) {
1416       if (routingParametersBuilder_ == null) {
1417         return routingParameters_.get(index);
1418       } else {
1419         return routingParametersBuilder_.getMessageOrBuilder(index);
1420       }
1421     }
1422     /**
1423      *
1424      *
1425      * <pre>
1426      * A collection of Routing Parameter specifications.
1427      * **NOTE:** If multiple Routing Parameters describe the same key
1428      * (via the `path_template` field or via the `field` field when
1429      * `path_template` is not provided), "last one wins" rule
1430      * determines which Parameter gets used.
1431      * See the examples for more details.
1432      * </pre>
1433      *
1434      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1435      */
1436     public java.util.List<? extends com.google.api.RoutingParameterOrBuilder>
getRoutingParametersOrBuilderList()1437         getRoutingParametersOrBuilderList() {
1438       if (routingParametersBuilder_ != null) {
1439         return routingParametersBuilder_.getMessageOrBuilderList();
1440       } else {
1441         return java.util.Collections.unmodifiableList(routingParameters_);
1442       }
1443     }
1444     /**
1445      *
1446      *
1447      * <pre>
1448      * A collection of Routing Parameter specifications.
1449      * **NOTE:** If multiple Routing Parameters describe the same key
1450      * (via the `path_template` field or via the `field` field when
1451      * `path_template` is not provided), "last one wins" rule
1452      * determines which Parameter gets used.
1453      * See the examples for more details.
1454      * </pre>
1455      *
1456      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1457      */
addRoutingParametersBuilder()1458     public com.google.api.RoutingParameter.Builder addRoutingParametersBuilder() {
1459       return getRoutingParametersFieldBuilder()
1460           .addBuilder(com.google.api.RoutingParameter.getDefaultInstance());
1461     }
1462     /**
1463      *
1464      *
1465      * <pre>
1466      * A collection of Routing Parameter specifications.
1467      * **NOTE:** If multiple Routing Parameters describe the same key
1468      * (via the `path_template` field or via the `field` field when
1469      * `path_template` is not provided), "last one wins" rule
1470      * determines which Parameter gets used.
1471      * See the examples for more details.
1472      * </pre>
1473      *
1474      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1475      */
addRoutingParametersBuilder(int index)1476     public com.google.api.RoutingParameter.Builder addRoutingParametersBuilder(int index) {
1477       return getRoutingParametersFieldBuilder()
1478           .addBuilder(index, com.google.api.RoutingParameter.getDefaultInstance());
1479     }
1480     /**
1481      *
1482      *
1483      * <pre>
1484      * A collection of Routing Parameter specifications.
1485      * **NOTE:** If multiple Routing Parameters describe the same key
1486      * (via the `path_template` field or via the `field` field when
1487      * `path_template` is not provided), "last one wins" rule
1488      * determines which Parameter gets used.
1489      * See the examples for more details.
1490      * </pre>
1491      *
1492      * <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
1493      */
1494     public java.util.List<com.google.api.RoutingParameter.Builder>
getRoutingParametersBuilderList()1495         getRoutingParametersBuilderList() {
1496       return getRoutingParametersFieldBuilder().getBuilderList();
1497     }
1498 
1499     private com.google.protobuf.RepeatedFieldBuilderV3<
1500             com.google.api.RoutingParameter,
1501             com.google.api.RoutingParameter.Builder,
1502             com.google.api.RoutingParameterOrBuilder>
getRoutingParametersFieldBuilder()1503         getRoutingParametersFieldBuilder() {
1504       if (routingParametersBuilder_ == null) {
1505         routingParametersBuilder_ =
1506             new com.google.protobuf.RepeatedFieldBuilderV3<
1507                 com.google.api.RoutingParameter,
1508                 com.google.api.RoutingParameter.Builder,
1509                 com.google.api.RoutingParameterOrBuilder>(
1510                 routingParameters_,
1511                 ((bitField0_ & 0x00000001) != 0),
1512                 getParentForChildren(),
1513                 isClean());
1514         routingParameters_ = null;
1515       }
1516       return routingParametersBuilder_;
1517     }
1518 
1519     @java.lang.Override
setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)1520     public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
1521       return super.setUnknownFields(unknownFields);
1522     }
1523 
1524     @java.lang.Override
mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1525     public final Builder mergeUnknownFields(
1526         final com.google.protobuf.UnknownFieldSet unknownFields) {
1527       return super.mergeUnknownFields(unknownFields);
1528     }
1529 
1530     // @@protoc_insertion_point(builder_scope:google.api.RoutingRule)
1531   }
1532 
1533   // @@protoc_insertion_point(class_scope:google.api.RoutingRule)
1534   private static final com.google.api.RoutingRule DEFAULT_INSTANCE;
1535 
1536   static {
1537     DEFAULT_INSTANCE = new com.google.api.RoutingRule();
1538   }
1539 
getDefaultInstance()1540   public static com.google.api.RoutingRule getDefaultInstance() {
1541     return DEFAULT_INSTANCE;
1542   }
1543 
1544   private static final com.google.protobuf.Parser<RoutingRule> PARSER =
1545       new com.google.protobuf.AbstractParser<RoutingRule>() {
1546         @java.lang.Override
1547         public RoutingRule parsePartialFrom(
1548             com.google.protobuf.CodedInputStream input,
1549             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1550             throws com.google.protobuf.InvalidProtocolBufferException {
1551           Builder builder = newBuilder();
1552           try {
1553             builder.mergeFrom(input, extensionRegistry);
1554           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
1555             throw e.setUnfinishedMessage(builder.buildPartial());
1556           } catch (com.google.protobuf.UninitializedMessageException e) {
1557             throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
1558           } catch (java.io.IOException e) {
1559             throw new com.google.protobuf.InvalidProtocolBufferException(e)
1560                 .setUnfinishedMessage(builder.buildPartial());
1561           }
1562           return builder.buildPartial();
1563         }
1564       };
1565 
parser()1566   public static com.google.protobuf.Parser<RoutingRule> parser() {
1567     return PARSER;
1568   }
1569 
1570   @java.lang.Override
getParserForType()1571   public com.google.protobuf.Parser<RoutingRule> getParserForType() {
1572     return PARSER;
1573   }
1574 
1575   @java.lang.Override
getDefaultInstanceForType()1576   public com.google.api.RoutingRule getDefaultInstanceForType() {
1577     return DEFAULT_INSTANCE;
1578   }
1579 }
1580