From 1df5f9f77054c1b9a80b15dbc6c3e79c6ed84971 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Sat, 30 Mar 2019 03:03:15 -0700 Subject: [PATCH] [CHANGE ME] Re-generated Spanner to pick up changes in the API or client library generator. --- .../Database/V1/SpannerDatabaseAdmin.php | 2 +- .../Instance/V1/SpannerInstanceAdmin.php | 2 +- Spanner/metadata/V1/Keys.php | 2 +- Spanner/metadata/V1/Mutation.php | 2 +- Spanner/metadata/V1/QueryPlan.php | 2 +- Spanner/metadata/V1/ResultSet.php | 2 +- Spanner/metadata/V1/Spanner.php | 2 +- Spanner/metadata/V1/Transaction.php | 2 +- Spanner/metadata/V1/Type.php | 2 +- .../src/Admin/Database/V1/Database/State.php | 28 +++++++++++++++ .../src/Admin/Instance/V1/Instance/State.php | 28 +++++++++++++++ .../src/V1/ExecuteSqlRequest/QueryMode.php | 28 +++++++++++++++ Spanner/src/V1/PlanNode/Kind.php | 28 +++++++++++++++ Spanner/src/V1/TypeCode.php | 35 +++++++++++++++++++ Spanner/synth.metadata | 10 +++--- 15 files changed, 161 insertions(+), 14 deletions(-) diff --git a/Spanner/metadata/Admin/Database/V1/SpannerDatabaseAdmin.php b/Spanner/metadata/Admin/Database/V1/SpannerDatabaseAdmin.php index 3f8d74b99e44..561b0d21348e 100644 --- a/Spanner/metadata/Admin/Database/V1/SpannerDatabaseAdmin.php +++ b/Spanner/metadata/Admin/Database/V1/SpannerDatabaseAdmin.php @@ -118,7 +118,7 @@ public static function initOnce() { "476f6f676c652e436c6f75642e5370616e6e65722e41646d696e2e446174" . "61626173652e5631ca0226476f6f676c655c436c6f75645c5370616e6e65" . "725c41646d696e5c44617461626173655c5631620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Spanner/metadata/Admin/Instance/V1/SpannerInstanceAdmin.php b/Spanner/metadata/Admin/Instance/V1/SpannerInstanceAdmin.php index 8a5efcead465..c56314c4c4ab 100644 --- a/Spanner/metadata/Admin/Instance/V1/SpannerInstanceAdmin.php +++ b/Spanner/metadata/Admin/Instance/V1/SpannerInstanceAdmin.php @@ -150,7 +150,7 @@ public static function initOnce() { "646d696e2e496e7374616e63652e5631ca0226476f6f676c655c436c6f75" . "645c5370616e6e65725c41646d696e5c496e7374616e63655c5631620670" . "726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Spanner/metadata/V1/Keys.php b/Spanner/metadata/V1/Keys.php index 6ea4d4ba8737..eb45c7a357be 100644 --- a/Spanner/metadata/V1/Keys.php +++ b/Spanner/metadata/V1/Keys.php @@ -37,7 +37,7 @@ public static function initOnce() { "676c65617069732f7370616e6e65722f76313b7370616e6e6572aa021747" . "6f6f676c652e436c6f75642e5370616e6e65722e5631ca0217476f6f676c" . "655c436c6f75645c5370616e6e65725c5631620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Spanner/metadata/V1/Mutation.php b/Spanner/metadata/V1/Mutation.php index f9e784498d5c..59cf3f54ee87 100644 --- a/Spanner/metadata/V1/Mutation.php +++ b/Spanner/metadata/V1/Mutation.php @@ -43,7 +43,7 @@ public static function initOnce() { "6e65722f76313b7370616e6e6572aa0217476f6f676c652e436c6f75642e" . "5370616e6e65722e5631ca0217476f6f676c655c436c6f75645c5370616e" . "6e65725c5631620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Spanner/metadata/V1/QueryPlan.php b/Spanner/metadata/V1/QueryPlan.php index 89165d2d812f..db6fdd672a47 100644 --- a/Spanner/metadata/V1/QueryPlan.php +++ b/Spanner/metadata/V1/QueryPlan.php @@ -49,7 +49,7 @@ public static function initOnce() { "70616e6e65722f76313b7370616e6e6572aa0217476f6f676c652e436c6f" . "75642e5370616e6e65722e5631ca0217476f6f676c655c436c6f75645c53" . "70616e6e65725c5631620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Spanner/metadata/V1/ResultSet.php b/Spanner/metadata/V1/ResultSet.php index ba9fb61c1139..e9310590744d 100644 --- a/Spanner/metadata/V1/ResultSet.php +++ b/Spanner/metadata/V1/ResultSet.php @@ -55,7 +55,7 @@ public static function initOnce() { "7370616e6e65722f76313b7370616e6e6572f80101aa0217476f6f676c65" . "2e436c6f75642e5370616e6e65722e5631ca0217476f6f676c655c436c6f" . "75645c5370616e6e65725c5631620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Spanner/metadata/V1/Spanner.php b/Spanner/metadata/V1/Spanner.php index d32e0f655183..0b9b2eb6e7cf 100644 --- a/Spanner/metadata/V1/Spanner.php +++ b/Spanner/metadata/V1/Spanner.php @@ -227,7 +227,7 @@ public static function initOnce() { "313b7370616e6e6572aa0217476f6f676c652e436c6f75642e5370616e6e" . "65722e5631ca0217476f6f676c655c436c6f75645c5370616e6e65725c56" . "31620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Spanner/metadata/V1/Transaction.php b/Spanner/metadata/V1/Transaction.php index a317ba4c9fce..869b0bb9e76f 100644 --- a/Spanner/metadata/V1/Transaction.php +++ b/Spanner/metadata/V1/Transaction.php @@ -56,7 +56,7 @@ public static function initOnce() { "70616e6e6572aa0217476f6f676c652e436c6f75642e5370616e6e65722e" . "5631ca0217476f6f676c655c436c6f75645c5370616e6e65725c56316206" . "70726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Spanner/metadata/V1/Type.php b/Spanner/metadata/V1/Type.php index 5cddfe8b07b0..2b7b9523e896 100644 --- a/Spanner/metadata/V1/Type.php +++ b/Spanner/metadata/V1/Type.php @@ -38,7 +38,7 @@ public static function initOnce() { "76313b7370616e6e6572aa0217476f6f676c652e436c6f75642e5370616e" . "6e65722e5631ca0217476f6f676c655c436c6f75645c5370616e6e65725c" . "5631620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Spanner/src/Admin/Database/V1/Database/State.php b/Spanner/src/Admin/Database/V1/Database/State.php index c07c94815e07..e3711db9bc91 100644 --- a/Spanner/src/Admin/Database/V1/Database/State.php +++ b/Spanner/src/Admin/Database/V1/Database/State.php @@ -4,6 +4,8 @@ namespace Google\Cloud\Spanner\Admin\Database\V1\Database; +use UnexpectedValueException; + /** * Indicates the current state of the database. * @@ -30,6 +32,32 @@ class State * Generated from protobuf enum READY = 2; */ const READY = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } } // Adding a class alias for backwards compatibility with the previous class name. diff --git a/Spanner/src/Admin/Instance/V1/Instance/State.php b/Spanner/src/Admin/Instance/V1/Instance/State.php index a3708cd0036c..6490899edb93 100644 --- a/Spanner/src/Admin/Instance/V1/Instance/State.php +++ b/Spanner/src/Admin/Instance/V1/Instance/State.php @@ -4,6 +4,8 @@ namespace Google\Cloud\Spanner\Admin\Instance\V1\Instance; +use UnexpectedValueException; + /** * Indicates the current state of the instance. * @@ -32,6 +34,32 @@ class State * Generated from protobuf enum READY = 2; */ const READY = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } } // Adding a class alias for backwards compatibility with the previous class name. diff --git a/Spanner/src/V1/ExecuteSqlRequest/QueryMode.php b/Spanner/src/V1/ExecuteSqlRequest/QueryMode.php index d71e212af195..c1d1be3f1fa5 100644 --- a/Spanner/src/V1/ExecuteSqlRequest/QueryMode.php +++ b/Spanner/src/V1/ExecuteSqlRequest/QueryMode.php @@ -4,6 +4,8 @@ namespace Google\Cloud\Spanner\V1\ExecuteSqlRequest; +use UnexpectedValueException; + /** * Mode in which the statement must be processed. * @@ -31,6 +33,32 @@ class QueryMode * Generated from protobuf enum PROFILE = 2; */ const PROFILE = 2; + + private static $valueToName = [ + self::NORMAL => 'NORMAL', + self::PLAN => 'PLAN', + self::PROFILE => 'PROFILE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } } // Adding a class alias for backwards compatibility with the previous class name. diff --git a/Spanner/src/V1/PlanNode/Kind.php b/Spanner/src/V1/PlanNode/Kind.php index cd2178f8fcfd..5130bffa7607 100644 --- a/Spanner/src/V1/PlanNode/Kind.php +++ b/Spanner/src/V1/PlanNode/Kind.php @@ -4,6 +4,8 @@ namespace Google\Cloud\Spanner\V1\PlanNode; +use UnexpectedValueException; + /** * The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between * the two different kinds of nodes that can appear in a query plan. @@ -35,6 +37,32 @@ class Kind * Generated from protobuf enum SCALAR = 2; */ const SCALAR = 2; + + private static $valueToName = [ + self::KIND_UNSPECIFIED => 'KIND_UNSPECIFIED', + self::RELATIONAL => 'RELATIONAL', + self::SCALAR => 'SCALAR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } } // Adding a class alias for backwards compatibility with the previous class name. diff --git a/Spanner/src/V1/TypeCode.php b/Spanner/src/V1/TypeCode.php index 7fefc75492d9..1779eace309e 100644 --- a/Spanner/src/V1/TypeCode.php +++ b/Spanner/src/V1/TypeCode.php @@ -4,6 +4,8 @@ namespace Google\Cloud\Spanner\V1; +use UnexpectedValueException; + /** * `TypeCode` is used as part of [Type][google.spanner.v1.Type] to * indicate the type of a Cloud Spanner value. @@ -87,5 +89,38 @@ class TypeCode * Generated from protobuf enum STRUCT = 9; */ const STRUCT = 9; + + private static $valueToName = [ + self::TYPE_CODE_UNSPECIFIED => 'TYPE_CODE_UNSPECIFIED', + self::BOOL => 'BOOL', + self::INT64 => 'INT64', + self::FLOAT64 => 'FLOAT64', + self::TIMESTAMP => 'TIMESTAMP', + self::DATE => 'DATE', + self::STRING => 'STRING', + self::BYTES => 'BYTES', + self::PBARRAY => 'PBARRAY', + self::STRUCT => 'STRUCT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } } diff --git a/Spanner/synth.metadata b/Spanner/synth.metadata index 5523834c1c8a..9f4b6db444c6 100644 --- a/Spanner/synth.metadata +++ b/Spanner/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-03-28T10:03:49.924904Z", + "updateTime": "2019-03-30T10:03:15.110939Z", "sources": [ { "generator": { "name": "artman", - "version": "0.16.20", - "dockerImage": "googleapis/artman@sha256:e3c054a2fb85a12481c722af616c7fb6f1d02d862248385eecbec3e4240ebd1e" + "version": "0.16.21", + "dockerImage": "googleapis/artman@sha256:854131ec1af7b3a313253474c24748dc0acd217a58a0b74dbfb559f340a15d78" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "6a84b3267b0a95e922608b9891219075047eee29", - "internalRef": "240640999" + "sha": "fd67be4b51a8c809b97100ccf1c3cffd15b85d7b", + "internalRef": "241096997" } } ],