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