PageRenderTime 44ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/google-listings-and-ads/vendor/google/common-protos/src/Api/RoutingRule.php

https://gitlab.com/remyvianne/krowkaramel
PHP | 353 lines | 23 code | 9 blank | 321 comment | 0 complexity | 2353d82b11fd5ac113d1b74e1796dfaf MD5 | raw file
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: google/api/routing.proto
  4. namespace Google\Api;
  5. use Google\Protobuf\Internal\GPBType;
  6. use Google\Protobuf\Internal\RepeatedField;
  7. use Google\Protobuf\Internal\GPBUtil;
  8. /**
  9. * Specifies the routing information that should be sent along with the request
  10. * in the form of routing header.
  11. * **NOTE:** All service configuration rules follow the "last one wins" order.
  12. * The examples below will apply to an RPC which has the following request type:
  13. * Message Definition:
  14. * message Request {
  15. * // The name of the Table
  16. * // Values can be of the following formats:
  17. * // - `projects/<project>/tables/<table>`
  18. * // - `projects/<project>/instances/<instance>/tables/<table>`
  19. * // - `region/<region>/zones/<zone>/tables/<table>`
  20. * string table_name = 1;
  21. * // This value specifies routing for replication.
  22. * // It can be in the following formats:
  23. * // - `profiles/<profile_id>`
  24. * // - a legacy `profile_id` that can be any string
  25. * string app_profile_id = 2;
  26. * }
  27. * Example message:
  28. * {
  29. * table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
  30. * app_profile_id: profiles/prof_qux
  31. * }
  32. * The routing header consists of one or multiple key-value pairs. Every key
  33. * and value must be percent-encoded, and joined together in the format of
  34. * `key1=value1&key2=value2`.
  35. * In the examples below I am skipping the percent-encoding for readablity.
  36. * Example 1
  37. * Extracting a field from the request to put into the routing header
  38. * unchanged, with the key equal to the field name.
  39. * annotation:
  40. * option (google.api.routing) = {
  41. * // Take the `app_profile_id`.
  42. * routing_parameters {
  43. * field: "app_profile_id"
  44. * }
  45. * };
  46. * result:
  47. * x-goog-request-params: app_profile_id=profiles/prof_qux
  48. * Example 2
  49. * Extracting a field from the request to put into the routing header
  50. * unchanged, with the key different from the field name.
  51. * annotation:
  52. * option (google.api.routing) = {
  53. * // Take the `app_profile_id`, but name it `routing_id` in the header.
  54. * routing_parameters {
  55. * field: "app_profile_id"
  56. * path_template: "{routing_id=**}"
  57. * }
  58. * };
  59. * result:
  60. * x-goog-request-params: routing_id=profiles/prof_qux
  61. * Example 3
  62. * Extracting a field from the request to put into the routing
  63. * header, while matching a path template syntax on the field's value.
  64. * NB: it is more useful to send nothing than to send garbage for the purpose
  65. * of dynamic routing, since garbage pollutes cache. Thus the matching.
  66. * Sub-example 3a
  67. * The field matches the template.
  68. * annotation:
  69. * option (google.api.routing) = {
  70. * // Take the `table_name`, if it's well-formed (with project-based
  71. * // syntax).
  72. * routing_parameters {
  73. * field: "table_name"
  74. * path_template: "{table_name=projects/&#42;&#47;instances/&#42;&#47;&#42;*}"
  75. * }
  76. * };
  77. * result:
  78. * x-goog-request-params:
  79. * table_name=projects/proj_foo/instances/instance_bar/table/table_baz
  80. * Sub-example 3b
  81. * The field does not match the template.
  82. * annotation:
  83. * option (google.api.routing) = {
  84. * // Take the `table_name`, if it's well-formed (with region-based
  85. * // syntax).
  86. * routing_parameters {
  87. * field: "table_name"
  88. * path_template: "{table_name=regions/&#42;&#47;zones/&#42;&#47;&#42;*}"
  89. * }
  90. * };
  91. * result:
  92. * <no routing header will be sent>
  93. * Sub-example 3c
  94. * Multiple alternative conflictingly named path templates are
  95. * specified. The one that matches is used to construct the header.
  96. * annotation:
  97. * option (google.api.routing) = {
  98. * // Take the `table_name`, if it's well-formed, whether
  99. * // using the region- or projects-based syntax.
  100. * routing_parameters {
  101. * field: "table_name"
  102. * path_template: "{table_name=regions/&#42;&#47;zones/&#42;&#47;&#42;*}"
  103. * }
  104. * routing_parameters {
  105. * field: "table_name"
  106. * path_template: "{table_name=projects/&#42;&#47;instances/&#42;&#47;&#42;*}"
  107. * }
  108. * };
  109. * result:
  110. * x-goog-request-params:
  111. * table_name=projects/proj_foo/instances/instance_bar/table/table_baz
  112. * Example 4
  113. * Extracting a single routing header key-value pair by matching a
  114. * template syntax on (a part of) a single request field.
  115. * annotation:
  116. * option (google.api.routing) = {
  117. * // Take just the project id from the `table_name` field.
  118. * routing_parameters {
  119. * field: "table_name"
  120. * path_template: "{routing_id=projects/&#42;}/&#42;*"
  121. * }
  122. * };
  123. * result:
  124. * x-goog-request-params: routing_id=projects/proj_foo
  125. * Example 5
  126. * Extracting a single routing header key-value pair by matching
  127. * several conflictingly named path templates on (parts of) a single request
  128. * field. The last template to match "wins" the conflict.
  129. * annotation:
  130. * option (google.api.routing) = {
  131. * // If the `table_name` does not have instances information,
  132. * // take just the project id for routing.
  133. * // Otherwise take project + instance.
  134. * routing_parameters {
  135. * field: "table_name"
  136. * path_template: "{routing_id=projects/&#42;}/&#42;*"
  137. * }
  138. * routing_parameters {
  139. * field: "table_name"
  140. * path_template: "{routing_id=projects/&#42;&#47;instances/&#42;}/&#42;*"
  141. * }
  142. * };
  143. * result:
  144. * x-goog-request-params:
  145. * routing_id=projects/proj_foo/instances/instance_bar
  146. * Example 6
  147. * Extracting multiple routing header key-value pairs by matching
  148. * several non-conflicting path templates on (parts of) a single request field.
  149. * Sub-example 6a
  150. * Make the templates strict, so that if the `table_name` does not
  151. * have an instance information, nothing is sent.
  152. * annotation:
  153. * option (google.api.routing) = {
  154. * // The routing code needs two keys instead of one composite
  155. * // but works only for the tables with the "project-instance" name
  156. * // syntax.
  157. * routing_parameters {
  158. * field: "table_name"
  159. * path_template: "{project_id=projects/&#42;}/instances/&#42;&#47;&#42;*"
  160. * }
  161. * routing_parameters {
  162. * field: "table_name"
  163. * path_template: "projects/&#42;&#47;{instance_id=instances/&#42;}/&#42;*"
  164. * }
  165. * };
  166. * result:
  167. * x-goog-request-params:
  168. * project_id=projects/proj_foo&instance_id=instances/instance_bar
  169. * Sub-example 6b
  170. * Make the templates loose, so that if the `table_name` does not
  171. * have an instance information, just the project id part is sent.
  172. * annotation:
  173. * option (google.api.routing) = {
  174. * // The routing code wants two keys instead of one composite
  175. * // but will work with just the `project_id` for tables without
  176. * // an instance in the `table_name`.
  177. * routing_parameters {
  178. * field: "table_name"
  179. * path_template: "{project_id=projects/&#42;}/&#42;*"
  180. * }
  181. * routing_parameters {
  182. * field: "table_name"
  183. * path_template: "projects/&#42;&#47;{instance_id=instances/&#42;}/&#42;*"
  184. * }
  185. * };
  186. * result (is the same as 6a for our example message because it has the instance
  187. * information):
  188. * x-goog-request-params:
  189. * project_id=projects/proj_foo&instance_id=instances/instance_bar
  190. * Example 7
  191. * Extracting multiple routing header key-value pairs by matching
  192. * several path templates on multiple request fields.
  193. * NB: note that here there is no way to specify sending nothing if one of the
  194. * fields does not match its template. E.g. if the `table_name` is in the wrong
  195. * format, the `project_id` will not be sent, but the `routing_id` will be.
  196. * The backend routing code has to be aware of that and be prepared to not
  197. * receive a full complement of keys if it expects multiple.
  198. * annotation:
  199. * option (google.api.routing) = {
  200. * // The routing needs both `project_id` and `routing_id`
  201. * // (from the `app_profile_id` field) for routing.
  202. * routing_parameters {
  203. * field: "table_name"
  204. * path_template: "{project_id=projects/&#42;}/&#42;*"
  205. * }
  206. * routing_parameters {
  207. * field: "app_profile_id"
  208. * path_template: "{routing_id=**}"
  209. * }
  210. * };
  211. * result:
  212. * x-goog-request-params:
  213. * project_id=projects/proj_foo&routing_id=profiles/prof_qux
  214. * Example 8
  215. * Extracting a single routing header key-value pair by matching
  216. * several conflictingly named path templates on several request fields. The
  217. * last template to match "wins" the conflict.
  218. * annotation:
  219. * option (google.api.routing) = {
  220. * // The `routing_id` can be a project id or a region id depending on
  221. * // the table name format, but only if the `app_profile_id` is not set.
  222. * // If `app_profile_id` is set it should be used instead.
  223. * routing_parameters {
  224. * field: "table_name"
  225. * path_template: "{routing_id=projects/&#42;}/&#42;*"
  226. * }
  227. * routing_parameters {
  228. * field: "table_name"
  229. * path_template: "{routing_id=regions/&#42;}/&#42;*"
  230. * }
  231. * routing_parameters {
  232. * field: "app_profile_id"
  233. * path_template: "{routing_id=**}"
  234. * }
  235. * };
  236. * result:
  237. * x-goog-request-params: routing_id=profiles/prof_qux
  238. * Example 9
  239. * Bringing it all together.
  240. * annotation:
  241. * option (google.api.routing) = {
  242. * // For routing both `table_location` and a `routing_id` are needed.
  243. * //
  244. * // table_location can be either an instance id or a region+zone id.
  245. * //
  246. * // For `routing_id`, take the value of `app_profile_id`
  247. * // - If it's in the format `profiles/<profile_id>`, send
  248. * // just the `<profile_id>` part.
  249. * // - If it's any other literal, send it as is.
  250. * // If the `app_profile_id` is empty, and the `table_name` starts with
  251. * // the project_id, send that instead.
  252. * routing_parameters {
  253. * field: "table_name"
  254. * path_template: "projects/&#42;&#47;{table_location=instances/&#42;}/tables/&#42;"
  255. * }
  256. * routing_parameters {
  257. * field: "table_name"
  258. * path_template: "{table_location=regions/&#42;&#47;zones/&#42;}/tables/&#42;"
  259. * }
  260. * routing_parameters {
  261. * field: "table_name"
  262. * path_template: "{routing_id=projects/&#42;}/&#42;*"
  263. * }
  264. * routing_parameters {
  265. * field: "app_profile_id"
  266. * path_template: "{routing_id=**}"
  267. * }
  268. * routing_parameters {
  269. * field: "app_profile_id"
  270. * path_template: "profiles/{routing_id=*}"
  271. * }
  272. * };
  273. * result:
  274. * x-goog-request-params:
  275. * table_location=instances/instance_bar&routing_id=prof_qux
  276. *
  277. * Generated from protobuf message <code>google.api.RoutingRule</code>
  278. */
  279. class RoutingRule extends \Google\Protobuf\Internal\Message
  280. {
  281. /**
  282. * A collection of Routing Parameter specifications.
  283. * **NOTE:** If multiple Routing Parameters describe the same key
  284. * (via the `path_template` field or via the `field` field when
  285. * `path_template` is not provided), "last one wins" rule
  286. * determines which Parameter gets used.
  287. * See the examples for more details.
  288. *
  289. * Generated from protobuf field <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
  290. */
  291. private $routing_parameters;
  292. /**
  293. * Constructor.
  294. *
  295. * @param array $data {
  296. * Optional. Data for populating the Message object.
  297. *
  298. * @type \Google\Api\RoutingParameter[]|\Google\Protobuf\Internal\RepeatedField $routing_parameters
  299. * A collection of Routing Parameter specifications.
  300. * **NOTE:** If multiple Routing Parameters describe the same key
  301. * (via the `path_template` field or via the `field` field when
  302. * `path_template` is not provided), "last one wins" rule
  303. * determines which Parameter gets used.
  304. * See the examples for more details.
  305. * }
  306. */
  307. public function __construct($data = NULL) {
  308. \GPBMetadata\Google\Api\Routing::initOnce();
  309. parent::__construct($data);
  310. }
  311. /**
  312. * A collection of Routing Parameter specifications.
  313. * **NOTE:** If multiple Routing Parameters describe the same key
  314. * (via the `path_template` field or via the `field` field when
  315. * `path_template` is not provided), "last one wins" rule
  316. * determines which Parameter gets used.
  317. * See the examples for more details.
  318. *
  319. * Generated from protobuf field <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
  320. * @return \Google\Protobuf\Internal\RepeatedField
  321. */
  322. public function getRoutingParameters()
  323. {
  324. return $this->routing_parameters;
  325. }
  326. /**
  327. * A collection of Routing Parameter specifications.
  328. * **NOTE:** If multiple Routing Parameters describe the same key
  329. * (via the `path_template` field or via the `field` field when
  330. * `path_template` is not provided), "last one wins" rule
  331. * determines which Parameter gets used.
  332. * See the examples for more details.
  333. *
  334. * Generated from protobuf field <code>repeated .google.api.RoutingParameter routing_parameters = 2;</code>
  335. * @param \Google\Api\RoutingParameter[]|\Google\Protobuf\Internal\RepeatedField $var
  336. * @return $this
  337. */
  338. public function setRoutingParameters($var)
  339. {
  340. $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\RoutingParameter::class);
  341. $this->routing_parameters = $arr;
  342. return $this;
  343. }
  344. }