From 06032b65ebe14a92c64202efe93dacc79993098d Mon Sep 17 00:00:00 2001
From: Yoshi Automation Bot
<44816363+yoshi-automation@users.noreply.github.com>
Date: Fri, 29 Mar 2019 07:13:49 -0700
Subject: [PATCH] Add `value()` and `name()` methods to enum types. (#1775)
This PR was generated using Autosynth. :rainbow:
Here's the log from Synthtool:
```
synthtool > Executing /tmpfs/src/git/autosynth/working_repo/ErrorReporting/synth.py.
synthtool > Ensuring dependencies.
synthtool > Pulling artman image.
latest: Pulling from googleapis/artman
Digest: sha256:854131ec1af7b3a313253474c24748dc0acd217a58a0b74dbfb559f340a15d78
Status: Image is up to date for googleapis/artman:latest
synthtool > Cloning googleapis.
synthtool > Running generator for google/devtools/clouderrorreporting/artman_errorreporting.yaml.
synthtool > Generated code into /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/php/google-cloud-error-reporting-v1beta1.
synthtool > Replaced 'Copyright \\d{4}' in src/V1beta1/Gapic/ErrorGroupServiceGapicClient.php.
synthtool > Replaced 'Copyright \\d{4}' in src/V1beta1/Gapic/ErrorStatsServiceGapicClient.php.
synthtool > Replaced 'Copyright \\d{4}' in src/V1beta1/Gapic/ReportErrorsServiceGapicClient.php.
synthtool > Replaced 'Copyright \\d{4}' in src/V1beta1/ErrorGroupServiceClient.php.
synthtool > Replaced 'Copyright \\d{4}' in src/V1beta1/ErrorStatsServiceClient.php.
synthtool > Replaced 'Copyright \\d{4}' in src/V1beta1/ReportErrorsServiceClient.php.
synthtool > Replaced 'Copyright \\d{4}' in tests/Unit/V1beta1/ReportErrorsServiceClientTest.php.
synthtool > Replaced 'Copyright \\d{4}' in tests/Unit/V1beta1/ErrorStatsServiceClientTest.php.
synthtool > Replaced 'Copyright \\d{4}' in tests/Unit/V1beta1/ErrorGroupServiceClientTest.php.
synthtool > Replaced 'Copyright \\d{4}' in tests/System/V1beta1/ReportErrorsServiceSmokeTest.php.
synthtool > Cleaned up 1 temporary directories.
synthtool > Wrote metadata to synth.metadata.
```
---
ErrorReporting/metadata/V1Beta1/Common.php | 2 +-
.../metadata/V1Beta1/ErrorGroupService.php | 2 +-
.../metadata/V1Beta1/ErrorStatsService.php | 2 +-
.../metadata/V1Beta1/ReportErrorsService.php | 2 +-
.../src/V1beta1/ErrorGroupOrder.php | 30 ++++++++++++++++++
.../src/V1beta1/QueryTimeRange/Period.php | 31 +++++++++++++++++++
.../src/V1beta1/TimedCountAlignment.php | 28 +++++++++++++++++
ErrorReporting/synth.metadata | 10 +++---
8 files changed, 98 insertions(+), 9 deletions(-)
diff --git a/ErrorReporting/metadata/V1Beta1/Common.php b/ErrorReporting/metadata/V1Beta1/Common.php
index 146accf7ebbd..61d7c1d80f71 100644
--- a/ErrorReporting/metadata/V1Beta1/Common.php
+++ b/ErrorReporting/metadata/V1Beta1/Common.php
@@ -63,7 +63,7 @@ public static function initOnce() {
"726f725265706f7274696e672e56314265746131ca0223476f6f676c655c" .
"436c6f75645c4572726f725265706f7274696e675c563162657461316206" .
"70726f746f33"
- ));
+ ), true);
static::$is_initialized = true;
}
diff --git a/ErrorReporting/metadata/V1Beta1/ErrorGroupService.php b/ErrorReporting/metadata/V1Beta1/ErrorGroupService.php
index 8db2619b4f7c..83c1dc0b3da6 100644
--- a/ErrorReporting/metadata/V1Beta1/ErrorGroupService.php
+++ b/ErrorReporting/metadata/V1Beta1/ErrorGroupService.php
@@ -50,7 +50,7 @@ public static function initOnce() {
"2e4572726f725265706f7274696e672e56314265746131ca0223476f6f67" .
"6c655c436c6f75645c4572726f725265706f7274696e675c563162657461" .
"31620670726f746f33"
- ));
+ ), true);
static::$is_initialized = true;
}
diff --git a/ErrorReporting/metadata/V1Beta1/ErrorStatsService.php b/ErrorReporting/metadata/V1Beta1/ErrorStatsService.php
index 88d30a3a2e40..5f58acffe541 100644
--- a/ErrorReporting/metadata/V1Beta1/ErrorStatsService.php
+++ b/ErrorReporting/metadata/V1Beta1/ErrorStatsService.php
@@ -139,7 +139,7 @@ public static function initOnce() {
"6f7274696e67aa0223476f6f676c652e436c6f75642e4572726f72526570" .
"6f7274696e672e56314265746131ca0223476f6f676c655c436c6f75645c" .
"4572726f725265706f7274696e675c56316265746131620670726f746f33"
- ));
+ ), true);
static::$is_initialized = true;
}
diff --git a/ErrorReporting/metadata/V1Beta1/ReportErrorsService.php b/ErrorReporting/metadata/V1Beta1/ReportErrorsService.php
index 903055db24c7..9c755e776348 100644
--- a/ErrorReporting/metadata/V1Beta1/ReportErrorsService.php
+++ b/ErrorReporting/metadata/V1Beta1/ReportErrorsService.php
@@ -56,7 +56,7 @@ public static function initOnce() {
"6f6f676c652e436c6f75642e4572726f725265706f7274696e672e563142" .
"65746131ca0223476f6f676c655c436c6f75645c4572726f725265706f72" .
"74696e675c56316265746131620670726f746f33"
- ));
+ ), true);
static::$is_initialized = true;
}
diff --git a/ErrorReporting/src/V1beta1/ErrorGroupOrder.php b/ErrorReporting/src/V1beta1/ErrorGroupOrder.php
index 8cf26de44b9f..fd726de75f01 100644
--- a/ErrorReporting/src/V1beta1/ErrorGroupOrder.php
+++ b/ErrorReporting/src/V1beta1/ErrorGroupOrder.php
@@ -4,6 +4,8 @@
namespace Google\Cloud\ErrorReporting\V1beta1;
+use UnexpectedValueException;
+
/**
* A sorting order of error groups.
*
@@ -42,5 +44,33 @@ class ErrorGroupOrder
* Generated from protobuf enum AFFECTED_USERS_DESC = 4;
*/
const AFFECTED_USERS_DESC = 4;
+
+ private static $valueToName = [
+ self::GROUP_ORDER_UNSPECIFIED => 'GROUP_ORDER_UNSPECIFIED',
+ self::COUNT_DESC => 'COUNT_DESC',
+ self::LAST_SEEN_DESC => 'LAST_SEEN_DESC',
+ self::CREATED_DESC => 'CREATED_DESC',
+ self::AFFECTED_USERS_DESC => 'AFFECTED_USERS_DESC',
+ ];
+
+ 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/ErrorReporting/src/V1beta1/QueryTimeRange/Period.php b/ErrorReporting/src/V1beta1/QueryTimeRange/Period.php
index 1a309c39da84..9aa826cf2d57 100644
--- a/ErrorReporting/src/V1beta1/QueryTimeRange/Period.php
+++ b/ErrorReporting/src/V1beta1/QueryTimeRange/Period.php
@@ -4,6 +4,8 @@
namespace Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange;
+use UnexpectedValueException;
+
/**
* The supported time ranges.
*
@@ -52,6 +54,35 @@ class Period
* Generated from protobuf enum PERIOD_30_DAYS = 5;
*/
const PERIOD_30_DAYS = 5;
+
+ private static $valueToName = [
+ self::PERIOD_UNSPECIFIED => 'PERIOD_UNSPECIFIED',
+ self::PERIOD_1_HOUR => 'PERIOD_1_HOUR',
+ self::PERIOD_6_HOURS => 'PERIOD_6_HOURS',
+ self::PERIOD_1_DAY => 'PERIOD_1_DAY',
+ self::PERIOD_1_WEEK => 'PERIOD_1_WEEK',
+ self::PERIOD_30_DAYS => 'PERIOD_30_DAYS',
+ ];
+
+ 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/ErrorReporting/src/V1beta1/TimedCountAlignment.php b/ErrorReporting/src/V1beta1/TimedCountAlignment.php
index ab83f815ffd7..633e74c96e9d 100644
--- a/ErrorReporting/src/V1beta1/TimedCountAlignment.php
+++ b/ErrorReporting/src/V1beta1/TimedCountAlignment.php
@@ -4,6 +4,8 @@
namespace Google\Cloud\ErrorReporting\V1beta1;
+use UnexpectedValueException;
+
/**
* Specifies how the time periods of error group counts are aligned.
*
@@ -39,5 +41,31 @@ class TimedCountAlignment
* Generated from protobuf enum ALIGNMENT_EQUAL_AT_END = 2;
*/
const ALIGNMENT_EQUAL_AT_END = 2;
+
+ private static $valueToName = [
+ self::ERROR_COUNT_ALIGNMENT_UNSPECIFIED => 'ERROR_COUNT_ALIGNMENT_UNSPECIFIED',
+ self::ALIGNMENT_EQUAL_ROUNDED => 'ALIGNMENT_EQUAL_ROUNDED',
+ self::ALIGNMENT_EQUAL_AT_END => 'ALIGNMENT_EQUAL_AT_END',
+ ];
+
+ 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/ErrorReporting/synth.metadata b/ErrorReporting/synth.metadata
index 9b9405f97a24..13d81a01aecf 100644
--- a/ErrorReporting/synth.metadata
+++ b/ErrorReporting/synth.metadata
@@ -1,19 +1,19 @@
{
- "updateTime": "2019-03-28T10:00:57.378625Z",
+ "updateTime": "2019-03-29T10:00:46.339936Z",
"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": "37386f1ebcaed51bcb7d15d00124d22c38606e45",
+ "internalRef": "240841842"
}
}
],