From f86b9e8b1e8aae681ef7774919d3671b4d307653 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Sat, 30 Mar 2019 03:01:40 -0700 Subject: [PATCH] [CHANGE ME] Re-generated Logging to pick up changes in the API or client library generator. --- Logging/metadata/V2/LogEntry.php | 2 +- Logging/metadata/V2/Logging.php | 2 +- Logging/metadata/V2/LoggingConfig.php | 2 +- Logging/metadata/V2/LoggingMetrics.php | 2 +- Logging/src/V2/LogMetric/ApiVersion.php | 27 +++++++++++++++++++++++ Logging/src/V2/LogSink/VersionFormat.php | 28 ++++++++++++++++++++++++ Logging/synth.metadata | 10 ++++----- 7 files changed, 64 insertions(+), 9 deletions(-) diff --git a/Logging/metadata/V2/LogEntry.php b/Logging/metadata/V2/LogEntry.php index a68d2d2d3d35..2df686fa5f3e 100644 --- a/Logging/metadata/V2/LogEntry.php +++ b/Logging/metadata/V2/LogEntry.php @@ -68,7 +68,7 @@ public static function initOnce() { "3b6c6f6767696e67f80101aa0217476f6f676c652e436c6f75642e4c6f67" . "67696e672e5632ca0217476f6f676c655c436c6f75645c4c6f6767696e67" . "5c5632620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Logging/metadata/V2/Logging.php b/Logging/metadata/V2/Logging.php index 0027b0baf0e9..fb9ed2ced59d 100644 --- a/Logging/metadata/V2/Logging.php +++ b/Logging/metadata/V2/Logging.php @@ -108,7 +108,7 @@ public static function initOnce() { "6f6767696e672f76323b6c6f6767696e67f80101aa0217476f6f676c652e" . "436c6f75642e4c6f6767696e672e5632ca0217476f6f676c655c436c6f75" . "645c4c6f6767696e675c5632620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Logging/metadata/V2/LoggingConfig.php b/Logging/metadata/V2/LoggingConfig.php index 0546c288cb38..e653febd6dcb 100644 --- a/Logging/metadata/V2/LoggingConfig.php +++ b/Logging/metadata/V2/LoggingConfig.php @@ -186,7 +186,7 @@ public static function initOnce() { "617069732f6c6f6767696e672f76323b6c6f6767696e67f80101aa021747" . "6f6f676c652e436c6f75642e4c6f6767696e672e5632ca0217476f6f676c" . "655c436c6f75645c4c6f6767696e675c5632620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Logging/metadata/V2/LoggingMetrics.php b/Logging/metadata/V2/LoggingMetrics.php index 47541c8ada7c..816239d96eeb 100644 --- a/Logging/metadata/V2/LoggingMetrics.php +++ b/Logging/metadata/V2/LoggingMetrics.php @@ -88,7 +88,7 @@ public static function initOnce() { "67696e672f76323b6c6f6767696e67f80101aa0217476f6f676c652e436c" . "6f75642e4c6f6767696e672e5632ca0217476f6f676c655c436c6f75645c" . "4c6f6767696e675c5632620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/Logging/src/V2/LogMetric/ApiVersion.php b/Logging/src/V2/LogMetric/ApiVersion.php index ed56f87090ff..393ff635b652 100644 --- a/Logging/src/V2/LogMetric/ApiVersion.php +++ b/Logging/src/V2/LogMetric/ApiVersion.php @@ -4,6 +4,8 @@ namespace Google\Cloud\Logging\V2\LogMetric; +use UnexpectedValueException; + /** * Logging API version. * @@ -23,6 +25,31 @@ class ApiVersion * Generated from protobuf enum V1 = 1; */ const V1 = 1; + + private static $valueToName = [ + self::V2 => 'V2', + self::V1 => 'V1', + ]; + + 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/Logging/src/V2/LogSink/VersionFormat.php b/Logging/src/V2/LogSink/VersionFormat.php index 4c5904a709ae..395e608f3fb8 100644 --- a/Logging/src/V2/LogSink/VersionFormat.php +++ b/Logging/src/V2/LogSink/VersionFormat.php @@ -4,6 +4,8 @@ namespace Google\Cloud\Logging\V2\LogSink; +use UnexpectedValueException; + /** * Available log entry formats. Log entries can be written to * Logging in either format and can be exported in either format. @@ -31,6 +33,32 @@ class VersionFormat * Generated from protobuf enum V1 = 2; */ const V1 = 2; + + private static $valueToName = [ + self::VERSION_FORMAT_UNSPECIFIED => 'VERSION_FORMAT_UNSPECIFIED', + self::V2 => 'V2', + self::V1 => 'V1', + ]; + + 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/Logging/synth.metadata b/Logging/synth.metadata index 8caf489bdb34..a310b1923c26 100644 --- a/Logging/synth.metadata +++ b/Logging/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-03-28T10:02:04.734920Z", + "updateTime": "2019-03-30T10:01:40.763087Z", "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" } } ],