media-cloud-sync
/
includes
/
sdk
/
google
/
google
/
common-protos
/
src
/
Api
/
BackendRule
/
PathTranslation.php
PathTranslation.php in Media Cloud Sync 1.1.1, at includes/sdk/google/google/common-protos/src/Api/BackendRule/PathTranslation.php
| 1 | <?php |
| 2 | |
| 3 | # Generated by the protocol buffer compiler. DO NOT EDIT! |
| 4 | # source: google/api/backend.proto |
| 5 | namespace Dudlewebs\WPMCS\Google\Api\BackendRule; |
| 6 | |
| 7 | use UnexpectedValueException; |
| 8 | /** |
| 9 | * Path Translation specifies how to combine the backend address with the |
| 10 | * request path in order to produce the appropriate forwarding URL for the |
| 11 | * request. |
| 12 | * Path Translation is applicable only to HTTP-based backends. Backends which |
| 13 | * do not accept requests over HTTP/HTTPS should leave `path_translation` |
| 14 | * unspecified. |
| 15 | * |
| 16 | * Protobuf type <code>google.api.BackendRule.PathTranslation</code> |
| 17 | */ |
| 18 | class PathTranslation |
| 19 | { |
| 20 | /** |
| 21 | * Generated from protobuf enum <code>PATH_TRANSLATION_UNSPECIFIED = 0;</code> |
| 22 | */ |
| 23 | const PATH_TRANSLATION_UNSPECIFIED = 0; |
| 24 | /** |
| 25 | * Use the backend address as-is, with no modification to the path. If the |
| 26 | * URL pattern contains variables, the variable names and values will be |
| 27 | * appended to the query string. If a query string parameter and a URL |
| 28 | * pattern variable have the same name, this may result in duplicate keys in |
| 29 | * the query string. |
| 30 | * # Examples |
| 31 | * Given the following operation config: |
| 32 | * Method path: /api/company/{cid}/user/{uid} |
| 33 | * Backend address: https://example.cloudfunctions.net/getUser |
| 34 | * Requests to the following request paths will call the backend at the |
| 35 | * translated path: |
| 36 | * Request path: /api/company/widgetworks/user/johndoe |
| 37 | * Translated: |
| 38 | * https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe |
| 39 | * Request path: /api/company/widgetworks/user/johndoe?timezone=EST |
| 40 | * Translated: |
| 41 | * https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe |
| 42 | * |
| 43 | * Generated from protobuf enum <code>CONSTANT_ADDRESS = 1;</code> |
| 44 | */ |
| 45 | const CONSTANT_ADDRESS = 1; |
| 46 | /** |
| 47 | * The request path will be appended to the backend address. |
| 48 | * # Examples |
| 49 | * Given the following operation config: |
| 50 | * Method path: /api/company/{cid}/user/{uid} |
| 51 | * Backend address: https://example.appspot.com |
| 52 | * Requests to the following request paths will call the backend at the |
| 53 | * translated path: |
| 54 | * Request path: /api/company/widgetworks/user/johndoe |
| 55 | * Translated: |
| 56 | * https://example.appspot.com/api/company/widgetworks/user/johndoe |
| 57 | * Request path: /api/company/widgetworks/user/johndoe?timezone=EST |
| 58 | * Translated: |
| 59 | * https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST |
| 60 | * |
| 61 | * Generated from protobuf enum <code>APPEND_PATH_TO_ADDRESS = 2;</code> |
| 62 | */ |
| 63 | const APPEND_PATH_TO_ADDRESS = 2; |
| 64 | private static $valueToName = [self::PATH_TRANSLATION_UNSPECIFIED => 'PATH_TRANSLATION_UNSPECIFIED', self::CONSTANT_ADDRESS => 'CONSTANT_ADDRESS', self::APPEND_PATH_TO_ADDRESS => 'APPEND_PATH_TO_ADDRESS']; |
| 65 | public static function name($value) |
| 66 | { |
| 67 | if (!isset(self::$valueToName[$value])) { |
| 68 | throw new UnexpectedValueException(sprintf('Enum %s has no name defined for value %s', __CLASS__, $value)); |
| 69 | } |
| 70 | return self::$valueToName[$value]; |
| 71 | } |
| 72 | public static function value($name) |
| 73 | { |
| 74 | $const = __CLASS__ . '::' . strtoupper($name); |
| 75 | if (!defined($const)) { |
| 76 | throw new UnexpectedValueException(sprintf('Enum %s has no value defined for name %s', __CLASS__, $name)); |
| 77 | } |
| 78 | return constant($const); |
| 79 | } |
| 80 | } |
| 81 |