From 586606af722a51b96b5f2675560a1c2ebb46ce99 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 7 Dec 2023 17:57:15 +0000 Subject: [PATCH 1/2] feat: adding project level methods to advisorynotifications.googleapis.com docs: adding docs for new project level methods adding GetNotification and ListNotifications methods for notifications parented at the project level PiperOrigin-RevId: 588795150 Source-Link: https://github.com/googleapis/googleapis/commit/967b05bf1cc26a70e1ddaa4594058ae0d8fa8885 Source-Link: https://github.com/googleapis/googleapis-gen/commit/bdd6f86b871b17dfd410ec3a21761f3f64d82277 Copy-Tag: eyJwIjoiQWR2aXNvcnlOb3RpZmljYXRpb25zLy5Pd2xCb3QueWFtbCIsImgiOiJiZGQ2Zjg2Yjg3MWIxN2RmZDQxMGVjM2EyMTc2MWYzZjY0ZDgyMjc3In0= --- .../Advisorynotifications/V1/Service.php | Bin 0 -> 5452 bytes .../AdvisoryNotifications/V1/Attachment.php | 109 +++ .../Cloud/AdvisoryNotifications/V1/Csv.php | 106 +++ .../AdvisoryNotifications/V1/Csv/CsvRow.php | 74 ++ .../V1/GetNotificationRequest.php | 146 ++++ .../V1/GetSettingsRequest.php | 91 +++ .../V1/ListNotificationsRequest.php | 267 +++++++ .../V1/ListNotificationsResponse.php | 139 ++++ .../V1/LocalizationState.php | 73 ++ .../AdvisoryNotifications/V1/Message.php | 199 ++++++ .../AdvisoryNotifications/V1/Message/Body.php | 80 +++ .../AdvisoryNotifications/V1/Notification.php | 236 +++++++ .../V1/NotificationSettings.php | 67 ++ .../V1/NotificationType.php | 75 ++ .../V1/NotificationView.php | 63 ++ .../AdvisoryNotifications/V1/Settings.php | 163 +++++ .../AdvisoryNotifications/V1/Subject.php | 77 ++ .../Cloud/AdvisoryNotifications/V1/Text.php | 135 ++++ .../V1/UpdateSettingsRequest.php | 90 +++ .../get_notification.php | 78 +++ .../get_settings.php | 73 ++ .../list_notifications.php | 78 +++ .../update_settings.php | 77 ++ .../V1/AdvisoryNotificationsServiceClient.php | 34 + .../AdvisoryNotificationsServiceClient.php | 440 ++++++++++++ ...dvisoryNotificationsServiceGapicClient.php | 656 ++++++++++++++++++ .../v1/src/V1/gapic_metadata.json | 38 + ...y_notifications_service_client_config.json | 54 ++ ...otifications_service_descriptor_config.php | 74 ++ ...tifications_service_rest_client_config.php | 67 ++ ...AdvisoryNotificationsServiceClientTest.php | 332 +++++++++ ...AdvisoryNotificationsServiceClientTest.php | 381 ++++++++++ 32 files changed, 4572 insertions(+) create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/GPBMetadata/Google/Cloud/Advisorynotifications/V1/Service.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Attachment.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv/CsvRow.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetNotificationRequest.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetSettingsRequest.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsRequest.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsResponse.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/LocalizationState.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message/Body.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Notification.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationSettings.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationType.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationView.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Settings.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Subject.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Text.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/UpdateSettingsRequest.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_notification.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_settings.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/list_notifications.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/update_settings.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/AdvisoryNotificationsServiceClient.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/Client/AdvisoryNotificationsServiceClient.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/Gapic/AdvisoryNotificationsServiceGapicClient.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/gapic_metadata.json create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_client_config.json create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_descriptor_config.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_rest_client_config.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/AdvisoryNotificationsServiceClientTest.php create mode 100644 owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/Client/AdvisoryNotificationsServiceClientTest.php diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/GPBMetadata/Google/Cloud/Advisorynotifications/V1/Service.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/GPBMetadata/Google/Cloud/Advisorynotifications/V1/Service.php new file mode 100644 index 0000000000000000000000000000000000000000..7c16188aa28f84abea6047d1f460527b62dd7a2e GIT binary patch literal 5452 zcmbtY&2QV-5np{cu}9v-e%S0f!gk9j3F3Gg3RZU8gjsKv`mn==A`6o2)`0+mqMl`L zWRfK*IgaZ?3-nO**hSAh6-EDpp7y@SEzm3PaOSk$$XRy0V9YMGDZKF>eQ4q?TLT$4p zRLV;07OJ||z|pBB^en5_r+K|^4Z3-)J2YI&IW#TL*fn&`Gc4214_EUpb%uscMQ$I! z)b^=sYdRG+>c!{O)4H0cwKuq_c8Qs4%hOD?w^yG4=zYy~g{E&3jzGXad(i0{y5M@a zrY_tuT-7iQ&(QkDYm9D9*wy+jMcvb~y8}~aehN%s)70tmeZjZMWbfD(qOm4~&ea(} z2u@ouJ?fZRzg?!T?ijXbIdv43q#pG~u(B`9_k(4bIb&B?_I;G3Q%%s!^2BdF}dq2iM;g1 zsiiLtSF;}kwl&+pE@2S+U6B20Y#SdMuwgv1xf{W%Tu zwMZ9|c}TOaTS^FtcuDXNHS5)_wlK3H05XD&0h)rLMd;znV16S)&cPS;LE@0ug zuSPzBjP6h*AC>vOl;&<^LpQ>}#8Iw`sqf_!X~1HXTvYGSrc3jvd#&(`Q1|?Vh*4Nt zs4kr(PUIgGusS`3J}#I&S41|$4`i8lICezQA;c8e*k0CvBBUAV|rb!k=?wcfB4GT(!bjRu* z@@O)JhcV3r+F}t^$vR{-&(rk1eQZ+~TZ0w$YD`P=NR#BpYnx$}DV$T=9?W+Q*Y0bF>RX~IUV${5?YRR;p%^Q= zJ*su7<6@dpSX^b8W5278b#PI<(VmF^4eKC#6R!AAepP#pfwaUI$eko$scN`hEkcHF zgZ_Ge6ND&m#nv3mwci58$KT7z|Hu!?C8%H#=4@m`)x`}5$8UxZ0RG9dUQ&}c%p9pe zdT7uCPIs51tZh^$H{jjAX7&bbMcwMsr5V<$xvvv&b4swTjoUCvzJzgR;0VRb6q(rMgvX)+;6aSSc^OL*`(nC^wbT zLW0afdVQ-}T}ZC{B>{`4CMU_kN7c=eTvcB9)|xH3Rhck%7j8|FK_^tXUaz7b#cBnY z`UtX9#Ojq=S*dL-B#8hYPWipG`Mh4Ow9xO=%A3S^ylg{7CgW}G)F&Ox!^dNgaFJ%E zwAD~rJ8He5Y|Et`RW5HU&CSLRx{B3vdzwbAskD^siYk{Fv`usx@tGzVn10@r7g7ZA zIW5zA)~LuW_1R`adBIGj3xAu155t3KG^=iK_#|H^F+-Eng*=T}Ij1y(QqO*Ic>_Mz z=YI3MfBx{N9ac*C!aC zti_CJLNA0Q?tU(srrhf>6xg=pJPaoG<}1e|6u9Pe3{EM%k@-Q3{38LG2#b-&@#7B} zC5-)|OqBba$GuAOJcs`??vVJ7L*M_EfNSG4Nj{6|{+E8mGT@xGJAJ{(~rrlA+u(o=)5J5SE|{`chF4Su^O^4m3WDyfOv ztKWul?cf@2bPpHpE4PgoaVN=T-=rjQo02rus3f7N{KrJhLCwY;yNx5O<75?Mr-374 m)S~AfpF3Aj(6b)i8{Gu`%)fez+|-?UOUEVs+q7di2KXgoogle.cloud.advisorynotifications.v1.Attachment + */ +class Attachment extends \Google\Protobuf\Internal\Message +{ + /** + * The title of the attachment. + * + * Generated from protobuf field string display_name = 1; + */ + protected $display_name = ''; + protected $data; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AdvisoryNotifications\V1\Csv $csv + * A CSV file attachment. Max size is 10 MB. + * @type string $display_name + * The title of the attachment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * A CSV file attachment. Max size is 10 MB. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Csv csv = 2; + * @return \Google\Cloud\AdvisoryNotifications\V1\Csv|null + */ + public function getCsv() + { + return $this->readOneof(2); + } + + public function hasCsv() + { + return $this->hasOneof(2); + } + + /** + * A CSV file attachment. Max size is 10 MB. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Csv csv = 2; + * @param \Google\Cloud\AdvisoryNotifications\V1\Csv $var + * @return $this + */ + public function setCsv($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AdvisoryNotifications\V1\Csv::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The title of the attachment. + * + * Generated from protobuf field string display_name = 1; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The title of the attachment. + * + * Generated from protobuf field string display_name = 1; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * @return string + */ + public function getData() + { + return $this->whichOneof("data"); + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv.php new file mode 100644 index 000000000000..3389ab8c5cf5 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv.php @@ -0,0 +1,106 @@ +google.cloud.advisorynotifications.v1.Csv + */ +class Csv extends \Google\Protobuf\Internal\Message +{ + /** + * The list of headers for data columns in a CSV file. + * + * Generated from protobuf field repeated string headers = 1; + */ + private $headers; + /** + * The list of data rows in a CSV file, as string arrays rather than as a + * single comma-separated string. + * + * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Csv.CsvRow data_rows = 2; + */ + private $data_rows; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $headers + * The list of headers for data columns in a CSV file. + * @type array<\Google\Cloud\AdvisoryNotifications\V1\Csv\CsvRow>|\Google\Protobuf\Internal\RepeatedField $data_rows + * The list of data rows in a CSV file, as string arrays rather than as a + * single comma-separated string. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of headers for data columns in a CSV file. + * + * Generated from protobuf field repeated string headers = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * The list of headers for data columns in a CSV file. + * + * Generated from protobuf field repeated string headers = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setHeaders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->headers = $arr; + + return $this; + } + + /** + * The list of data rows in a CSV file, as string arrays rather than as a + * single comma-separated string. + * + * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Csv.CsvRow data_rows = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDataRows() + { + return $this->data_rows; + } + + /** + * The list of data rows in a CSV file, as string arrays rather than as a + * single comma-separated string. + * + * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Csv.CsvRow data_rows = 2; + * @param array<\Google\Cloud\AdvisoryNotifications\V1\Csv\CsvRow>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDataRows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AdvisoryNotifications\V1\Csv\CsvRow::class); + $this->data_rows = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv/CsvRow.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv/CsvRow.php new file mode 100644 index 000000000000..eb98c1535acd --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv/CsvRow.php @@ -0,0 +1,74 @@ +google.cloud.advisorynotifications.v1.Csv.CsvRow + */ +class CsvRow extends \Google\Protobuf\Internal\Message +{ + /** + * The data entries in a CSV file row, as a string array rather than a + * single comma-separated string. + * + * Generated from protobuf field repeated string entries = 1; + */ + private $entries; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $entries + * The data entries in a CSV file row, as a string array rather than a + * single comma-separated string. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The data entries in a CSV file row, as a string array rather than a + * single comma-separated string. + * + * Generated from protobuf field repeated string entries = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntries() + { + return $this->entries; + } + + /** + * The data entries in a CSV file row, as a string array rather than a + * single comma-separated string. + * + * Generated from protobuf field repeated string entries = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->entries = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CsvRow::class, \Google\Cloud\AdvisoryNotifications\V1\Csv_CsvRow::class); + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetNotificationRequest.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetNotificationRequest.php new file mode 100644 index 000000000000..58d3b8a07814 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetNotificationRequest.php @@ -0,0 +1,146 @@ +google.cloud.advisorynotifications.v1.GetNotificationRequest + */ +class GetNotificationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A name of the notification to retrieve. + * Format: + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{projects}/locations/{location}/notifications/{notification}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * ISO code for requested localization language. If unset, will be + * interpereted as "en". If the requested language is valid, but not supported + * for this notification, English will be returned with an "Not applicable" + * LocalizationState. If the ISO code is invalid (i.e. not a real language), + * this RPC will throw an error. + * + * Generated from protobuf field string language_code = 5; + */ + protected $language_code = ''; + + /** + * @param string $name Required. A name of the notification to retrieve. + * Format: + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{projects}/locations/{location}/notifications/{notification}. Please see + * {@see AdvisoryNotificationsServiceClient::notificationName()} for help formatting this field. + * + * @return \Google\Cloud\AdvisoryNotifications\V1\GetNotificationRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A name of the notification to retrieve. + * Format: + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{projects}/locations/{location}/notifications/{notification}. + * @type string $language_code + * ISO code for requested localization language. If unset, will be + * interpereted as "en". If the requested language is valid, but not supported + * for this notification, English will be returned with an "Not applicable" + * LocalizationState. If the ISO code is invalid (i.e. not a real language), + * this RPC will throw an error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. A name of the notification to retrieve. + * Format: + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{projects}/locations/{location}/notifications/{notification}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A name of the notification to retrieve. + * Format: + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{projects}/locations/{location}/notifications/{notification}. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * ISO code for requested localization language. If unset, will be + * interpereted as "en". If the requested language is valid, but not supported + * for this notification, English will be returned with an "Not applicable" + * LocalizationState. If the ISO code is invalid (i.e. not a real language), + * this RPC will throw an error. + * + * Generated from protobuf field string language_code = 5; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * ISO code for requested localization language. If unset, will be + * interpereted as "en". If the requested language is valid, but not supported + * for this notification, English will be returned with an "Not applicable" + * LocalizationState. If the ISO code is invalid (i.e. not a real language), + * this RPC will throw an error. + * + * Generated from protobuf field string language_code = 5; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetSettingsRequest.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetSettingsRequest.php new file mode 100644 index 000000000000..ca213364ae8e --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetSettingsRequest.php @@ -0,0 +1,91 @@ +google.cloud.advisorynotifications.v1.GetSettingsRequest + */ +class GetSettingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the settings to retrieve. + * Format: + * organizations/{organization}/locations/{location}/settings. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the settings to retrieve. + * Format: + * organizations/{organization}/locations/{location}/settings. Please see + * {@see AdvisoryNotificationsServiceClient::settingsName()} for help formatting this field. + * + * @return \Google\Cloud\AdvisoryNotifications\V1\GetSettingsRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the settings to retrieve. + * Format: + * organizations/{organization}/locations/{location}/settings. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the settings to retrieve. + * Format: + * organizations/{organization}/locations/{location}/settings. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the settings to retrieve. + * Format: + * organizations/{organization}/locations/{location}/settings. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsRequest.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsRequest.php new file mode 100644 index 000000000000..9f6eb8532fb5 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsRequest.php @@ -0,0 +1,267 @@ +google.cloud.advisorynotifications.v1.ListNotificationsRequest + */ +class ListNotificationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent, which owns this collection of notifications. + * Must be of the form "organizations/{organization}/locations/{location}" + * or "projects/{project}/locations/{location}" + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of notifications to return. The service may return + * fewer than this value. If unspecified or equal to 0, at most 50 + * notifications will be returned. The maximum value is 50; values above 50 + * will be coerced to 50. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token returned from a previous request. + * When paginating, all other parameters provided in the request + * must match the call that returned the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Specifies which parts of the notification resource should be returned + * in the response. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.NotificationView view = 4; + */ + protected $view = 0; + /** + * ISO code for requested localization language. If unset, will be + * interpereted as "en". If the requested language is valid, but not supported + * for this notification, English will be returned with an "Not applicable" + * LocalizationState. If the ISO code is invalid (i.e. not a real language), + * this RPC will throw an error. + * + * Generated from protobuf field string language_code = 5; + */ + protected $language_code = ''; + + /** + * @param string $parent Required. The parent, which owns this collection of notifications. + * Must be of the form "organizations/{organization}/locations/{location}" + * or "projects/{project}/locations/{location}" + * Please see {@see AdvisoryNotificationsServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\AdvisoryNotifications\V1\ListNotificationsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent, which owns this collection of notifications. + * Must be of the form "organizations/{organization}/locations/{location}" + * or "projects/{project}/locations/{location}" + * @type int $page_size + * The maximum number of notifications to return. The service may return + * fewer than this value. If unspecified or equal to 0, at most 50 + * notifications will be returned. The maximum value is 50; values above 50 + * will be coerced to 50. + * @type string $page_token + * A page token returned from a previous request. + * When paginating, all other parameters provided in the request + * must match the call that returned the page token. + * @type int $view + * Specifies which parts of the notification resource should be returned + * in the response. + * @type string $language_code + * ISO code for requested localization language. If unset, will be + * interpereted as "en". If the requested language is valid, but not supported + * for this notification, English will be returned with an "Not applicable" + * LocalizationState. If the ISO code is invalid (i.e. not a real language), + * this RPC will throw an error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent, which owns this collection of notifications. + * Must be of the form "organizations/{organization}/locations/{location}" + * or "projects/{project}/locations/{location}" + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent, which owns this collection of notifications. + * Must be of the form "organizations/{organization}/locations/{location}" + * or "projects/{project}/locations/{location}" + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of notifications to return. The service may return + * fewer than this value. If unspecified or equal to 0, at most 50 + * notifications will be returned. The maximum value is 50; values above 50 + * will be coerced to 50. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of notifications to return. The service may return + * fewer than this value. If unspecified or equal to 0, at most 50 + * notifications will be returned. The maximum value is 50; values above 50 + * will be coerced to 50. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token returned from a previous request. + * When paginating, all other parameters provided in the request + * must match the call that returned the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token returned from a previous request. + * When paginating, all other parameters provided in the request + * must match the call that returned the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Specifies which parts of the notification resource should be returned + * in the response. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.NotificationView view = 4; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Specifies which parts of the notification resource should be returned + * in the response. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.NotificationView view = 4; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AdvisoryNotifications\V1\NotificationView::class); + $this->view = $var; + + return $this; + } + + /** + * ISO code for requested localization language. If unset, will be + * interpereted as "en". If the requested language is valid, but not supported + * for this notification, English will be returned with an "Not applicable" + * LocalizationState. If the ISO code is invalid (i.e. not a real language), + * this RPC will throw an error. + * + * Generated from protobuf field string language_code = 5; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * ISO code for requested localization language. If unset, will be + * interpereted as "en". If the requested language is valid, but not supported + * for this notification, English will be returned with an "Not applicable" + * LocalizationState. If the ISO code is invalid (i.e. not a real language), + * this RPC will throw an error. + * + * Generated from protobuf field string language_code = 5; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsResponse.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsResponse.php new file mode 100644 index 000000000000..0723811dfe75 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsResponse.php @@ -0,0 +1,139 @@ +google.cloud.advisorynotifications.v1.ListNotificationsResponse + */ +class ListNotificationsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of notifications under a given parent. + * + * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Notification notifications = 1; + */ + private $notifications; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Estimation of a total number of notifications. + * + * Generated from protobuf field int32 total_size = 3; + */ + protected $total_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\AdvisoryNotifications\V1\Notification>|\Google\Protobuf\Internal\RepeatedField $notifications + * List of notifications under a given parent. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type int $total_size + * Estimation of a total number of notifications. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * List of notifications under a given parent. + * + * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Notification notifications = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNotifications() + { + return $this->notifications; + } + + /** + * List of notifications under a given parent. + * + * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Notification notifications = 1; + * @param array<\Google\Cloud\AdvisoryNotifications\V1\Notification>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNotifications($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AdvisoryNotifications\V1\Notification::class); + $this->notifications = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Estimation of a total number of notifications. + * + * Generated from protobuf field int32 total_size = 3; + * @return int + */ + public function getTotalSize() + { + return $this->total_size; + } + + /** + * Estimation of a total number of notifications. + * + * Generated from protobuf field int32 total_size = 3; + * @param int $var + * @return $this + */ + public function setTotalSize($var) + { + GPBUtil::checkInt32($var); + $this->total_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/LocalizationState.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/LocalizationState.php new file mode 100644 index 000000000000..c4423106e08f --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/LocalizationState.php @@ -0,0 +1,73 @@ +google.cloud.advisorynotifications.v1.LocalizationState + */ +class LocalizationState +{ + /** + * Not used. + * + * Generated from protobuf enum LOCALIZATION_STATE_UNSPECIFIED = 0; + */ + const LOCALIZATION_STATE_UNSPECIFIED = 0; + /** + * Localization is not applicable for requested language. This can happen + * when: + * - The requested language was not supported by Advisory Notifications at the + * time of localization (including notifications created before the + * localization feature was launched). + * - The requested language is English, so only the English text is returned. + * + * Generated from protobuf enum LOCALIZATION_STATE_NOT_APPLICABLE = 1; + */ + const LOCALIZATION_STATE_NOT_APPLICABLE = 1; + /** + * Localization for requested language is in progress, and not ready yet. + * + * Generated from protobuf enum LOCALIZATION_STATE_PENDING = 2; + */ + const LOCALIZATION_STATE_PENDING = 2; + /** + * Localization for requested language is completed. + * + * Generated from protobuf enum LOCALIZATION_STATE_COMPLETED = 3; + */ + const LOCALIZATION_STATE_COMPLETED = 3; + + private static $valueToName = [ + self::LOCALIZATION_STATE_UNSPECIFIED => 'LOCALIZATION_STATE_UNSPECIFIED', + self::LOCALIZATION_STATE_NOT_APPLICABLE => 'LOCALIZATION_STATE_NOT_APPLICABLE', + self::LOCALIZATION_STATE_PENDING => 'LOCALIZATION_STATE_PENDING', + self::LOCALIZATION_STATE_COMPLETED => 'LOCALIZATION_STATE_COMPLETED', + ]; + + 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/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message.php new file mode 100644 index 000000000000..f991adccc115 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message.php @@ -0,0 +1,199 @@ +google.cloud.advisorynotifications.v1.Message + */ +class Message extends \Google\Protobuf\Internal\Message +{ + /** + * The message content. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Message.Body body = 1; + */ + protected $body = null; + /** + * The attachments to download. + * + * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Attachment attachments = 2; + */ + private $attachments; + /** + * The Message creation timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + */ + protected $create_time = null; + /** + * Time when Message was localized + * + * Generated from protobuf field .google.protobuf.Timestamp localization_time = 4; + */ + protected $localization_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AdvisoryNotifications\V1\Message\Body $body + * The message content. + * @type array<\Google\Cloud\AdvisoryNotifications\V1\Attachment>|\Google\Protobuf\Internal\RepeatedField $attachments + * The attachments to download. + * @type \Google\Protobuf\Timestamp $create_time + * The Message creation timestamp. + * @type \Google\Protobuf\Timestamp $localization_time + * Time when Message was localized + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The message content. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Message.Body body = 1; + * @return \Google\Cloud\AdvisoryNotifications\V1\Message\Body|null + */ + public function getBody() + { + return $this->body; + } + + public function hasBody() + { + return isset($this->body); + } + + public function clearBody() + { + unset($this->body); + } + + /** + * The message content. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Message.Body body = 1; + * @param \Google\Cloud\AdvisoryNotifications\V1\Message\Body $var + * @return $this + */ + public function setBody($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AdvisoryNotifications\V1\Message\Body::class); + $this->body = $var; + + return $this; + } + + /** + * The attachments to download. + * + * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Attachment attachments = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAttachments() + { + return $this->attachments; + } + + /** + * The attachments to download. + * + * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Attachment attachments = 2; + * @param array<\Google\Cloud\AdvisoryNotifications\V1\Attachment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAttachments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AdvisoryNotifications\V1\Attachment::class); + $this->attachments = $arr; + + return $this; + } + + /** + * The Message creation timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The Message creation timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Time when Message was localized + * + * Generated from protobuf field .google.protobuf.Timestamp localization_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLocalizationTime() + { + return $this->localization_time; + } + + public function hasLocalizationTime() + { + return isset($this->localization_time); + } + + public function clearLocalizationTime() + { + unset($this->localization_time); + } + + /** + * Time when Message was localized + * + * Generated from protobuf field .google.protobuf.Timestamp localization_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLocalizationTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->localization_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message/Body.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message/Body.php new file mode 100644 index 000000000000..58e44b3f405f --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message/Body.php @@ -0,0 +1,80 @@ +google.cloud.advisorynotifications.v1.Message.Body + */ +class Body extends \Google\Protobuf\Internal\Message +{ + /** + * The text content of the message body. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Text text = 1; + */ + protected $text = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AdvisoryNotifications\V1\Text $text + * The text content of the message body. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The text content of the message body. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Text text = 1; + * @return \Google\Cloud\AdvisoryNotifications\V1\Text|null + */ + public function getText() + { + return $this->text; + } + + public function hasText() + { + return isset($this->text); + } + + public function clearText() + { + unset($this->text); + } + + /** + * The text content of the message body. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Text text = 1; + * @param \Google\Cloud\AdvisoryNotifications\V1\Text $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AdvisoryNotifications\V1\Text::class); + $this->text = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Body::class, \Google\Cloud\AdvisoryNotifications\V1\Message_Body::class); + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Notification.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Notification.php new file mode 100644 index 000000000000..76a52ae2a43f --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Notification.php @@ -0,0 +1,236 @@ +google.cloud.advisorynotifications.v1.Notification + */ +class Notification extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the notification. + * Format: + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{project}/locations/{location}/notifications/{notification}. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The subject line of the notification. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Subject subject = 2; + */ + protected $subject = null; + /** + * A list of messages in the notification. + * + * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Message messages = 3; + */ + private $messages; + /** + * Output only. Time the notification was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Type of notification + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.NotificationType notification_type = 12; + */ + protected $notification_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the notification. + * Format: + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{project}/locations/{location}/notifications/{notification}. + * @type \Google\Cloud\AdvisoryNotifications\V1\Subject $subject + * The subject line of the notification. + * @type array<\Google\Cloud\AdvisoryNotifications\V1\Message>|\Google\Protobuf\Internal\RepeatedField $messages + * A list of messages in the notification. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Time the notification was created. + * @type int $notification_type + * Type of notification + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the notification. + * Format: + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{project}/locations/{location}/notifications/{notification}. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the notification. + * Format: + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{project}/locations/{location}/notifications/{notification}. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The subject line of the notification. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Subject subject = 2; + * @return \Google\Cloud\AdvisoryNotifications\V1\Subject|null + */ + public function getSubject() + { + return $this->subject; + } + + public function hasSubject() + { + return isset($this->subject); + } + + public function clearSubject() + { + unset($this->subject); + } + + /** + * The subject line of the notification. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Subject subject = 2; + * @param \Google\Cloud\AdvisoryNotifications\V1\Subject $var + * @return $this + */ + public function setSubject($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AdvisoryNotifications\V1\Subject::class); + $this->subject = $var; + + return $this; + } + + /** + * A list of messages in the notification. + * + * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Message messages = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMessages() + { + return $this->messages; + } + + /** + * A list of messages in the notification. + * + * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Message messages = 3; + * @param array<\Google\Cloud\AdvisoryNotifications\V1\Message>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMessages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AdvisoryNotifications\V1\Message::class); + $this->messages = $arr; + + return $this; + } + + /** + * Output only. Time the notification was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Time the notification was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Type of notification + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.NotificationType notification_type = 12; + * @return int + */ + public function getNotificationType() + { + return $this->notification_type; + } + + /** + * Type of notification + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.NotificationType notification_type = 12; + * @param int $var + * @return $this + */ + public function setNotificationType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AdvisoryNotifications\V1\NotificationType::class); + $this->notification_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationSettings.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationSettings.php new file mode 100644 index 000000000000..c360141cdf67 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationSettings.php @@ -0,0 +1,67 @@ +google.cloud.advisorynotifications.v1.NotificationSettings + */ +class NotificationSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Whether the associated NotificationType is enabled. + * + * Generated from protobuf field bool enabled = 1; + */ + protected $enabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * Whether the associated NotificationType is enabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Whether the associated NotificationType is enabled. + * + * Generated from protobuf field bool enabled = 1; + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Whether the associated NotificationType is enabled. + * + * Generated from protobuf field bool enabled = 1; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationType.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationType.php new file mode 100644 index 000000000000..d0be8c7af583 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationType.php @@ -0,0 +1,75 @@ +google.cloud.advisorynotifications.v1.NotificationType + */ +class NotificationType +{ + /** + * Default type + * + * Generated from protobuf enum NOTIFICATION_TYPE_UNSPECIFIED = 0; + */ + const NOTIFICATION_TYPE_UNSPECIFIED = 0; + /** + * Security and privacy advisory notifications + * + * Generated from protobuf enum NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY = 1; + */ + const NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY = 1; + /** + * Sensitive action notifications + * + * Generated from protobuf enum NOTIFICATION_TYPE_SENSITIVE_ACTIONS = 2; + */ + const NOTIFICATION_TYPE_SENSITIVE_ACTIONS = 2; + /** + * General security MSA + * + * Generated from protobuf enum NOTIFICATION_TYPE_SECURITY_MSA = 3; + */ + const NOTIFICATION_TYPE_SECURITY_MSA = 3; + /** + * Threat horizons MSA + * + * Generated from protobuf enum NOTIFICATION_TYPE_THREAT_HORIZONS = 4; + */ + const NOTIFICATION_TYPE_THREAT_HORIZONS = 4; + + private static $valueToName = [ + self::NOTIFICATION_TYPE_UNSPECIFIED => 'NOTIFICATION_TYPE_UNSPECIFIED', + self::NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY => 'NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY', + self::NOTIFICATION_TYPE_SENSITIVE_ACTIONS => 'NOTIFICATION_TYPE_SENSITIVE_ACTIONS', + self::NOTIFICATION_TYPE_SECURITY_MSA => 'NOTIFICATION_TYPE_SECURITY_MSA', + self::NOTIFICATION_TYPE_THREAT_HORIZONS => 'NOTIFICATION_TYPE_THREAT_HORIZONS', + ]; + + 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/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationView.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationView.php new file mode 100644 index 000000000000..32fceaafe375 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationView.php @@ -0,0 +1,63 @@ +google.cloud.advisorynotifications.v1.NotificationView + */ +class NotificationView +{ + /** + * Not specified, equivalent to BASIC. + * + * Generated from protobuf enum NOTIFICATION_VIEW_UNSPECIFIED = 0; + */ + const NOTIFICATION_VIEW_UNSPECIFIED = 0; + /** + * Server responses only include title, creation time and Notification ID. + * Note: for internal use responses also include the last update time, + * the latest message text and whether notification has attachments. + * + * Generated from protobuf enum BASIC = 1; + */ + const BASIC = 1; + /** + * Include everything. + * + * Generated from protobuf enum FULL = 2; + */ + const FULL = 2; + + private static $valueToName = [ + self::NOTIFICATION_VIEW_UNSPECIFIED => 'NOTIFICATION_VIEW_UNSPECIFIED', + self::BASIC => 'BASIC', + self::FULL => 'FULL', + ]; + + 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/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Settings.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Settings.php new file mode 100644 index 000000000000..70baa8b3ef7c --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Settings.php @@ -0,0 +1,163 @@ +google.cloud.advisorynotifications.v1.Settings + */ +class Settings extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the settings to retrieve. + * Format: + * organizations/{organization}/locations/{location}/settings. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Required. Map of each notification type and its settings to get/set all + * settings at once. The server will validate the value for each notification + * type. + * + * Generated from protobuf field map notification_settings = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $notification_settings; + /** + * Required. Fingerprint for optimistic concurrency returned in Get requests. + * Must be provided for Update requests. If the value provided does not match + * the value known to the server, ABORTED will be thrown, and the client + * should retry the read-modify-write cycle. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of the settings to retrieve. + * Format: + * organizations/{organization}/locations/{location}/settings. + * @type array|\Google\Protobuf\Internal\MapField $notification_settings + * Required. Map of each notification type and its settings to get/set all + * settings at once. The server will validate the value for each notification + * type. + * @type string $etag + * Required. Fingerprint for optimistic concurrency returned in Get requests. + * Must be provided for Update requests. If the value provided does not match + * the value known to the server, ABORTED will be thrown, and the client + * should retry the read-modify-write cycle. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the settings to retrieve. + * Format: + * organizations/{organization}/locations/{location}/settings. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of the settings to retrieve. + * Format: + * organizations/{organization}/locations/{location}/settings. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. Map of each notification type and its settings to get/set all + * settings at once. The server will validate the value for each notification + * type. + * + * Generated from protobuf field map notification_settings = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getNotificationSettings() + { + return $this->notification_settings; + } + + /** + * Required. Map of each notification type and its settings to get/set all + * settings at once. The server will validate the value for each notification + * type. + * + * Generated from protobuf field map notification_settings = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setNotificationSettings($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AdvisoryNotifications\V1\NotificationSettings::class); + $this->notification_settings = $arr; + + return $this; + } + + /** + * Required. Fingerprint for optimistic concurrency returned in Get requests. + * Must be provided for Update requests. If the value provided does not match + * the value known to the server, ABORTED will be thrown, and the client + * should retry the read-modify-write cycle. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Required. Fingerprint for optimistic concurrency returned in Get requests. + * Must be provided for Update requests. If the value provided does not match + * the value known to the server, ABORTED will be thrown, and the client + * should retry the read-modify-write cycle. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Subject.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Subject.php new file mode 100644 index 000000000000..8bf64ea40244 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Subject.php @@ -0,0 +1,77 @@ +google.cloud.advisorynotifications.v1.Subject + */ +class Subject extends \Google\Protobuf\Internal\Message +{ + /** + * The text content. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Text text = 1; + */ + protected $text = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AdvisoryNotifications\V1\Text $text + * The text content. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The text content. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Text text = 1; + * @return \Google\Cloud\AdvisoryNotifications\V1\Text|null + */ + public function getText() + { + return $this->text; + } + + public function hasText() + { + return isset($this->text); + } + + public function clearText() + { + unset($this->text); + } + + /** + * The text content. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Text text = 1; + * @param \Google\Cloud\AdvisoryNotifications\V1\Text $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AdvisoryNotifications\V1\Text::class); + $this->text = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Text.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Text.php new file mode 100644 index 000000000000..932bb0dd9992 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Text.php @@ -0,0 +1,135 @@ +google.cloud.advisorynotifications.v1.Text + */ +class Text extends \Google\Protobuf\Internal\Message +{ + /** + * The English copy. + * + * Generated from protobuf field string en_text = 1; + */ + protected $en_text = ''; + /** + * The requested localized copy (if applicable). + * + * Generated from protobuf field string localized_text = 2; + */ + protected $localized_text = ''; + /** + * Status of the localization. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.LocalizationState localization_state = 3; + */ + protected $localization_state = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $en_text + * The English copy. + * @type string $localized_text + * The requested localized copy (if applicable). + * @type int $localization_state + * Status of the localization. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The English copy. + * + * Generated from protobuf field string en_text = 1; + * @return string + */ + public function getEnText() + { + return $this->en_text; + } + + /** + * The English copy. + * + * Generated from protobuf field string en_text = 1; + * @param string $var + * @return $this + */ + public function setEnText($var) + { + GPBUtil::checkString($var, True); + $this->en_text = $var; + + return $this; + } + + /** + * The requested localized copy (if applicable). + * + * Generated from protobuf field string localized_text = 2; + * @return string + */ + public function getLocalizedText() + { + return $this->localized_text; + } + + /** + * The requested localized copy (if applicable). + * + * Generated from protobuf field string localized_text = 2; + * @param string $var + * @return $this + */ + public function setLocalizedText($var) + { + GPBUtil::checkString($var, True); + $this->localized_text = $var; + + return $this; + } + + /** + * Status of the localization. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.LocalizationState localization_state = 3; + * @return int + */ + public function getLocalizationState() + { + return $this->localization_state; + } + + /** + * Status of the localization. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.LocalizationState localization_state = 3; + * @param int $var + * @return $this + */ + public function setLocalizationState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AdvisoryNotifications\V1\LocalizationState::class); + $this->localization_state = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/UpdateSettingsRequest.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/UpdateSettingsRequest.php new file mode 100644 index 000000000000..ac58bb44826a --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/UpdateSettingsRequest.php @@ -0,0 +1,90 @@ +google.cloud.advisorynotifications.v1.UpdateSettingsRequest + */ +class UpdateSettingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. New settings. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Settings settings = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $settings = null; + + /** + * @param \Google\Cloud\AdvisoryNotifications\V1\Settings $settings Required. New settings. + * + * @return \Google\Cloud\AdvisoryNotifications\V1\UpdateSettingsRequest + * + * @experimental + */ + public static function build(\Google\Cloud\AdvisoryNotifications\V1\Settings $settings): self + { + return (new self()) + ->setSettings($settings); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AdvisoryNotifications\V1\Settings $settings + * Required. New settings. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. New settings. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Settings settings = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AdvisoryNotifications\V1\Settings|null + */ + public function getSettings() + { + return $this->settings; + } + + public function hasSettings() + { + return isset($this->settings); + } + + public function clearSettings() + { + unset($this->settings); + } + + /** + * Required. New settings. + * + * Generated from protobuf field .google.cloud.advisorynotifications.v1.Settings settings = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AdvisoryNotifications\V1\Settings $var + * @return $this + */ + public function setSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AdvisoryNotifications\V1\Settings::class); + $this->settings = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_notification.php b/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_notification.php new file mode 100644 index 000000000000..fcd899daed22 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_notification.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Notification $response */ + $response = $advisoryNotificationsServiceClient->getNotification($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AdvisoryNotificationsServiceClient::notificationName( + '[ORGANIZATION]', + '[LOCATION]', + '[NOTIFICATION]' + ); + + get_notification_sample($formattedName); +} +// [END advisorynotifications_v1_generated_AdvisoryNotificationsService_GetNotification_sync] diff --git a/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_settings.php b/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_settings.php new file mode 100644 index 000000000000..a73cd9812f06 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_settings.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Settings $response */ + $response = $advisoryNotificationsServiceClient->getSettings($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AdvisoryNotificationsServiceClient::settingsName('[ORGANIZATION]', '[LOCATION]'); + + get_settings_sample($formattedName); +} +// [END advisorynotifications_v1_generated_AdvisoryNotificationsService_GetSettings_sync] diff --git a/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/list_notifications.php b/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/list_notifications.php new file mode 100644 index 000000000000..15ef2e226114 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/list_notifications.php @@ -0,0 +1,78 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $advisoryNotificationsServiceClient->listNotifications($request); + + /** @var Notification $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = AdvisoryNotificationsServiceClient::locationName('[ORGANIZATION]', '[LOCATION]'); + + list_notifications_sample($formattedParent); +} +// [END advisorynotifications_v1_generated_AdvisoryNotificationsService_ListNotifications_sync] diff --git a/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/update_settings.php b/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/update_settings.php new file mode 100644 index 000000000000..0367ac99f11f --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/update_settings.php @@ -0,0 +1,77 @@ +setNotificationSettings($settingsNotificationSettings) + ->setEtag($settingsEtag); + $request = (new UpdateSettingsRequest()) + ->setSettings($settings); + + // Call the API and handle any network failures. + try { + /** @var Settings $response */ + $response = $advisoryNotificationsServiceClient->updateSettings($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $settingsEtag = '[ETAG]'; + + update_settings_sample($settingsEtag); +} +// [END advisorynotifications_v1_generated_AdvisoryNotificationsService_UpdateSettings_sync] diff --git a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/AdvisoryNotificationsServiceClient.php b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/AdvisoryNotificationsServiceClient.php new file mode 100644 index 000000000000..8fee207f5688 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/AdvisoryNotificationsServiceClient.php @@ -0,0 +1,34 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/advisory_notifications_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/advisory_notifications_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/advisory_notifications_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/advisory_notifications_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $organization + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $organization, string $location): string + { + return self::getPathTemplate('location')->render([ + 'organization' => $organization, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a notification + * resource. + * + * @param string $organization + * @param string $location + * @param string $notification + * + * @return string The formatted notification resource. + */ + public static function notificationName(string $organization, string $location, string $notification): string + { + return self::getPathTemplate('notification')->render([ + 'organization' => $organization, + 'location' => $location, + 'notification' => $notification, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location resource. + * + * @param string $organization + * @param string $location + * + * @return string The formatted organization_location resource. + */ + public static function organizationLocationName(string $organization, string $location): string + { + return self::getPathTemplate('organizationLocation')->render([ + 'organization' => $organization, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_notification resource. + * + * @param string $organization + * @param string $location + * @param string $notification + * + * @return string The formatted organization_location_notification resource. + */ + public static function organizationLocationNotificationName(string $organization, string $location, string $notification): string + { + return self::getPathTemplate('organizationLocationNotification')->render([ + 'organization' => $organization, + 'location' => $location, + 'notification' => $notification, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted project_location resource. + */ + public static function projectLocationName(string $project, string $location): string + { + return self::getPathTemplate('projectLocation')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_notification resource. + * + * @param string $project + * @param string $location + * @param string $notification + * + * @return string The formatted project_location_notification resource. + */ + public static function projectLocationNotificationName(string $project, string $location, string $notification): string + { + return self::getPathTemplate('projectLocationNotification')->render([ + 'project' => $project, + 'location' => $location, + 'notification' => $notification, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a settings + * resource. + * + * @param string $organization + * @param string $location + * + * @return string The formatted settings resource. + */ + public static function settingsName(string $organization, string $location): string + { + return self::getPathTemplate('settings')->render([ + 'organization' => $organization, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - location: organizations/{organization}/locations/{location} + * - notification: organizations/{organization}/locations/{location}/notifications/{notification} + * - organizationLocation: organizations/{organization}/locations/{location} + * - organizationLocationNotification: organizations/{organization}/locations/{location}/notifications/{notification} + * - projectLocation: projects/{project}/locations/{location} + * - projectLocationNotification: projects/{project}/locations/{location}/notifications/{notification} + * - settings: organizations/{organization}/locations/{location}/settings + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'advisorynotifications.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Gets a notification. + * + * The async variant is + * {@see AdvisoryNotificationsServiceClient::getNotificationAsync()} . + * + * @example samples/V1/AdvisoryNotificationsServiceClient/get_notification.php + * + * @param GetNotificationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Notification + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNotification(GetNotificationRequest $request, array $callOptions = []): Notification + { + return $this->startApiCall('GetNotification', $request, $callOptions)->wait(); + } + + /** + * Get notification settings. + * + * The async variant is + * {@see AdvisoryNotificationsServiceClient::getSettingsAsync()} . + * + * @example samples/V1/AdvisoryNotificationsServiceClient/get_settings.php + * + * @param GetSettingsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Settings + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSettings(GetSettingsRequest $request, array $callOptions = []): Settings + { + return $this->startApiCall('GetSettings', $request, $callOptions)->wait(); + } + + /** + * Lists notifications under a given parent. + * + * The async variant is + * {@see AdvisoryNotificationsServiceClient::listNotificationsAsync()} . + * + * @example samples/V1/AdvisoryNotificationsServiceClient/list_notifications.php + * + * @param ListNotificationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listNotifications(ListNotificationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListNotifications', $request, $callOptions); + } + + /** + * Update notification settings. + * + * The async variant is + * {@see AdvisoryNotificationsServiceClient::updateSettingsAsync()} . + * + * @example samples/V1/AdvisoryNotificationsServiceClient/update_settings.php + * + * @param UpdateSettingsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Settings + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSettings(UpdateSettingsRequest $request, array $callOptions = []): Settings + { + return $this->startApiCall('UpdateSettings', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/Gapic/AdvisoryNotificationsServiceGapicClient.php b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/Gapic/AdvisoryNotificationsServiceGapicClient.php new file mode 100644 index 000000000000..32b54e7941dc --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/Gapic/AdvisoryNotificationsServiceGapicClient.php @@ -0,0 +1,656 @@ +notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); + * $response = $advisoryNotificationsServiceClient->getNotification($formattedName); + * } finally { + * $advisoryNotificationsServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * This service has a new (beta) implementation. See {@see + * \Google\Cloud\AdvisoryNotifications\V1\Client\AdvisoryNotificationsServiceClient} + * to use the new surface. + */ +class AdvisoryNotificationsServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.advisorynotifications.v1.AdvisoryNotificationsService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'advisorynotifications.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $locationNameTemplate; + + private static $notificationNameTemplate; + + private static $organizationLocationNameTemplate; + + private static $organizationLocationNotificationNameTemplate; + + private static $projectLocationNameTemplate; + + private static $projectLocationNotificationNameTemplate; + + private static $settingsNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/advisory_notifications_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/advisory_notifications_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/advisory_notifications_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/advisory_notifications_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getNotificationNameTemplate() + { + if (self::$notificationNameTemplate == null) { + self::$notificationNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/notifications/{notification}'); + } + + return self::$notificationNameTemplate; + } + + private static function getOrganizationLocationNameTemplate() + { + if (self::$organizationLocationNameTemplate == null) { + self::$organizationLocationNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}'); + } + + return self::$organizationLocationNameTemplate; + } + + private static function getOrganizationLocationNotificationNameTemplate() + { + if (self::$organizationLocationNotificationNameTemplate == null) { + self::$organizationLocationNotificationNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/notifications/{notification}'); + } + + return self::$organizationLocationNotificationNameTemplate; + } + + private static function getProjectLocationNameTemplate() + { + if (self::$projectLocationNameTemplate == null) { + self::$projectLocationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$projectLocationNameTemplate; + } + + private static function getProjectLocationNotificationNameTemplate() + { + if (self::$projectLocationNotificationNameTemplate == null) { + self::$projectLocationNotificationNameTemplate = new PathTemplate('projects/{project}/locations/{location}/notifications/{notification}'); + } + + return self::$projectLocationNotificationNameTemplate; + } + + private static function getSettingsNameTemplate() + { + if (self::$settingsNameTemplate == null) { + self::$settingsNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/settings'); + } + + return self::$settingsNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'location' => self::getLocationNameTemplate(), + 'notification' => self::getNotificationNameTemplate(), + 'organizationLocation' => self::getOrganizationLocationNameTemplate(), + 'organizationLocationNotification' => self::getOrganizationLocationNotificationNameTemplate(), + 'projectLocation' => self::getProjectLocationNameTemplate(), + 'projectLocationNotification' => self::getProjectLocationNotificationNameTemplate(), + 'settings' => self::getSettingsNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $organization + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($organization, $location) + { + return self::getLocationNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a notification + * resource. + * + * @param string $organization + * @param string $location + * @param string $notification + * + * @return string The formatted notification resource. + */ + public static function notificationName($organization, $location, $notification) + { + return self::getNotificationNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'notification' => $notification, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location resource. + * + * @param string $organization + * @param string $location + * + * @return string The formatted organization_location resource. + */ + public static function organizationLocationName($organization, $location) + { + return self::getOrganizationLocationNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_notification resource. + * + * @param string $organization + * @param string $location + * @param string $notification + * + * @return string The formatted organization_location_notification resource. + */ + public static function organizationLocationNotificationName($organization, $location, $notification) + { + return self::getOrganizationLocationNotificationNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'notification' => $notification, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted project_location resource. + */ + public static function projectLocationName($project, $location) + { + return self::getProjectLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_notification resource. + * + * @param string $project + * @param string $location + * @param string $notification + * + * @return string The formatted project_location_notification resource. + */ + public static function projectLocationNotificationName($project, $location, $notification) + { + return self::getProjectLocationNotificationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'notification' => $notification, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a settings + * resource. + * + * @param string $organization + * @param string $location + * + * @return string The formatted settings resource. + */ + public static function settingsName($organization, $location) + { + return self::getSettingsNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - location: organizations/{organization}/locations/{location} + * - notification: organizations/{organization}/locations/{location}/notifications/{notification} + * - organizationLocation: organizations/{organization}/locations/{location} + * - organizationLocationNotification: organizations/{organization}/locations/{location}/notifications/{notification} + * - projectLocation: projects/{project}/locations/{location} + * - projectLocationNotification: projects/{project}/locations/{location}/notifications/{notification} + * - settings: organizations/{organization}/locations/{location}/settings + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'advisorynotifications.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Gets a notification. + * + * Sample code: + * ``` + * $advisoryNotificationsServiceClient = new AdvisoryNotificationsServiceClient(); + * try { + * $formattedName = $advisoryNotificationsServiceClient->notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); + * $response = $advisoryNotificationsServiceClient->getNotification($formattedName); + * } finally { + * $advisoryNotificationsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. A name of the notification to retrieve. + * Format: + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{projects}/locations/{location}/notifications/{notification}. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * ISO code for requested localization language. If unset, will be + * interpereted as "en". If the requested language is valid, but not supported + * for this notification, English will be returned with an "Not applicable" + * LocalizationState. If the ISO code is invalid (i.e. not a real language), + * this RPC will throw an error. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\AdvisoryNotifications\V1\Notification + * + * @throws ApiException if the remote call fails + */ + public function getNotification($name, array $optionalArgs = []) + { + $request = new GetNotificationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetNotification', Notification::class, $optionalArgs, $request)->wait(); + } + + /** + * Get notification settings. + * + * Sample code: + * ``` + * $advisoryNotificationsServiceClient = new AdvisoryNotificationsServiceClient(); + * try { + * $formattedName = $advisoryNotificationsServiceClient->settingsName('[ORGANIZATION]', '[LOCATION]'); + * $response = $advisoryNotificationsServiceClient->getSettings($formattedName); + * } finally { + * $advisoryNotificationsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the settings to retrieve. + * Format: + * organizations/{organization}/locations/{location}/settings. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\AdvisoryNotifications\V1\Settings + * + * @throws ApiException if the remote call fails + */ + public function getSettings($name, array $optionalArgs = []) + { + $request = new GetSettingsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSettings', Settings::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists notifications under a given parent. + * + * Sample code: + * ``` + * $advisoryNotificationsServiceClient = new AdvisoryNotificationsServiceClient(); + * try { + * $formattedParent = $advisoryNotificationsServiceClient->locationName('[ORGANIZATION]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $advisoryNotificationsServiceClient->listNotifications($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $advisoryNotificationsServiceClient->listNotifications($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $advisoryNotificationsServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent, which owns this collection of notifications. + * Must be of the form "organizations/{organization}/locations/{location}" + * or "projects/{project}/locations/{location}" + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $view + * Specifies which parts of the notification resource should be returned + * in the response. + * For allowed values, use constants defined on {@see \Google\Cloud\AdvisoryNotifications\V1\NotificationView} + * @type string $languageCode + * ISO code for requested localization language. If unset, will be + * interpereted as "en". If the requested language is valid, but not supported + * for this notification, English will be returned with an "Not applicable" + * LocalizationState. If the ISO code is invalid (i.e. not a real language), + * this RPC will throw an error. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listNotifications($parent, array $optionalArgs = []) + { + $request = new ListNotificationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListNotifications', $optionalArgs, ListNotificationsResponse::class, $request); + } + + /** + * Update notification settings. + * + * Sample code: + * ``` + * $advisoryNotificationsServiceClient = new AdvisoryNotificationsServiceClient(); + * try { + * $settings = new Settings(); + * $response = $advisoryNotificationsServiceClient->updateSettings($settings); + * } finally { + * $advisoryNotificationsServiceClient->close(); + * } + * ``` + * + * @param Settings $settings Required. New settings. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\AdvisoryNotifications\V1\Settings + * + * @throws ApiException if the remote call fails + */ + public function updateSettings($settings, array $optionalArgs = []) + { + $request = new UpdateSettingsRequest(); + $requestParamHeaders = []; + $request->setSettings($settings); + $requestParamHeaders['settings.name'] = $settings->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateSettings', Settings::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/gapic_metadata.json b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..ff46c6a425f8 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/gapic_metadata.json @@ -0,0 +1,38 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.advisorynotifications.v1", + "libraryPackage": "Google\\Cloud\\AdvisoryNotifications\\V1", + "services": { + "AdvisoryNotificationsService": { + "clients": { + "grpc": { + "libraryClient": "AdvisoryNotificationsServiceGapicClient", + "rpcs": { + "GetNotification": { + "methods": [ + "getNotification" + ] + }, + "GetSettings": { + "methods": [ + "getSettings" + ] + }, + "ListNotifications": { + "methods": [ + "listNotifications" + ] + }, + "UpdateSettings": { + "methods": [ + "updateSettings" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_client_config.json b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_client_config.json new file mode 100644 index 000000000000..73a44f467731 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.advisorynotifications.v1.AdvisoryNotificationsService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "GetNotification": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetSettings": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListNotifications": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateSettings": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_descriptor_config.php b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_descriptor_config.php new file mode 100644 index 000000000000..ebb3a6ad425e --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_descriptor_config.php @@ -0,0 +1,74 @@ + [ + 'google.cloud.advisorynotifications.v1.AdvisoryNotificationsService' => [ + 'GetNotification' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\AdvisoryNotifications\V1\Notification', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetSettings' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\AdvisoryNotifications\V1\Settings', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListNotifications' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getNotifications', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\AdvisoryNotifications\V1\ListNotificationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateSettings' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\AdvisoryNotifications\V1\Settings', + 'headerParams' => [ + [ + 'keyName' => 'settings.name', + 'fieldAccessors' => [ + 'getSettings', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'location' => 'organizations/{organization}/locations/{location}', + 'notification' => 'organizations/{organization}/locations/{location}/notifications/{notification}', + 'organizationLocation' => 'organizations/{organization}/locations/{location}', + 'organizationLocationNotification' => 'organizations/{organization}/locations/{location}/notifications/{notification}', + 'projectLocation' => 'projects/{project}/locations/{location}', + 'projectLocationNotification' => 'projects/{project}/locations/{location}/notifications/{notification}', + 'settings' => 'organizations/{organization}/locations/{location}/settings', + ], + ], + ], +]; diff --git a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_rest_client_config.php b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_rest_client_config.php new file mode 100644 index 000000000000..5dfef8bb6492 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_rest_client_config.php @@ -0,0 +1,67 @@ + [ + 'google.cloud.advisorynotifications.v1.AdvisoryNotificationsService' => [ + 'GetNotification' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/notifications/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/notifications/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetSettings' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/settings}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListNotifications' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=organizations/*/locations/*}/notifications', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/notifications', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateSettings' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{settings.name=organizations/*/locations/*/settings}', + 'body' => 'settings', + 'placeholders' => [ + 'settings.name' => [ + 'getters' => [ + 'getSettings', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/AdvisoryNotificationsServiceClientTest.php b/owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/AdvisoryNotificationsServiceClientTest.php new file mode 100644 index 000000000000..6989a92dbcb7 --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/AdvisoryNotificationsServiceClientTest.php @@ -0,0 +1,332 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AdvisoryNotificationsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AdvisoryNotificationsServiceClient($options); + } + + /** @test */ + public function getNotificationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Notification(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); + $response = $gapicClient->getNotification($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/GetNotification', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); + try { + $gapicClient->getNotification($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSettingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $expectedResponse = new Settings(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->settingsName('[ORGANIZATION]', '[LOCATION]'); + $response = $gapicClient->getSettings($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/GetSettings', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSettingsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->settingsName('[ORGANIZATION]', '[LOCATION]'); + try { + $gapicClient->getSettings($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotificationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $notificationsElement = new Notification(); + $notifications = [ + $notificationsElement, + ]; + $expectedResponse = new ListNotificationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setNotifications($notifications); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[ORGANIZATION]', '[LOCATION]'); + $response = $gapicClient->listNotifications($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNotifications()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/ListNotifications', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotificationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[ORGANIZATION]', '[LOCATION]'); + try { + $gapicClient->listNotifications($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSettingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $expectedResponse = new Settings(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $settings = new Settings(); + $notificationSettingsValue = new NotificationSettings(); + $settingsNotificationSettings = [ + 'notificationSettingsKey' => $notificationSettingsValue, + ]; + $settings->setNotificationSettings($settingsNotificationSettings); + $settingsEtag = 'settingsEtag533925848'; + $settings->setEtag($settingsEtag); + $response = $gapicClient->updateSettings($settings); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/UpdateSettings', $actualFuncCall); + $actualValue = $actualRequestObject->getSettings(); + $this->assertProtobufEquals($settings, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSettingsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $settings = new Settings(); + $notificationSettingsValue = new NotificationSettings(); + $settingsNotificationSettings = [ + 'notificationSettingsKey' => $notificationSettingsValue, + ]; + $settings->setNotificationSettings($settingsNotificationSettings); + $settingsEtag = 'settingsEtag533925848'; + $settings->setEtag($settingsEtag); + try { + $gapicClient->updateSettings($settings); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/Client/AdvisoryNotificationsServiceClientTest.php b/owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/Client/AdvisoryNotificationsServiceClientTest.php new file mode 100644 index 000000000000..c2174baa744f --- /dev/null +++ b/owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/Client/AdvisoryNotificationsServiceClientTest.php @@ -0,0 +1,381 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AdvisoryNotificationsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AdvisoryNotificationsServiceClient($options); + } + + /** @test */ + public function getNotificationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Notification(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); + $request = (new GetNotificationRequest()) + ->setName($formattedName); + $response = $gapicClient->getNotification($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/GetNotification', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); + $request = (new GetNotificationRequest()) + ->setName($formattedName); + try { + $gapicClient->getNotification($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSettingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $expectedResponse = new Settings(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->settingsName('[ORGANIZATION]', '[LOCATION]'); + $request = (new GetSettingsRequest()) + ->setName($formattedName); + $response = $gapicClient->getSettings($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/GetSettings', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSettingsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->settingsName('[ORGANIZATION]', '[LOCATION]'); + $request = (new GetSettingsRequest()) + ->setName($formattedName); + try { + $gapicClient->getSettings($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotificationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $notificationsElement = new Notification(); + $notifications = [ + $notificationsElement, + ]; + $expectedResponse = new ListNotificationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setNotifications($notifications); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[ORGANIZATION]', '[LOCATION]'); + $request = (new ListNotificationsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listNotifications($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNotifications()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/ListNotifications', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotificationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[ORGANIZATION]', '[LOCATION]'); + $request = (new ListNotificationsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listNotifications($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSettingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $expectedResponse = new Settings(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $settings = new Settings(); + $notificationSettingsValue = new NotificationSettings(); + $settingsNotificationSettings = [ + 'notificationSettingsKey' => $notificationSettingsValue, + ]; + $settings->setNotificationSettings($settingsNotificationSettings); + $settingsEtag = 'settingsEtag533925848'; + $settings->setEtag($settingsEtag); + $request = (new UpdateSettingsRequest()) + ->setSettings($settings); + $response = $gapicClient->updateSettings($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/UpdateSettings', $actualFuncCall); + $actualValue = $actualRequestObject->getSettings(); + $this->assertProtobufEquals($settings, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSettingsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $settings = new Settings(); + $notificationSettingsValue = new NotificationSettings(); + $settingsNotificationSettings = [ + 'notificationSettingsKey' => $notificationSettingsValue, + ]; + $settings->setNotificationSettings($settingsNotificationSettings); + $settingsEtag = 'settingsEtag533925848'; + $settings->setEtag($settingsEtag); + $request = (new UpdateSettingsRequest()) + ->setSettings($settings); + try { + $gapicClient->updateSettings($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Notification(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); + $request = (new GetNotificationRequest()) + ->setName($formattedName); + $response = $gapicClient->getNotificationAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/GetNotification', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} From 5491f76a919580ab9fdbb0e31b737fd8fb60cd2a Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 7 Dec 2023 18:00:35 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- AdvisoryNotifications/metadata/V1/Service.php | Bin 5233 -> 5452 bytes .../get_notification.php | 3 +- .../list_notifications.php | 5 +- .../AdvisoryNotificationsServiceClient.php | 76 ++ ...dvisoryNotificationsServiceGapicClient.php | 144 +++- .../src/V1/GetNotificationRequest.php | 15 +- .../src/V1/ListNotificationsRequest.php | 17 +- AdvisoryNotifications/src/V1/Notification.php | 12 +- ...otifications_service_descriptor_config.php | 4 + ...tifications_service_rest_client_config.php | 12 + .../Advisorynotifications/V1/Service.php | Bin 5452 -> 0 bytes .../AdvisoryNotifications/V1/Attachment.php | 109 --- .../Cloud/AdvisoryNotifications/V1/Csv.php | 106 --- .../AdvisoryNotifications/V1/Csv/CsvRow.php | 74 -- .../V1/GetNotificationRequest.php | 146 ---- .../V1/GetSettingsRequest.php | 91 --- .../V1/ListNotificationsRequest.php | 267 ------- .../V1/ListNotificationsResponse.php | 139 ---- .../V1/LocalizationState.php | 73 -- .../AdvisoryNotifications/V1/Message.php | 199 ------ .../AdvisoryNotifications/V1/Message/Body.php | 80 --- .../AdvisoryNotifications/V1/Notification.php | 236 ------- .../V1/NotificationSettings.php | 67 -- .../V1/NotificationType.php | 75 -- .../V1/NotificationView.php | 63 -- .../AdvisoryNotifications/V1/Settings.php | 163 ----- .../AdvisoryNotifications/V1/Subject.php | 77 -- .../Cloud/AdvisoryNotifications/V1/Text.php | 135 ---- .../V1/UpdateSettingsRequest.php | 90 --- .../get_notification.php | 78 --- .../get_settings.php | 73 -- .../list_notifications.php | 78 --- .../update_settings.php | 77 -- .../V1/AdvisoryNotificationsServiceClient.php | 34 - .../AdvisoryNotificationsServiceClient.php | 440 ------------ ...dvisoryNotificationsServiceGapicClient.php | 656 ------------------ .../v1/src/V1/gapic_metadata.json | 38 - ...y_notifications_service_client_config.json | 54 -- ...otifications_service_descriptor_config.php | 74 -- ...tifications_service_rest_client_config.php | 67 -- ...AdvisoryNotificationsServiceClientTest.php | 332 --------- ...AdvisoryNotificationsServiceClientTest.php | 381 ---------- 42 files changed, 268 insertions(+), 4592 deletions(-) delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/GPBMetadata/Google/Cloud/Advisorynotifications/V1/Service.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Attachment.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv/CsvRow.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetNotificationRequest.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetSettingsRequest.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsRequest.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsResponse.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/LocalizationState.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message/Body.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Notification.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationSettings.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationType.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationView.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Settings.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Subject.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Text.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/UpdateSettingsRequest.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_notification.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_settings.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/list_notifications.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/update_settings.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/AdvisoryNotificationsServiceClient.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/Client/AdvisoryNotificationsServiceClient.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/Gapic/AdvisoryNotificationsServiceGapicClient.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/gapic_metadata.json delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_client_config.json delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_descriptor_config.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_rest_client_config.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/AdvisoryNotificationsServiceClientTest.php delete mode 100644 owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/Client/AdvisoryNotificationsServiceClientTest.php diff --git a/AdvisoryNotifications/metadata/V1/Service.php b/AdvisoryNotifications/metadata/V1/Service.php index 1b9b2b5507e0b80f9e8d7959a936f18e78372dc6..7c16188aa28f84abea6047d1f460527b62dd7a2e 100644 GIT binary patch delta 250 zcmeyUaYkzcFEi68<;ncamzk!qY<|M5#mMoB@s;BP{?5%`35m8M2pOgQ<~e@^k(+&MJstBWN-fI?CwpMpG;=5nEaC8g6EbaTR~z`YF>%Z8OF&;0&VQB wP|5cK7Mo)PzcaG`VdBzE&d;5^kY8render([ + 'organization' => $organization, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_notification resource. + * + * @param string $organization + * @param string $location + * @param string $notification + * + * @return string The formatted organization_location_notification resource. + */ + public static function organizationLocationNotificationName(string $organization, string $location, string $notification): string + { + return self::getPathTemplate('organizationLocationNotification')->render([ + 'organization' => $organization, + 'location' => $location, + 'notification' => $notification, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted project_location resource. + */ + public static function projectLocationName(string $project, string $location): string + { + return self::getPathTemplate('projectLocation')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_notification resource. + * + * @param string $project + * @param string $location + * @param string $notification + * + * @return string The formatted project_location_notification resource. + */ + public static function projectLocationNotificationName(string $project, string $location, string $notification): string + { + return self::getPathTemplate('projectLocationNotification')->render([ + 'project' => $project, + 'location' => $location, + 'notification' => $notification, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a settings * resource. @@ -163,6 +235,10 @@ public static function settingsName(string $organization, string $location): str * Template: Pattern * - location: organizations/{organization}/locations/{location} * - notification: organizations/{organization}/locations/{location}/notifications/{notification} + * - organizationLocation: organizations/{organization}/locations/{location} + * - organizationLocationNotification: organizations/{organization}/locations/{location}/notifications/{notification} + * - projectLocation: projects/{project}/locations/{location} + * - projectLocationNotification: projects/{project}/locations/{location}/notifications/{notification} * - settings: organizations/{organization}/locations/{location}/settings * * The optional $template argument can be supplied to specify a particular pattern, diff --git a/AdvisoryNotifications/src/V1/Gapic/AdvisoryNotificationsServiceGapicClient.php b/AdvisoryNotifications/src/V1/Gapic/AdvisoryNotificationsServiceGapicClient.php index 18559a7e9493..f3be450e6375 100644 --- a/AdvisoryNotifications/src/V1/Gapic/AdvisoryNotificationsServiceGapicClient.php +++ b/AdvisoryNotifications/src/V1/Gapic/AdvisoryNotificationsServiceGapicClient.php @@ -91,6 +91,14 @@ class AdvisoryNotificationsServiceGapicClient private static $notificationNameTemplate; + private static $organizationLocationNameTemplate; + + private static $organizationLocationNotificationNameTemplate; + + private static $projectLocationNameTemplate; + + private static $projectLocationNotificationNameTemplate; + private static $settingsNameTemplate; private static $pathTemplateMap; @@ -145,6 +153,50 @@ private static function getNotificationNameTemplate() return self::$notificationNameTemplate; } + private static function getOrganizationLocationNameTemplate() + { + if (self::$organizationLocationNameTemplate == null) { + self::$organizationLocationNameTemplate = new PathTemplate( + 'organizations/{organization}/locations/{location}' + ); + } + + return self::$organizationLocationNameTemplate; + } + + private static function getOrganizationLocationNotificationNameTemplate() + { + if (self::$organizationLocationNotificationNameTemplate == null) { + self::$organizationLocationNotificationNameTemplate = new PathTemplate( + 'organizations/{organization}/locations/{location}/notifications/{notification}' + ); + } + + return self::$organizationLocationNotificationNameTemplate; + } + + private static function getProjectLocationNameTemplate() + { + if (self::$projectLocationNameTemplate == null) { + self::$projectLocationNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}' + ); + } + + return self::$projectLocationNameTemplate; + } + + private static function getProjectLocationNotificationNameTemplate() + { + if (self::$projectLocationNotificationNameTemplate == null) { + self::$projectLocationNotificationNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/notifications/{notification}' + ); + } + + return self::$projectLocationNotificationNameTemplate; + } + private static function getSettingsNameTemplate() { if (self::$settingsNameTemplate == null) { @@ -162,6 +214,10 @@ private static function getPathTemplateMap() self::$pathTemplateMap = [ 'location' => self::getLocationNameTemplate(), 'notification' => self::getNotificationNameTemplate(), + 'organizationLocation' => self::getOrganizationLocationNameTemplate(), + 'organizationLocationNotification' => self::getOrganizationLocationNotificationNameTemplate(), + 'projectLocation' => self::getProjectLocationNameTemplate(), + 'projectLocationNotification' => self::getProjectLocationNotificationNameTemplate(), 'settings' => self::getSettingsNameTemplate(), ]; } @@ -208,6 +264,84 @@ public static function notificationName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location resource. + * + * @param string $organization + * @param string $location + * + * @return string The formatted organization_location resource. + */ + public static function organizationLocationName($organization, $location) + { + return self::getOrganizationLocationNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_notification resource. + * + * @param string $organization + * @param string $location + * @param string $notification + * + * @return string The formatted organization_location_notification resource. + */ + public static function organizationLocationNotificationName( + $organization, + $location, + $notification + ) { + return self::getOrganizationLocationNotificationNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'notification' => $notification, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted project_location resource. + */ + public static function projectLocationName($project, $location) + { + return self::getProjectLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_notification resource. + * + * @param string $project + * @param string $location + * @param string $notification + * + * @return string The formatted project_location_notification resource. + */ + public static function projectLocationNotificationName( + $project, + $location, + $notification + ) { + return self::getProjectLocationNotificationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'notification' => $notification, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a settings * resource. @@ -231,6 +365,10 @@ public static function settingsName($organization, $location) * Template: Pattern * - location: organizations/{organization}/locations/{location} * - notification: organizations/{organization}/locations/{location}/notifications/{notification} + * - organizationLocation: organizations/{organization}/locations/{location} + * - organizationLocationNotification: organizations/{organization}/locations/{location}/notifications/{notification} + * - projectLocation: projects/{project}/locations/{location} + * - projectLocationNotification: projects/{project}/locations/{location}/notifications/{notification} * - settings: organizations/{organization}/locations/{location}/settings * * The optional $template argument can be supplied to specify a particular pattern, @@ -348,7 +486,8 @@ public function __construct(array $options = []) * * @param string $name Required. A name of the notification to retrieve. * Format: - * organizations/{organization}/locations/{location}/notifications/{notification}. + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{projects}/locations/{location}/notifications/{notification}. * @param array $optionalArgs { * Optional. * @@ -469,7 +608,8 @@ public function getSettings($name, array $optionalArgs = []) * ``` * * @param string $parent Required. The parent, which owns this collection of notifications. - * Must be of the form "organizations/{organization}/locations/{location}". + * Must be of the form "organizations/{organization}/locations/{location}" + * or "projects/{project}/locations/{location}" * @param array $optionalArgs { * Optional. * diff --git a/AdvisoryNotifications/src/V1/GetNotificationRequest.php b/AdvisoryNotifications/src/V1/GetNotificationRequest.php index bfb43fef07e5..58d3b8a07814 100644 --- a/AdvisoryNotifications/src/V1/GetNotificationRequest.php +++ b/AdvisoryNotifications/src/V1/GetNotificationRequest.php @@ -18,7 +18,8 @@ class GetNotificationRequest extends \Google\Protobuf\Internal\Message /** * Required. A name of the notification to retrieve. * Format: - * organizations/{organization}/locations/{location}/notifications/{notification}. + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{projects}/locations/{location}/notifications/{notification}. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -37,7 +38,8 @@ class GetNotificationRequest extends \Google\Protobuf\Internal\Message /** * @param string $name Required. A name of the notification to retrieve. * Format: - * organizations/{organization}/locations/{location}/notifications/{notification}. Please see + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{projects}/locations/{location}/notifications/{notification}. Please see * {@see AdvisoryNotificationsServiceClient::notificationName()} for help formatting this field. * * @return \Google\Cloud\AdvisoryNotifications\V1\GetNotificationRequest @@ -59,7 +61,8 @@ public static function build(string $name): self * @type string $name * Required. A name of the notification to retrieve. * Format: - * organizations/{organization}/locations/{location}/notifications/{notification}. + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{projects}/locations/{location}/notifications/{notification}. * @type string $language_code * ISO code for requested localization language. If unset, will be * interpereted as "en". If the requested language is valid, but not supported @@ -76,7 +79,8 @@ public function __construct($data = NULL) { /** * Required. A name of the notification to retrieve. * Format: - * organizations/{organization}/locations/{location}/notifications/{notification}. + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{projects}/locations/{location}/notifications/{notification}. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -89,7 +93,8 @@ public function getName() /** * Required. A name of the notification to retrieve. * Format: - * organizations/{organization}/locations/{location}/notifications/{notification}. + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{projects}/locations/{location}/notifications/{notification}. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/AdvisoryNotifications/src/V1/ListNotificationsRequest.php b/AdvisoryNotifications/src/V1/ListNotificationsRequest.php index 9d9824871e2a..9f6eb8532fb5 100644 --- a/AdvisoryNotifications/src/V1/ListNotificationsRequest.php +++ b/AdvisoryNotifications/src/V1/ListNotificationsRequest.php @@ -17,7 +17,8 @@ class ListNotificationsRequest extends \Google\Protobuf\Internal\Message { /** * Required. The parent, which owns this collection of notifications. - * Must be of the form "organizations/{organization}/locations/{location}". + * Must be of the form "organizations/{organization}/locations/{location}" + * or "projects/{project}/locations/{location}" * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -59,8 +60,9 @@ class ListNotificationsRequest extends \Google\Protobuf\Internal\Message /** * @param string $parent Required. The parent, which owns this collection of notifications. - * Must be of the form "organizations/{organization}/locations/{location}". Please see - * {@see AdvisoryNotificationsServiceClient::locationName()} for help formatting this field. + * Must be of the form "organizations/{organization}/locations/{location}" + * or "projects/{project}/locations/{location}" + * Please see {@see AdvisoryNotificationsServiceClient::locationName()} for help formatting this field. * * @return \Google\Cloud\AdvisoryNotifications\V1\ListNotificationsRequest * @@ -80,7 +82,8 @@ public static function build(string $parent): self * * @type string $parent * Required. The parent, which owns this collection of notifications. - * Must be of the form "organizations/{organization}/locations/{location}". + * Must be of the form "organizations/{organization}/locations/{location}" + * or "projects/{project}/locations/{location}" * @type int $page_size * The maximum number of notifications to return. The service may return * fewer than this value. If unspecified or equal to 0, at most 50 @@ -108,7 +111,8 @@ public function __construct($data = NULL) { /** * Required. The parent, which owns this collection of notifications. - * Must be of the form "organizations/{organization}/locations/{location}". + * Must be of the form "organizations/{organization}/locations/{location}" + * or "projects/{project}/locations/{location}" * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -120,7 +124,8 @@ public function getParent() /** * Required. The parent, which owns this collection of notifications. - * Must be of the form "organizations/{organization}/locations/{location}". + * Must be of the form "organizations/{organization}/locations/{location}" + * or "projects/{project}/locations/{location}" * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/AdvisoryNotifications/src/V1/Notification.php b/AdvisoryNotifications/src/V1/Notification.php index b18cabfae52f..76a52ae2a43f 100644 --- a/AdvisoryNotifications/src/V1/Notification.php +++ b/AdvisoryNotifications/src/V1/Notification.php @@ -19,7 +19,8 @@ class Notification extends \Google\Protobuf\Internal\Message /** * The resource name of the notification. * Format: - * organizations/{organization}/locations/{location}/notifications/{notification}. + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{project}/locations/{location}/notifications/{notification}. * * Generated from protobuf field string name = 1; */ @@ -58,7 +59,8 @@ class Notification extends \Google\Protobuf\Internal\Message * @type string $name * The resource name of the notification. * Format: - * organizations/{organization}/locations/{location}/notifications/{notification}. + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{project}/locations/{location}/notifications/{notification}. * @type \Google\Cloud\AdvisoryNotifications\V1\Subject $subject * The subject line of the notification. * @type array<\Google\Cloud\AdvisoryNotifications\V1\Message>|\Google\Protobuf\Internal\RepeatedField $messages @@ -77,7 +79,8 @@ public function __construct($data = NULL) { /** * The resource name of the notification. * Format: - * organizations/{organization}/locations/{location}/notifications/{notification}. + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{project}/locations/{location}/notifications/{notification}. * * Generated from protobuf field string name = 1; * @return string @@ -90,7 +93,8 @@ public function getName() /** * The resource name of the notification. * Format: - * organizations/{organization}/locations/{location}/notifications/{notification}. + * organizations/{organization}/locations/{location}/notifications/{notification} + * or projects/{project}/locations/{location}/notifications/{notification}. * * Generated from protobuf field string name = 1; * @param string $var diff --git a/AdvisoryNotifications/src/V1/resources/advisory_notifications_service_descriptor_config.php b/AdvisoryNotifications/src/V1/resources/advisory_notifications_service_descriptor_config.php index 550c8936d515..ebb3a6ad425e 100644 --- a/AdvisoryNotifications/src/V1/resources/advisory_notifications_service_descriptor_config.php +++ b/AdvisoryNotifications/src/V1/resources/advisory_notifications_service_descriptor_config.php @@ -63,6 +63,10 @@ 'templateMap' => [ 'location' => 'organizations/{organization}/locations/{location}', 'notification' => 'organizations/{organization}/locations/{location}/notifications/{notification}', + 'organizationLocation' => 'organizations/{organization}/locations/{location}', + 'organizationLocationNotification' => 'organizations/{organization}/locations/{location}/notifications/{notification}', + 'projectLocation' => 'projects/{project}/locations/{location}', + 'projectLocationNotification' => 'projects/{project}/locations/{location}/notifications/{notification}', 'settings' => 'organizations/{organization}/locations/{location}/settings', ], ], diff --git a/AdvisoryNotifications/src/V1/resources/advisory_notifications_service_rest_client_config.php b/AdvisoryNotifications/src/V1/resources/advisory_notifications_service_rest_client_config.php index d623ce46e74b..5dfef8bb6492 100644 --- a/AdvisoryNotifications/src/V1/resources/advisory_notifications_service_rest_client_config.php +++ b/AdvisoryNotifications/src/V1/resources/advisory_notifications_service_rest_client_config.php @@ -6,6 +6,12 @@ 'GetNotification' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=organizations/*/locations/*/notifications/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/notifications/*}', + ], + ], 'placeholders' => [ 'name' => [ 'getters' => [ @@ -28,6 +34,12 @@ 'ListNotifications' => [ 'method' => 'get', 'uriTemplate' => '/v1/{parent=organizations/*/locations/*}/notifications', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/notifications', + ], + ], 'placeholders' => [ 'parent' => [ 'getters' => [ diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/GPBMetadata/Google/Cloud/Advisorynotifications/V1/Service.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/GPBMetadata/Google/Cloud/Advisorynotifications/V1/Service.php deleted file mode 100644 index 7c16188aa28f84abea6047d1f460527b62dd7a2e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5452 zcmbtY&2QV-5np{cu}9v-e%S0f!gk9j3F3Gg3RZU8gjsKv`mn==A`6o2)`0+mqMl`L zWRfK*IgaZ?3-nO**hSAh6-EDpp7y@SEzm3PaOSk$$XRy0V9YMGDZKF>eQ4q?TLT$4p zRLV;07OJ||z|pBB^en5_r+K|^4Z3-)J2YI&IW#TL*fn&`Gc4214_EUpb%uscMQ$I! z)b^=sYdRG+>c!{O)4H0cwKuq_c8Qs4%hOD?w^yG4=zYy~g{E&3jzGXad(i0{y5M@a zrY_tuT-7iQ&(QkDYm9D9*wy+jMcvb~y8}~aehN%s)70tmeZjZMWbfD(qOm4~&ea(} z2u@ouJ?fZRzg?!T?ijXbIdv43q#pG~u(B`9_k(4bIb&B?_I;G3Q%%s!^2BdF}dq2iM;g1 zsiiLtSF;}kwl&+pE@2S+U6B20Y#SdMuwgv1xf{W%Tu zwMZ9|c}TOaTS^FtcuDXNHS5)_wlK3H05XD&0h)rLMd;znV16S)&cPS;LE@0ug zuSPzBjP6h*AC>vOl;&<^LpQ>}#8Iw`sqf_!X~1HXTvYGSrc3jvd#&(`Q1|?Vh*4Nt zs4kr(PUIgGusS`3J}#I&S41|$4`i8lICezQA;c8e*k0CvBBUAV|rb!k=?wcfB4GT(!bjRu* z@@O)JhcV3r+F}t^$vR{-&(rk1eQZ+~TZ0w$YD`P=NR#BpYnx$}DV$T=9?W+Q*Y0bF>RX~IUV${5?YRR;p%^Q= zJ*su7<6@dpSX^b8W5278b#PI<(VmF^4eKC#6R!AAepP#pfwaUI$eko$scN`hEkcHF zgZ_Ge6ND&m#nv3mwci58$KT7z|Hu!?C8%H#=4@m`)x`}5$8UxZ0RG9dUQ&}c%p9pe zdT7uCPIs51tZh^$H{jjAX7&bbMcwMsr5V<$xvvv&b4swTjoUCvzJzgR;0VRb6q(rMgvX)+;6aSSc^OL*`(nC^wbT zLW0afdVQ-}T}ZC{B>{`4CMU_kN7c=eTvcB9)|xH3Rhck%7j8|FK_^tXUaz7b#cBnY z`UtX9#Ojq=S*dL-B#8hYPWipG`Mh4Ow9xO=%A3S^ylg{7CgW}G)F&Ox!^dNgaFJ%E zwAD~rJ8He5Y|Et`RW5HU&CSLRx{B3vdzwbAskD^siYk{Fv`usx@tGzVn10@r7g7ZA zIW5zA)~LuW_1R`adBIGj3xAu155t3KG^=iK_#|H^F+-Eng*=T}Ij1y(QqO*Ic>_Mz z=YI3MfBx{N9ac*C!aC zti_CJLNA0Q?tU(srrhf>6xg=pJPaoG<}1e|6u9Pe3{EM%k@-Q3{38LG2#b-&@#7B} zC5-)|OqBba$GuAOJcs`??vVJ7L*M_EfNSG4Nj{6|{+E8mGT@xGJAJ{(~rrlA+u(o=)5J5SE|{`chF4Su^O^4m3WDyfOv ztKWul?cf@2bPpHpE4PgoaVN=T-=rjQo02rus3f7N{KrJhLCwY;yNx5O<75?Mr-374 m)S~AfpF3Aj(6b)i8{Gu`%)fez+|-?UOUEVs+q7di2KXgoogle.cloud.advisorynotifications.v1.Attachment - */ -class Attachment extends \Google\Protobuf\Internal\Message -{ - /** - * The title of the attachment. - * - * Generated from protobuf field string display_name = 1; - */ - protected $display_name = ''; - protected $data; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\AdvisoryNotifications\V1\Csv $csv - * A CSV file attachment. Max size is 10 MB. - * @type string $display_name - * The title of the attachment. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * A CSV file attachment. Max size is 10 MB. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Csv csv = 2; - * @return \Google\Cloud\AdvisoryNotifications\V1\Csv|null - */ - public function getCsv() - { - return $this->readOneof(2); - } - - public function hasCsv() - { - return $this->hasOneof(2); - } - - /** - * A CSV file attachment. Max size is 10 MB. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Csv csv = 2; - * @param \Google\Cloud\AdvisoryNotifications\V1\Csv $var - * @return $this - */ - public function setCsv($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\AdvisoryNotifications\V1\Csv::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * The title of the attachment. - * - * Generated from protobuf field string display_name = 1; - * @return string - */ - public function getDisplayName() - { - return $this->display_name; - } - - /** - * The title of the attachment. - * - * Generated from protobuf field string display_name = 1; - * @param string $var - * @return $this - */ - public function setDisplayName($var) - { - GPBUtil::checkString($var, True); - $this->display_name = $var; - - return $this; - } - - /** - * @return string - */ - public function getData() - { - return $this->whichOneof("data"); - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv.php deleted file mode 100644 index 3389ab8c5cf5..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv.php +++ /dev/null @@ -1,106 +0,0 @@ -google.cloud.advisorynotifications.v1.Csv - */ -class Csv extends \Google\Protobuf\Internal\Message -{ - /** - * The list of headers for data columns in a CSV file. - * - * Generated from protobuf field repeated string headers = 1; - */ - private $headers; - /** - * The list of data rows in a CSV file, as string arrays rather than as a - * single comma-separated string. - * - * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Csv.CsvRow data_rows = 2; - */ - private $data_rows; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $headers - * The list of headers for data columns in a CSV file. - * @type array<\Google\Cloud\AdvisoryNotifications\V1\Csv\CsvRow>|\Google\Protobuf\Internal\RepeatedField $data_rows - * The list of data rows in a CSV file, as string arrays rather than as a - * single comma-separated string. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * The list of headers for data columns in a CSV file. - * - * Generated from protobuf field repeated string headers = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getHeaders() - { - return $this->headers; - } - - /** - * The list of headers for data columns in a CSV file. - * - * Generated from protobuf field repeated string headers = 1; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setHeaders($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->headers = $arr; - - return $this; - } - - /** - * The list of data rows in a CSV file, as string arrays rather than as a - * single comma-separated string. - * - * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Csv.CsvRow data_rows = 2; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getDataRows() - { - return $this->data_rows; - } - - /** - * The list of data rows in a CSV file, as string arrays rather than as a - * single comma-separated string. - * - * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Csv.CsvRow data_rows = 2; - * @param array<\Google\Cloud\AdvisoryNotifications\V1\Csv\CsvRow>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setDataRows($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AdvisoryNotifications\V1\Csv\CsvRow::class); - $this->data_rows = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv/CsvRow.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv/CsvRow.php deleted file mode 100644 index eb98c1535acd..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Csv/CsvRow.php +++ /dev/null @@ -1,74 +0,0 @@ -google.cloud.advisorynotifications.v1.Csv.CsvRow - */ -class CsvRow extends \Google\Protobuf\Internal\Message -{ - /** - * The data entries in a CSV file row, as a string array rather than a - * single comma-separated string. - * - * Generated from protobuf field repeated string entries = 1; - */ - private $entries; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $entries - * The data entries in a CSV file row, as a string array rather than a - * single comma-separated string. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * The data entries in a CSV file row, as a string array rather than a - * single comma-separated string. - * - * Generated from protobuf field repeated string entries = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getEntries() - { - return $this->entries; - } - - /** - * The data entries in a CSV file row, as a string array rather than a - * single comma-separated string. - * - * Generated from protobuf field repeated string entries = 1; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setEntries($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->entries = $arr; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(CsvRow::class, \Google\Cloud\AdvisoryNotifications\V1\Csv_CsvRow::class); - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetNotificationRequest.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetNotificationRequest.php deleted file mode 100644 index 58d3b8a07814..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetNotificationRequest.php +++ /dev/null @@ -1,146 +0,0 @@ -google.cloud.advisorynotifications.v1.GetNotificationRequest - */ -class GetNotificationRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. A name of the notification to retrieve. - * Format: - * organizations/{organization}/locations/{location}/notifications/{notification} - * or projects/{projects}/locations/{location}/notifications/{notification}. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * ISO code for requested localization language. If unset, will be - * interpereted as "en". If the requested language is valid, but not supported - * for this notification, English will be returned with an "Not applicable" - * LocalizationState. If the ISO code is invalid (i.e. not a real language), - * this RPC will throw an error. - * - * Generated from protobuf field string language_code = 5; - */ - protected $language_code = ''; - - /** - * @param string $name Required. A name of the notification to retrieve. - * Format: - * organizations/{organization}/locations/{location}/notifications/{notification} - * or projects/{projects}/locations/{location}/notifications/{notification}. Please see - * {@see AdvisoryNotificationsServiceClient::notificationName()} for help formatting this field. - * - * @return \Google\Cloud\AdvisoryNotifications\V1\GetNotificationRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. A name of the notification to retrieve. - * Format: - * organizations/{organization}/locations/{location}/notifications/{notification} - * or projects/{projects}/locations/{location}/notifications/{notification}. - * @type string $language_code - * ISO code for requested localization language. If unset, will be - * interpereted as "en". If the requested language is valid, but not supported - * for this notification, English will be returned with an "Not applicable" - * LocalizationState. If the ISO code is invalid (i.e. not a real language), - * this RPC will throw an error. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. A name of the notification to retrieve. - * Format: - * organizations/{organization}/locations/{location}/notifications/{notification} - * or projects/{projects}/locations/{location}/notifications/{notification}. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. A name of the notification to retrieve. - * Format: - * organizations/{organization}/locations/{location}/notifications/{notification} - * or projects/{projects}/locations/{location}/notifications/{notification}. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * ISO code for requested localization language. If unset, will be - * interpereted as "en". If the requested language is valid, but not supported - * for this notification, English will be returned with an "Not applicable" - * LocalizationState. If the ISO code is invalid (i.e. not a real language), - * this RPC will throw an error. - * - * Generated from protobuf field string language_code = 5; - * @return string - */ - public function getLanguageCode() - { - return $this->language_code; - } - - /** - * ISO code for requested localization language. If unset, will be - * interpereted as "en". If the requested language is valid, but not supported - * for this notification, English will be returned with an "Not applicable" - * LocalizationState. If the ISO code is invalid (i.e. not a real language), - * this RPC will throw an error. - * - * Generated from protobuf field string language_code = 5; - * @param string $var - * @return $this - */ - public function setLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->language_code = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetSettingsRequest.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetSettingsRequest.php deleted file mode 100644 index ca213364ae8e..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/GetSettingsRequest.php +++ /dev/null @@ -1,91 +0,0 @@ -google.cloud.advisorynotifications.v1.GetSettingsRequest - */ -class GetSettingsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The resource name of the settings to retrieve. - * Format: - * organizations/{organization}/locations/{location}/settings. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. The resource name of the settings to retrieve. - * Format: - * organizations/{organization}/locations/{location}/settings. Please see - * {@see AdvisoryNotificationsServiceClient::settingsName()} for help formatting this field. - * - * @return \Google\Cloud\AdvisoryNotifications\V1\GetSettingsRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The resource name of the settings to retrieve. - * Format: - * organizations/{organization}/locations/{location}/settings. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. The resource name of the settings to retrieve. - * Format: - * organizations/{organization}/locations/{location}/settings. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The resource name of the settings to retrieve. - * Format: - * organizations/{organization}/locations/{location}/settings. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsRequest.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsRequest.php deleted file mode 100644 index 9f6eb8532fb5..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsRequest.php +++ /dev/null @@ -1,267 +0,0 @@ -google.cloud.advisorynotifications.v1.ListNotificationsRequest - */ -class ListNotificationsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The parent, which owns this collection of notifications. - * Must be of the form "organizations/{organization}/locations/{location}" - * or "projects/{project}/locations/{location}" - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * The maximum number of notifications to return. The service may return - * fewer than this value. If unspecified or equal to 0, at most 50 - * notifications will be returned. The maximum value is 50; values above 50 - * will be coerced to 50. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * A page token returned from a previous request. - * When paginating, all other parameters provided in the request - * must match the call that returned the page token. - * - * Generated from protobuf field string page_token = 3; - */ - protected $page_token = ''; - /** - * Specifies which parts of the notification resource should be returned - * in the response. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.NotificationView view = 4; - */ - protected $view = 0; - /** - * ISO code for requested localization language. If unset, will be - * interpereted as "en". If the requested language is valid, but not supported - * for this notification, English will be returned with an "Not applicable" - * LocalizationState. If the ISO code is invalid (i.e. not a real language), - * this RPC will throw an error. - * - * Generated from protobuf field string language_code = 5; - */ - protected $language_code = ''; - - /** - * @param string $parent Required. The parent, which owns this collection of notifications. - * Must be of the form "organizations/{organization}/locations/{location}" - * or "projects/{project}/locations/{location}" - * Please see {@see AdvisoryNotificationsServiceClient::locationName()} for help formatting this field. - * - * @return \Google\Cloud\AdvisoryNotifications\V1\ListNotificationsRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The parent, which owns this collection of notifications. - * Must be of the form "organizations/{organization}/locations/{location}" - * or "projects/{project}/locations/{location}" - * @type int $page_size - * The maximum number of notifications to return. The service may return - * fewer than this value. If unspecified or equal to 0, at most 50 - * notifications will be returned. The maximum value is 50; values above 50 - * will be coerced to 50. - * @type string $page_token - * A page token returned from a previous request. - * When paginating, all other parameters provided in the request - * must match the call that returned the page token. - * @type int $view - * Specifies which parts of the notification resource should be returned - * in the response. - * @type string $language_code - * ISO code for requested localization language. If unset, will be - * interpereted as "en". If the requested language is valid, but not supported - * for this notification, English will be returned with an "Not applicable" - * LocalizationState. If the ISO code is invalid (i.e. not a real language), - * this RPC will throw an error. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. The parent, which owns this collection of notifications. - * Must be of the form "organizations/{organization}/locations/{location}" - * or "projects/{project}/locations/{location}" - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The parent, which owns this collection of notifications. - * Must be of the form "organizations/{organization}/locations/{location}" - * or "projects/{project}/locations/{location}" - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * The maximum number of notifications to return. The service may return - * fewer than this value. If unspecified or equal to 0, at most 50 - * notifications will be returned. The maximum value is 50; values above 50 - * will be coerced to 50. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * The maximum number of notifications to return. The service may return - * fewer than this value. If unspecified or equal to 0, at most 50 - * notifications will be returned. The maximum value is 50; values above 50 - * will be coerced to 50. - * - * Generated from protobuf field int32 page_size = 2; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * A page token returned from a previous request. - * When paginating, all other parameters provided in the request - * must match the call that returned the page token. - * - * Generated from protobuf field string page_token = 3; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * A page token returned from a previous request. - * When paginating, all other parameters provided in the request - * must match the call that returned the page token. - * - * Generated from protobuf field string page_token = 3; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - - /** - * Specifies which parts of the notification resource should be returned - * in the response. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.NotificationView view = 4; - * @return int - */ - public function getView() - { - return $this->view; - } - - /** - * Specifies which parts of the notification resource should be returned - * in the response. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.NotificationView view = 4; - * @param int $var - * @return $this - */ - public function setView($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\AdvisoryNotifications\V1\NotificationView::class); - $this->view = $var; - - return $this; - } - - /** - * ISO code for requested localization language. If unset, will be - * interpereted as "en". If the requested language is valid, but not supported - * for this notification, English will be returned with an "Not applicable" - * LocalizationState. If the ISO code is invalid (i.e. not a real language), - * this RPC will throw an error. - * - * Generated from protobuf field string language_code = 5; - * @return string - */ - public function getLanguageCode() - { - return $this->language_code; - } - - /** - * ISO code for requested localization language. If unset, will be - * interpereted as "en". If the requested language is valid, but not supported - * for this notification, English will be returned with an "Not applicable" - * LocalizationState. If the ISO code is invalid (i.e. not a real language), - * this RPC will throw an error. - * - * Generated from protobuf field string language_code = 5; - * @param string $var - * @return $this - */ - public function setLanguageCode($var) - { - GPBUtil::checkString($var, True); - $this->language_code = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsResponse.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsResponse.php deleted file mode 100644 index 0723811dfe75..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/ListNotificationsResponse.php +++ /dev/null @@ -1,139 +0,0 @@ -google.cloud.advisorynotifications.v1.ListNotificationsResponse - */ -class ListNotificationsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * List of notifications under a given parent. - * - * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Notification notifications = 1; - */ - private $notifications; - /** - * A token, which can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - /** - * Estimation of a total number of notifications. - * - * Generated from protobuf field int32 total_size = 3; - */ - protected $total_size = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\AdvisoryNotifications\V1\Notification>|\Google\Protobuf\Internal\RepeatedField $notifications - * List of notifications under a given parent. - * @type string $next_page_token - * A token, which can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * @type int $total_size - * Estimation of a total number of notifications. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * List of notifications under a given parent. - * - * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Notification notifications = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getNotifications() - { - return $this->notifications; - } - - /** - * List of notifications under a given parent. - * - * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Notification notifications = 1; - * @param array<\Google\Cloud\AdvisoryNotifications\V1\Notification>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setNotifications($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AdvisoryNotifications\V1\Notification::class); - $this->notifications = $arr; - - return $this; - } - - /** - * A token, which can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * A token, which can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - - /** - * Estimation of a total number of notifications. - * - * Generated from protobuf field int32 total_size = 3; - * @return int - */ - public function getTotalSize() - { - return $this->total_size; - } - - /** - * Estimation of a total number of notifications. - * - * Generated from protobuf field int32 total_size = 3; - * @param int $var - * @return $this - */ - public function setTotalSize($var) - { - GPBUtil::checkInt32($var); - $this->total_size = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/LocalizationState.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/LocalizationState.php deleted file mode 100644 index c4423106e08f..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/LocalizationState.php +++ /dev/null @@ -1,73 +0,0 @@ -google.cloud.advisorynotifications.v1.LocalizationState - */ -class LocalizationState -{ - /** - * Not used. - * - * Generated from protobuf enum LOCALIZATION_STATE_UNSPECIFIED = 0; - */ - const LOCALIZATION_STATE_UNSPECIFIED = 0; - /** - * Localization is not applicable for requested language. This can happen - * when: - * - The requested language was not supported by Advisory Notifications at the - * time of localization (including notifications created before the - * localization feature was launched). - * - The requested language is English, so only the English text is returned. - * - * Generated from protobuf enum LOCALIZATION_STATE_NOT_APPLICABLE = 1; - */ - const LOCALIZATION_STATE_NOT_APPLICABLE = 1; - /** - * Localization for requested language is in progress, and not ready yet. - * - * Generated from protobuf enum LOCALIZATION_STATE_PENDING = 2; - */ - const LOCALIZATION_STATE_PENDING = 2; - /** - * Localization for requested language is completed. - * - * Generated from protobuf enum LOCALIZATION_STATE_COMPLETED = 3; - */ - const LOCALIZATION_STATE_COMPLETED = 3; - - private static $valueToName = [ - self::LOCALIZATION_STATE_UNSPECIFIED => 'LOCALIZATION_STATE_UNSPECIFIED', - self::LOCALIZATION_STATE_NOT_APPLICABLE => 'LOCALIZATION_STATE_NOT_APPLICABLE', - self::LOCALIZATION_STATE_PENDING => 'LOCALIZATION_STATE_PENDING', - self::LOCALIZATION_STATE_COMPLETED => 'LOCALIZATION_STATE_COMPLETED', - ]; - - 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/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message.php deleted file mode 100644 index f991adccc115..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message.php +++ /dev/null @@ -1,199 +0,0 @@ -google.cloud.advisorynotifications.v1.Message - */ -class Message extends \Google\Protobuf\Internal\Message -{ - /** - * The message content. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Message.Body body = 1; - */ - protected $body = null; - /** - * The attachments to download. - * - * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Attachment attachments = 2; - */ - private $attachments; - /** - * The Message creation timestamp. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; - */ - protected $create_time = null; - /** - * Time when Message was localized - * - * Generated from protobuf field .google.protobuf.Timestamp localization_time = 4; - */ - protected $localization_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\AdvisoryNotifications\V1\Message\Body $body - * The message content. - * @type array<\Google\Cloud\AdvisoryNotifications\V1\Attachment>|\Google\Protobuf\Internal\RepeatedField $attachments - * The attachments to download. - * @type \Google\Protobuf\Timestamp $create_time - * The Message creation timestamp. - * @type \Google\Protobuf\Timestamp $localization_time - * Time when Message was localized - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * The message content. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Message.Body body = 1; - * @return \Google\Cloud\AdvisoryNotifications\V1\Message\Body|null - */ - public function getBody() - { - return $this->body; - } - - public function hasBody() - { - return isset($this->body); - } - - public function clearBody() - { - unset($this->body); - } - - /** - * The message content. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Message.Body body = 1; - * @param \Google\Cloud\AdvisoryNotifications\V1\Message\Body $var - * @return $this - */ - public function setBody($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\AdvisoryNotifications\V1\Message\Body::class); - $this->body = $var; - - return $this; - } - - /** - * The attachments to download. - * - * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Attachment attachments = 2; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getAttachments() - { - return $this->attachments; - } - - /** - * The attachments to download. - * - * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Attachment attachments = 2; - * @param array<\Google\Cloud\AdvisoryNotifications\V1\Attachment>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setAttachments($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AdvisoryNotifications\V1\Attachment::class); - $this->attachments = $arr; - - return $this; - } - - /** - * The Message creation timestamp. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCreateTime() - { - return $this->create_time; - } - - public function hasCreateTime() - { - return isset($this->create_time); - } - - public function clearCreateTime() - { - unset($this->create_time); - } - - /** - * The Message creation timestamp. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * Time when Message was localized - * - * Generated from protobuf field .google.protobuf.Timestamp localization_time = 4; - * @return \Google\Protobuf\Timestamp|null - */ - public function getLocalizationTime() - { - return $this->localization_time; - } - - public function hasLocalizationTime() - { - return isset($this->localization_time); - } - - public function clearLocalizationTime() - { - unset($this->localization_time); - } - - /** - * Time when Message was localized - * - * Generated from protobuf field .google.protobuf.Timestamp localization_time = 4; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setLocalizationTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->localization_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message/Body.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message/Body.php deleted file mode 100644 index 58e44b3f405f..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Message/Body.php +++ /dev/null @@ -1,80 +0,0 @@ -google.cloud.advisorynotifications.v1.Message.Body - */ -class Body extends \Google\Protobuf\Internal\Message -{ - /** - * The text content of the message body. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Text text = 1; - */ - protected $text = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\AdvisoryNotifications\V1\Text $text - * The text content of the message body. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * The text content of the message body. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Text text = 1; - * @return \Google\Cloud\AdvisoryNotifications\V1\Text|null - */ - public function getText() - { - return $this->text; - } - - public function hasText() - { - return isset($this->text); - } - - public function clearText() - { - unset($this->text); - } - - /** - * The text content of the message body. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Text text = 1; - * @param \Google\Cloud\AdvisoryNotifications\V1\Text $var - * @return $this - */ - public function setText($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\AdvisoryNotifications\V1\Text::class); - $this->text = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Body::class, \Google\Cloud\AdvisoryNotifications\V1\Message_Body::class); - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Notification.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Notification.php deleted file mode 100644 index 76a52ae2a43f..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Notification.php +++ /dev/null @@ -1,236 +0,0 @@ -google.cloud.advisorynotifications.v1.Notification - */ -class Notification extends \Google\Protobuf\Internal\Message -{ - /** - * The resource name of the notification. - * Format: - * organizations/{organization}/locations/{location}/notifications/{notification} - * or projects/{project}/locations/{location}/notifications/{notification}. - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * The subject line of the notification. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Subject subject = 2; - */ - protected $subject = null; - /** - * A list of messages in the notification. - * - * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Message messages = 3; - */ - private $messages; - /** - * Output only. Time the notification was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $create_time = null; - /** - * Type of notification - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.NotificationType notification_type = 12; - */ - protected $notification_type = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The resource name of the notification. - * Format: - * organizations/{organization}/locations/{location}/notifications/{notification} - * or projects/{project}/locations/{location}/notifications/{notification}. - * @type \Google\Cloud\AdvisoryNotifications\V1\Subject $subject - * The subject line of the notification. - * @type array<\Google\Cloud\AdvisoryNotifications\V1\Message>|\Google\Protobuf\Internal\RepeatedField $messages - * A list of messages in the notification. - * @type \Google\Protobuf\Timestamp $create_time - * Output only. Time the notification was created. - * @type int $notification_type - * Type of notification - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * The resource name of the notification. - * Format: - * organizations/{organization}/locations/{location}/notifications/{notification} - * or projects/{project}/locations/{location}/notifications/{notification}. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The resource name of the notification. - * Format: - * organizations/{organization}/locations/{location}/notifications/{notification} - * or projects/{project}/locations/{location}/notifications/{notification}. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The subject line of the notification. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Subject subject = 2; - * @return \Google\Cloud\AdvisoryNotifications\V1\Subject|null - */ - public function getSubject() - { - return $this->subject; - } - - public function hasSubject() - { - return isset($this->subject); - } - - public function clearSubject() - { - unset($this->subject); - } - - /** - * The subject line of the notification. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Subject subject = 2; - * @param \Google\Cloud\AdvisoryNotifications\V1\Subject $var - * @return $this - */ - public function setSubject($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\AdvisoryNotifications\V1\Subject::class); - $this->subject = $var; - - return $this; - } - - /** - * A list of messages in the notification. - * - * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Message messages = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getMessages() - { - return $this->messages; - } - - /** - * A list of messages in the notification. - * - * Generated from protobuf field repeated .google.cloud.advisorynotifications.v1.Message messages = 3; - * @param array<\Google\Cloud\AdvisoryNotifications\V1\Message>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setMessages($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AdvisoryNotifications\V1\Message::class); - $this->messages = $arr; - - return $this; - } - - /** - * Output only. Time the notification was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCreateTime() - { - return $this->create_time; - } - - public function hasCreateTime() - { - return isset($this->create_time); - } - - public function clearCreateTime() - { - unset($this->create_time); - } - - /** - * Output only. Time the notification was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * Type of notification - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.NotificationType notification_type = 12; - * @return int - */ - public function getNotificationType() - { - return $this->notification_type; - } - - /** - * Type of notification - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.NotificationType notification_type = 12; - * @param int $var - * @return $this - */ - public function setNotificationType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\AdvisoryNotifications\V1\NotificationType::class); - $this->notification_type = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationSettings.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationSettings.php deleted file mode 100644 index c360141cdf67..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationSettings.php +++ /dev/null @@ -1,67 +0,0 @@ -google.cloud.advisorynotifications.v1.NotificationSettings - */ -class NotificationSettings extends \Google\Protobuf\Internal\Message -{ - /** - * Whether the associated NotificationType is enabled. - * - * Generated from protobuf field bool enabled = 1; - */ - protected $enabled = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type bool $enabled - * Whether the associated NotificationType is enabled. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Whether the associated NotificationType is enabled. - * - * Generated from protobuf field bool enabled = 1; - * @return bool - */ - public function getEnabled() - { - return $this->enabled; - } - - /** - * Whether the associated NotificationType is enabled. - * - * Generated from protobuf field bool enabled = 1; - * @param bool $var - * @return $this - */ - public function setEnabled($var) - { - GPBUtil::checkBool($var); - $this->enabled = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationType.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationType.php deleted file mode 100644 index d0be8c7af583..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationType.php +++ /dev/null @@ -1,75 +0,0 @@ -google.cloud.advisorynotifications.v1.NotificationType - */ -class NotificationType -{ - /** - * Default type - * - * Generated from protobuf enum NOTIFICATION_TYPE_UNSPECIFIED = 0; - */ - const NOTIFICATION_TYPE_UNSPECIFIED = 0; - /** - * Security and privacy advisory notifications - * - * Generated from protobuf enum NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY = 1; - */ - const NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY = 1; - /** - * Sensitive action notifications - * - * Generated from protobuf enum NOTIFICATION_TYPE_SENSITIVE_ACTIONS = 2; - */ - const NOTIFICATION_TYPE_SENSITIVE_ACTIONS = 2; - /** - * General security MSA - * - * Generated from protobuf enum NOTIFICATION_TYPE_SECURITY_MSA = 3; - */ - const NOTIFICATION_TYPE_SECURITY_MSA = 3; - /** - * Threat horizons MSA - * - * Generated from protobuf enum NOTIFICATION_TYPE_THREAT_HORIZONS = 4; - */ - const NOTIFICATION_TYPE_THREAT_HORIZONS = 4; - - private static $valueToName = [ - self::NOTIFICATION_TYPE_UNSPECIFIED => 'NOTIFICATION_TYPE_UNSPECIFIED', - self::NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY => 'NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY', - self::NOTIFICATION_TYPE_SENSITIVE_ACTIONS => 'NOTIFICATION_TYPE_SENSITIVE_ACTIONS', - self::NOTIFICATION_TYPE_SECURITY_MSA => 'NOTIFICATION_TYPE_SECURITY_MSA', - self::NOTIFICATION_TYPE_THREAT_HORIZONS => 'NOTIFICATION_TYPE_THREAT_HORIZONS', - ]; - - 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/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationView.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationView.php deleted file mode 100644 index 32fceaafe375..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/NotificationView.php +++ /dev/null @@ -1,63 +0,0 @@ -google.cloud.advisorynotifications.v1.NotificationView - */ -class NotificationView -{ - /** - * Not specified, equivalent to BASIC. - * - * Generated from protobuf enum NOTIFICATION_VIEW_UNSPECIFIED = 0; - */ - const NOTIFICATION_VIEW_UNSPECIFIED = 0; - /** - * Server responses only include title, creation time and Notification ID. - * Note: for internal use responses also include the last update time, - * the latest message text and whether notification has attachments. - * - * Generated from protobuf enum BASIC = 1; - */ - const BASIC = 1; - /** - * Include everything. - * - * Generated from protobuf enum FULL = 2; - */ - const FULL = 2; - - private static $valueToName = [ - self::NOTIFICATION_VIEW_UNSPECIFIED => 'NOTIFICATION_VIEW_UNSPECIFIED', - self::BASIC => 'BASIC', - self::FULL => 'FULL', - ]; - - 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/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Settings.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Settings.php deleted file mode 100644 index 70baa8b3ef7c..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Settings.php +++ /dev/null @@ -1,163 +0,0 @@ -google.cloud.advisorynotifications.v1.Settings - */ -class Settings extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. The resource name of the settings to retrieve. - * Format: - * organizations/{organization}/locations/{location}/settings. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $name = ''; - /** - * Required. Map of each notification type and its settings to get/set all - * settings at once. The server will validate the value for each notification - * type. - * - * Generated from protobuf field map notification_settings = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - private $notification_settings; - /** - * Required. Fingerprint for optimistic concurrency returned in Get requests. - * Must be provided for Update requests. If the value provided does not match - * the value known to the server, ABORTED will be thrown, and the client - * should retry the read-modify-write cycle. - * - * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $etag = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Output only. The resource name of the settings to retrieve. - * Format: - * organizations/{organization}/locations/{location}/settings. - * @type array|\Google\Protobuf\Internal\MapField $notification_settings - * Required. Map of each notification type and its settings to get/set all - * settings at once. The server will validate the value for each notification - * type. - * @type string $etag - * Required. Fingerprint for optimistic concurrency returned in Get requests. - * Must be provided for Update requests. If the value provided does not match - * the value known to the server, ABORTED will be thrown, and the client - * should retry the read-modify-write cycle. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Output only. The resource name of the settings to retrieve. - * Format: - * organizations/{organization}/locations/{location}/settings. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Output only. The resource name of the settings to retrieve. - * Format: - * organizations/{organization}/locations/{location}/settings. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Required. Map of each notification type and its settings to get/set all - * settings at once. The server will validate the value for each notification - * type. - * - * Generated from protobuf field map notification_settings = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\MapField - */ - public function getNotificationSettings() - { - return $this->notification_settings; - } - - /** - * Required. Map of each notification type and its settings to get/set all - * settings at once. The server will validate the value for each notification - * type. - * - * Generated from protobuf field map notification_settings = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setNotificationSettings($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AdvisoryNotifications\V1\NotificationSettings::class); - $this->notification_settings = $arr; - - return $this; - } - - /** - * Required. Fingerprint for optimistic concurrency returned in Get requests. - * Must be provided for Update requests. If the value provided does not match - * the value known to the server, ABORTED will be thrown, and the client - * should retry the read-modify-write cycle. - * - * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getEtag() - { - return $this->etag; - } - - /** - * Required. Fingerprint for optimistic concurrency returned in Get requests. - * Must be provided for Update requests. If the value provided does not match - * the value known to the server, ABORTED will be thrown, and the client - * should retry the read-modify-write cycle. - * - * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setEtag($var) - { - GPBUtil::checkString($var, True); - $this->etag = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Subject.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Subject.php deleted file mode 100644 index 8bf64ea40244..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Subject.php +++ /dev/null @@ -1,77 +0,0 @@ -google.cloud.advisorynotifications.v1.Subject - */ -class Subject extends \Google\Protobuf\Internal\Message -{ - /** - * The text content. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Text text = 1; - */ - protected $text = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\AdvisoryNotifications\V1\Text $text - * The text content. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * The text content. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Text text = 1; - * @return \Google\Cloud\AdvisoryNotifications\V1\Text|null - */ - public function getText() - { - return $this->text; - } - - public function hasText() - { - return isset($this->text); - } - - public function clearText() - { - unset($this->text); - } - - /** - * The text content. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Text text = 1; - * @param \Google\Cloud\AdvisoryNotifications\V1\Text $var - * @return $this - */ - public function setText($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\AdvisoryNotifications\V1\Text::class); - $this->text = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Text.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Text.php deleted file mode 100644 index 932bb0dd9992..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/Text.php +++ /dev/null @@ -1,135 +0,0 @@ -google.cloud.advisorynotifications.v1.Text - */ -class Text extends \Google\Protobuf\Internal\Message -{ - /** - * The English copy. - * - * Generated from protobuf field string en_text = 1; - */ - protected $en_text = ''; - /** - * The requested localized copy (if applicable). - * - * Generated from protobuf field string localized_text = 2; - */ - protected $localized_text = ''; - /** - * Status of the localization. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.LocalizationState localization_state = 3; - */ - protected $localization_state = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $en_text - * The English copy. - * @type string $localized_text - * The requested localized copy (if applicable). - * @type int $localization_state - * Status of the localization. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * The English copy. - * - * Generated from protobuf field string en_text = 1; - * @return string - */ - public function getEnText() - { - return $this->en_text; - } - - /** - * The English copy. - * - * Generated from protobuf field string en_text = 1; - * @param string $var - * @return $this - */ - public function setEnText($var) - { - GPBUtil::checkString($var, True); - $this->en_text = $var; - - return $this; - } - - /** - * The requested localized copy (if applicable). - * - * Generated from protobuf field string localized_text = 2; - * @return string - */ - public function getLocalizedText() - { - return $this->localized_text; - } - - /** - * The requested localized copy (if applicable). - * - * Generated from protobuf field string localized_text = 2; - * @param string $var - * @return $this - */ - public function setLocalizedText($var) - { - GPBUtil::checkString($var, True); - $this->localized_text = $var; - - return $this; - } - - /** - * Status of the localization. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.LocalizationState localization_state = 3; - * @return int - */ - public function getLocalizationState() - { - return $this->localization_state; - } - - /** - * Status of the localization. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.LocalizationState localization_state = 3; - * @param int $var - * @return $this - */ - public function setLocalizationState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\AdvisoryNotifications\V1\LocalizationState::class); - $this->localization_state = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/UpdateSettingsRequest.php b/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/UpdateSettingsRequest.php deleted file mode 100644 index ac58bb44826a..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/proto/src/Google/Cloud/AdvisoryNotifications/V1/UpdateSettingsRequest.php +++ /dev/null @@ -1,90 +0,0 @@ -google.cloud.advisorynotifications.v1.UpdateSettingsRequest - */ -class UpdateSettingsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. New settings. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Settings settings = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $settings = null; - - /** - * @param \Google\Cloud\AdvisoryNotifications\V1\Settings $settings Required. New settings. - * - * @return \Google\Cloud\AdvisoryNotifications\V1\UpdateSettingsRequest - * - * @experimental - */ - public static function build(\Google\Cloud\AdvisoryNotifications\V1\Settings $settings): self - { - return (new self()) - ->setSettings($settings); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\AdvisoryNotifications\V1\Settings $settings - * Required. New settings. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Advisorynotifications\V1\Service::initOnce(); - parent::__construct($data); - } - - /** - * Required. New settings. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Settings settings = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\AdvisoryNotifications\V1\Settings|null - */ - public function getSettings() - { - return $this->settings; - } - - public function hasSettings() - { - return isset($this->settings); - } - - public function clearSettings() - { - unset($this->settings); - } - - /** - * Required. New settings. - * - * Generated from protobuf field .google.cloud.advisorynotifications.v1.Settings settings = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\AdvisoryNotifications\V1\Settings $var - * @return $this - */ - public function setSettings($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\AdvisoryNotifications\V1\Settings::class); - $this->settings = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_notification.php b/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_notification.php deleted file mode 100644 index fcd899daed22..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_notification.php +++ /dev/null @@ -1,78 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var Notification $response */ - $response = $advisoryNotificationsServiceClient->getNotification($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = AdvisoryNotificationsServiceClient::notificationName( - '[ORGANIZATION]', - '[LOCATION]', - '[NOTIFICATION]' - ); - - get_notification_sample($formattedName); -} -// [END advisorynotifications_v1_generated_AdvisoryNotificationsService_GetNotification_sync] diff --git a/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_settings.php b/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_settings.php deleted file mode 100644 index a73cd9812f06..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/get_settings.php +++ /dev/null @@ -1,73 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var Settings $response */ - $response = $advisoryNotificationsServiceClient->getSettings($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = AdvisoryNotificationsServiceClient::settingsName('[ORGANIZATION]', '[LOCATION]'); - - get_settings_sample($formattedName); -} -// [END advisorynotifications_v1_generated_AdvisoryNotificationsService_GetSettings_sync] diff --git a/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/list_notifications.php b/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/list_notifications.php deleted file mode 100644 index 15ef2e226114..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/list_notifications.php +++ /dev/null @@ -1,78 +0,0 @@ -setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $advisoryNotificationsServiceClient->listNotifications($request); - - /** @var Notification $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = AdvisoryNotificationsServiceClient::locationName('[ORGANIZATION]', '[LOCATION]'); - - list_notifications_sample($formattedParent); -} -// [END advisorynotifications_v1_generated_AdvisoryNotificationsService_ListNotifications_sync] diff --git a/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/update_settings.php b/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/update_settings.php deleted file mode 100644 index 0367ac99f11f..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/samples/V1/AdvisoryNotificationsServiceClient/update_settings.php +++ /dev/null @@ -1,77 +0,0 @@ -setNotificationSettings($settingsNotificationSettings) - ->setEtag($settingsEtag); - $request = (new UpdateSettingsRequest()) - ->setSettings($settings); - - // Call the API and handle any network failures. - try { - /** @var Settings $response */ - $response = $advisoryNotificationsServiceClient->updateSettings($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $settingsEtag = '[ETAG]'; - - update_settings_sample($settingsEtag); -} -// [END advisorynotifications_v1_generated_AdvisoryNotificationsService_UpdateSettings_sync] diff --git a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/AdvisoryNotificationsServiceClient.php b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/AdvisoryNotificationsServiceClient.php deleted file mode 100644 index 8fee207f5688..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/AdvisoryNotificationsServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/advisory_notifications_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/advisory_notifications_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/advisory_notifications_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/advisory_notifications_service_rest_client_config.php', - ], - ], - ]; - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $organization - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName(string $organization, string $location): string - { - return self::getPathTemplate('location')->render([ - 'organization' => $organization, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a notification - * resource. - * - * @param string $organization - * @param string $location - * @param string $notification - * - * @return string The formatted notification resource. - */ - public static function notificationName(string $organization, string $location, string $notification): string - { - return self::getPathTemplate('notification')->render([ - 'organization' => $organization, - 'location' => $location, - 'notification' => $notification, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * organization_location resource. - * - * @param string $organization - * @param string $location - * - * @return string The formatted organization_location resource. - */ - public static function organizationLocationName(string $organization, string $location): string - { - return self::getPathTemplate('organizationLocation')->render([ - 'organization' => $organization, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * organization_location_notification resource. - * - * @param string $organization - * @param string $location - * @param string $notification - * - * @return string The formatted organization_location_notification resource. - */ - public static function organizationLocationNotificationName(string $organization, string $location, string $notification): string - { - return self::getPathTemplate('organizationLocationNotification')->render([ - 'organization' => $organization, - 'location' => $location, - 'notification' => $notification, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted project_location resource. - */ - public static function projectLocationName(string $project, string $location): string - { - return self::getPathTemplate('projectLocation')->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_notification resource. - * - * @param string $project - * @param string $location - * @param string $notification - * - * @return string The formatted project_location_notification resource. - */ - public static function projectLocationNotificationName(string $project, string $location, string $notification): string - { - return self::getPathTemplate('projectLocationNotification')->render([ - 'project' => $project, - 'location' => $location, - 'notification' => $notification, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a settings - * resource. - * - * @param string $organization - * @param string $location - * - * @return string The formatted settings resource. - */ - public static function settingsName(string $organization, string $location): string - { - return self::getPathTemplate('settings')->render([ - 'organization' => $organization, - 'location' => $location, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - location: organizations/{organization}/locations/{location} - * - notification: organizations/{organization}/locations/{location}/notifications/{notification} - * - organizationLocation: organizations/{organization}/locations/{location} - * - organizationLocationNotification: organizations/{organization}/locations/{location}/notifications/{notification} - * - projectLocation: projects/{project}/locations/{location} - * - projectLocationNotification: projects/{project}/locations/{location}/notifications/{notification} - * - settings: organizations/{organization}/locations/{location}/settings - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'advisorynotifications.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Gets a notification. - * - * The async variant is - * {@see AdvisoryNotificationsServiceClient::getNotificationAsync()} . - * - * @example samples/V1/AdvisoryNotificationsServiceClient/get_notification.php - * - * @param GetNotificationRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Notification - * - * @throws ApiException Thrown if the API call fails. - */ - public function getNotification(GetNotificationRequest $request, array $callOptions = []): Notification - { - return $this->startApiCall('GetNotification', $request, $callOptions)->wait(); - } - - /** - * Get notification settings. - * - * The async variant is - * {@see AdvisoryNotificationsServiceClient::getSettingsAsync()} . - * - * @example samples/V1/AdvisoryNotificationsServiceClient/get_settings.php - * - * @param GetSettingsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Settings - * - * @throws ApiException Thrown if the API call fails. - */ - public function getSettings(GetSettingsRequest $request, array $callOptions = []): Settings - { - return $this->startApiCall('GetSettings', $request, $callOptions)->wait(); - } - - /** - * Lists notifications under a given parent. - * - * The async variant is - * {@see AdvisoryNotificationsServiceClient::listNotificationsAsync()} . - * - * @example samples/V1/AdvisoryNotificationsServiceClient/list_notifications.php - * - * @param ListNotificationsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listNotifications(ListNotificationsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListNotifications', $request, $callOptions); - } - - /** - * Update notification settings. - * - * The async variant is - * {@see AdvisoryNotificationsServiceClient::updateSettingsAsync()} . - * - * @example samples/V1/AdvisoryNotificationsServiceClient/update_settings.php - * - * @param UpdateSettingsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Settings - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateSettings(UpdateSettingsRequest $request, array $callOptions = []): Settings - { - return $this->startApiCall('UpdateSettings', $request, $callOptions)->wait(); - } -} diff --git a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/Gapic/AdvisoryNotificationsServiceGapicClient.php b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/Gapic/AdvisoryNotificationsServiceGapicClient.php deleted file mode 100644 index 32b54e7941dc..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/Gapic/AdvisoryNotificationsServiceGapicClient.php +++ /dev/null @@ -1,656 +0,0 @@ -notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); - * $response = $advisoryNotificationsServiceClient->getNotification($formattedName); - * } finally { - * $advisoryNotificationsServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * This service has a new (beta) implementation. See {@see - * \Google\Cloud\AdvisoryNotifications\V1\Client\AdvisoryNotificationsServiceClient} - * to use the new surface. - */ -class AdvisoryNotificationsServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.advisorynotifications.v1.AdvisoryNotificationsService'; - - /** The default address of the service. */ - const SERVICE_ADDRESS = 'advisorynotifications.googleapis.com'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $locationNameTemplate; - - private static $notificationNameTemplate; - - private static $organizationLocationNameTemplate; - - private static $organizationLocationNotificationNameTemplate; - - private static $projectLocationNameTemplate; - - private static $projectLocationNotificationNameTemplate; - - private static $settingsNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/advisory_notifications_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/advisory_notifications_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/advisory_notifications_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/advisory_notifications_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}'); - } - - return self::$locationNameTemplate; - } - - private static function getNotificationNameTemplate() - { - if (self::$notificationNameTemplate == null) { - self::$notificationNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/notifications/{notification}'); - } - - return self::$notificationNameTemplate; - } - - private static function getOrganizationLocationNameTemplate() - { - if (self::$organizationLocationNameTemplate == null) { - self::$organizationLocationNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}'); - } - - return self::$organizationLocationNameTemplate; - } - - private static function getOrganizationLocationNotificationNameTemplate() - { - if (self::$organizationLocationNotificationNameTemplate == null) { - self::$organizationLocationNotificationNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/notifications/{notification}'); - } - - return self::$organizationLocationNotificationNameTemplate; - } - - private static function getProjectLocationNameTemplate() - { - if (self::$projectLocationNameTemplate == null) { - self::$projectLocationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); - } - - return self::$projectLocationNameTemplate; - } - - private static function getProjectLocationNotificationNameTemplate() - { - if (self::$projectLocationNotificationNameTemplate == null) { - self::$projectLocationNotificationNameTemplate = new PathTemplate('projects/{project}/locations/{location}/notifications/{notification}'); - } - - return self::$projectLocationNotificationNameTemplate; - } - - private static function getSettingsNameTemplate() - { - if (self::$settingsNameTemplate == null) { - self::$settingsNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/settings'); - } - - return self::$settingsNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'location' => self::getLocationNameTemplate(), - 'notification' => self::getNotificationNameTemplate(), - 'organizationLocation' => self::getOrganizationLocationNameTemplate(), - 'organizationLocationNotification' => self::getOrganizationLocationNotificationNameTemplate(), - 'projectLocation' => self::getProjectLocationNameTemplate(), - 'projectLocationNotification' => self::getProjectLocationNotificationNameTemplate(), - 'settings' => self::getSettingsNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $organization - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($organization, $location) - { - return self::getLocationNameTemplate()->render([ - 'organization' => $organization, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a notification - * resource. - * - * @param string $organization - * @param string $location - * @param string $notification - * - * @return string The formatted notification resource. - */ - public static function notificationName($organization, $location, $notification) - { - return self::getNotificationNameTemplate()->render([ - 'organization' => $organization, - 'location' => $location, - 'notification' => $notification, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * organization_location resource. - * - * @param string $organization - * @param string $location - * - * @return string The formatted organization_location resource. - */ - public static function organizationLocationName($organization, $location) - { - return self::getOrganizationLocationNameTemplate()->render([ - 'organization' => $organization, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * organization_location_notification resource. - * - * @param string $organization - * @param string $location - * @param string $notification - * - * @return string The formatted organization_location_notification resource. - */ - public static function organizationLocationNotificationName($organization, $location, $notification) - { - return self::getOrganizationLocationNotificationNameTemplate()->render([ - 'organization' => $organization, - 'location' => $location, - 'notification' => $notification, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted project_location resource. - */ - public static function projectLocationName($project, $location) - { - return self::getProjectLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_location_notification resource. - * - * @param string $project - * @param string $location - * @param string $notification - * - * @return string The formatted project_location_notification resource. - */ - public static function projectLocationNotificationName($project, $location, $notification) - { - return self::getProjectLocationNotificationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'notification' => $notification, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a settings - * resource. - * - * @param string $organization - * @param string $location - * - * @return string The formatted settings resource. - */ - public static function settingsName($organization, $location) - { - return self::getSettingsNameTemplate()->render([ - 'organization' => $organization, - 'location' => $location, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - location: organizations/{organization}/locations/{location} - * - notification: organizations/{organization}/locations/{location}/notifications/{notification} - * - organizationLocation: organizations/{organization}/locations/{location} - * - organizationLocationNotification: organizations/{organization}/locations/{location}/notifications/{notification} - * - projectLocation: projects/{project}/locations/{location} - * - projectLocationNotification: projects/{project}/locations/{location}/notifications/{notification} - * - settings: organizations/{organization}/locations/{location}/settings - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'advisorynotifications.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Gets a notification. - * - * Sample code: - * ``` - * $advisoryNotificationsServiceClient = new AdvisoryNotificationsServiceClient(); - * try { - * $formattedName = $advisoryNotificationsServiceClient->notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); - * $response = $advisoryNotificationsServiceClient->getNotification($formattedName); - * } finally { - * $advisoryNotificationsServiceClient->close(); - * } - * ``` - * - * @param string $name Required. A name of the notification to retrieve. - * Format: - * organizations/{organization}/locations/{location}/notifications/{notification} - * or projects/{projects}/locations/{location}/notifications/{notification}. - * @param array $optionalArgs { - * Optional. - * - * @type string $languageCode - * ISO code for requested localization language. If unset, will be - * interpereted as "en". If the requested language is valid, but not supported - * for this notification, English will be returned with an "Not applicable" - * LocalizationState. If the ISO code is invalid (i.e. not a real language), - * this RPC will throw an error. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AdvisoryNotifications\V1\Notification - * - * @throws ApiException if the remote call fails - */ - public function getNotification($name, array $optionalArgs = []) - { - $request = new GetNotificationRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['languageCode'])) { - $request->setLanguageCode($optionalArgs['languageCode']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetNotification', Notification::class, $optionalArgs, $request)->wait(); - } - - /** - * Get notification settings. - * - * Sample code: - * ``` - * $advisoryNotificationsServiceClient = new AdvisoryNotificationsServiceClient(); - * try { - * $formattedName = $advisoryNotificationsServiceClient->settingsName('[ORGANIZATION]', '[LOCATION]'); - * $response = $advisoryNotificationsServiceClient->getSettings($formattedName); - * } finally { - * $advisoryNotificationsServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the settings to retrieve. - * Format: - * organizations/{organization}/locations/{location}/settings. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AdvisoryNotifications\V1\Settings - * - * @throws ApiException if the remote call fails - */ - public function getSettings($name, array $optionalArgs = []) - { - $request = new GetSettingsRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetSettings', Settings::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists notifications under a given parent. - * - * Sample code: - * ``` - * $advisoryNotificationsServiceClient = new AdvisoryNotificationsServiceClient(); - * try { - * $formattedParent = $advisoryNotificationsServiceClient->locationName('[ORGANIZATION]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $advisoryNotificationsServiceClient->listNotifications($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $advisoryNotificationsServiceClient->listNotifications($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $advisoryNotificationsServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent, which owns this collection of notifications. - * Must be of the form "organizations/{organization}/locations/{location}" - * or "projects/{project}/locations/{location}" - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type int $view - * Specifies which parts of the notification resource should be returned - * in the response. - * For allowed values, use constants defined on {@see \Google\Cloud\AdvisoryNotifications\V1\NotificationView} - * @type string $languageCode - * ISO code for requested localization language. If unset, will be - * interpereted as "en". If the requested language is valid, but not supported - * for this notification, English will be returned with an "Not applicable" - * LocalizationState. If the ISO code is invalid (i.e. not a real language), - * this RPC will throw an error. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listNotifications($parent, array $optionalArgs = []) - { - $request = new ListNotificationsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['view'])) { - $request->setView($optionalArgs['view']); - } - - if (isset($optionalArgs['languageCode'])) { - $request->setLanguageCode($optionalArgs['languageCode']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListNotifications', $optionalArgs, ListNotificationsResponse::class, $request); - } - - /** - * Update notification settings. - * - * Sample code: - * ``` - * $advisoryNotificationsServiceClient = new AdvisoryNotificationsServiceClient(); - * try { - * $settings = new Settings(); - * $response = $advisoryNotificationsServiceClient->updateSettings($settings); - * } finally { - * $advisoryNotificationsServiceClient->close(); - * } - * ``` - * - * @param Settings $settings Required. New settings. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\AdvisoryNotifications\V1\Settings - * - * @throws ApiException if the remote call fails - */ - public function updateSettings($settings, array $optionalArgs = []) - { - $request = new UpdateSettingsRequest(); - $requestParamHeaders = []; - $request->setSettings($settings); - $requestParamHeaders['settings.name'] = $settings->getName(); - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('UpdateSettings', Settings::class, $optionalArgs, $request)->wait(); - } -} diff --git a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/gapic_metadata.json b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/gapic_metadata.json deleted file mode 100644 index ff46c6a425f8..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/gapic_metadata.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", - "language": "php", - "protoPackage": "google.cloud.advisorynotifications.v1", - "libraryPackage": "Google\\Cloud\\AdvisoryNotifications\\V1", - "services": { - "AdvisoryNotificationsService": { - "clients": { - "grpc": { - "libraryClient": "AdvisoryNotificationsServiceGapicClient", - "rpcs": { - "GetNotification": { - "methods": [ - "getNotification" - ] - }, - "GetSettings": { - "methods": [ - "getSettings" - ] - }, - "ListNotifications": { - "methods": [ - "listNotifications" - ] - }, - "UpdateSettings": { - "methods": [ - "updateSettings" - ] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_client_config.json b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_client_config.json deleted file mode 100644 index 73a44f467731..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_client_config.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.advisorynotifications.v1.AdvisoryNotificationsService": { - "retry_codes": { - "no_retry_codes": [], - "retry_policy_1_codes": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0 - }, - "retry_policy_1_params": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000 - } - }, - "methods": { - "GetNotification": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "GetSettings": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - }, - "ListNotifications": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "UpdateSettings": { - "timeout_millis": 60000, - "retry_codes_name": "no_retry_codes", - "retry_params_name": "no_retry_params" - } - } - } - } -} diff --git a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_descriptor_config.php b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_descriptor_config.php deleted file mode 100644 index ebb3a6ad425e..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_descriptor_config.php +++ /dev/null @@ -1,74 +0,0 @@ - [ - 'google.cloud.advisorynotifications.v1.AdvisoryNotificationsService' => [ - 'GetNotification' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\AdvisoryNotifications\V1\Notification', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'GetSettings' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\AdvisoryNotifications\V1\Settings', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'ListNotifications' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getNotifications', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\AdvisoryNotifications\V1\ListNotificationsResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'UpdateSettings' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\AdvisoryNotifications\V1\Settings', - 'headerParams' => [ - [ - 'keyName' => 'settings.name', - 'fieldAccessors' => [ - 'getSettings', - 'getName', - ], - ], - ], - ], - 'templateMap' => [ - 'location' => 'organizations/{organization}/locations/{location}', - 'notification' => 'organizations/{organization}/locations/{location}/notifications/{notification}', - 'organizationLocation' => 'organizations/{organization}/locations/{location}', - 'organizationLocationNotification' => 'organizations/{organization}/locations/{location}/notifications/{notification}', - 'projectLocation' => 'projects/{project}/locations/{location}', - 'projectLocationNotification' => 'projects/{project}/locations/{location}/notifications/{notification}', - 'settings' => 'organizations/{organization}/locations/{location}/settings', - ], - ], - ], -]; diff --git a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_rest_client_config.php b/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_rest_client_config.php deleted file mode 100644 index 5dfef8bb6492..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/src/V1/resources/advisory_notifications_service_rest_client_config.php +++ /dev/null @@ -1,67 +0,0 @@ - [ - 'google.cloud.advisorynotifications.v1.AdvisoryNotificationsService' => [ - 'GetNotification' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=organizations/*/locations/*/notifications/*}', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/locations/*/notifications/*}', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetSettings' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=organizations/*/locations/*/settings}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListNotifications' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=organizations/*/locations/*}/notifications', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/notifications', - ], - ], - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'UpdateSettings' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{settings.name=organizations/*/locations/*/settings}', - 'body' => 'settings', - 'placeholders' => [ - 'settings.name' => [ - 'getters' => [ - 'getSettings', - 'getName', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/AdvisoryNotificationsServiceClientTest.php b/owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/AdvisoryNotificationsServiceClientTest.php deleted file mode 100644 index 6989a92dbcb7..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/AdvisoryNotificationsServiceClientTest.php +++ /dev/null @@ -1,332 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return AdvisoryNotificationsServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new AdvisoryNotificationsServiceClient($options); - } - - /** @test */ - public function getNotificationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new Notification(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); - $response = $gapicClient->getNotification($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/GetNotification', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNotificationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); - try { - $gapicClient->getNotification($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSettingsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $etag = 'etag3123477'; - $expectedResponse = new Settings(); - $expectedResponse->setName($name2); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->settingsName('[ORGANIZATION]', '[LOCATION]'); - $response = $gapicClient->getSettings($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/GetSettings', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSettingsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->settingsName('[ORGANIZATION]', '[LOCATION]'); - try { - $gapicClient->getSettings($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNotificationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $totalSize = 705419236; - $notificationsElement = new Notification(); - $notifications = [ - $notificationsElement, - ]; - $expectedResponse = new ListNotificationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTotalSize($totalSize); - $expectedResponse->setNotifications($notifications); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[ORGANIZATION]', '[LOCATION]'); - $response = $gapicClient->listNotifications($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getNotifications()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/ListNotifications', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNotificationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[ORGANIZATION]', '[LOCATION]'); - try { - $gapicClient->listNotifications($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSettingsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $etag = 'etag3123477'; - $expectedResponse = new Settings(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $settings = new Settings(); - $notificationSettingsValue = new NotificationSettings(); - $settingsNotificationSettings = [ - 'notificationSettingsKey' => $notificationSettingsValue, - ]; - $settings->setNotificationSettings($settingsNotificationSettings); - $settingsEtag = 'settingsEtag533925848'; - $settings->setEtag($settingsEtag); - $response = $gapicClient->updateSettings($settings); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/UpdateSettings', $actualFuncCall); - $actualValue = $actualRequestObject->getSettings(); - $this->assertProtobufEquals($settings, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSettingsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $settings = new Settings(); - $notificationSettingsValue = new NotificationSettings(); - $settingsNotificationSettings = [ - 'notificationSettingsKey' => $notificationSettingsValue, - ]; - $settings->setNotificationSettings($settingsNotificationSettings); - $settingsEtag = 'settingsEtag533925848'; - $settings->setEtag($settingsEtag); - try { - $gapicClient->updateSettings($settings); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/Client/AdvisoryNotificationsServiceClientTest.php b/owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/Client/AdvisoryNotificationsServiceClientTest.php deleted file mode 100644 index c2174baa744f..000000000000 --- a/owl-bot-staging/AdvisoryNotifications/v1/tests/Unit/V1/Client/AdvisoryNotificationsServiceClientTest.php +++ /dev/null @@ -1,381 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return AdvisoryNotificationsServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new AdvisoryNotificationsServiceClient($options); - } - - /** @test */ - public function getNotificationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new Notification(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); - $request = (new GetNotificationRequest()) - ->setName($formattedName); - $response = $gapicClient->getNotification($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/GetNotification', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNotificationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); - $request = (new GetNotificationRequest()) - ->setName($formattedName); - try { - $gapicClient->getNotification($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSettingsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $etag = 'etag3123477'; - $expectedResponse = new Settings(); - $expectedResponse->setName($name2); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->settingsName('[ORGANIZATION]', '[LOCATION]'); - $request = (new GetSettingsRequest()) - ->setName($formattedName); - $response = $gapicClient->getSettings($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/GetSettings', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSettingsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->settingsName('[ORGANIZATION]', '[LOCATION]'); - $request = (new GetSettingsRequest()) - ->setName($formattedName); - try { - $gapicClient->getSettings($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNotificationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $totalSize = 705419236; - $notificationsElement = new Notification(); - $notifications = [ - $notificationsElement, - ]; - $expectedResponse = new ListNotificationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTotalSize($totalSize); - $expectedResponse->setNotifications($notifications); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[ORGANIZATION]', '[LOCATION]'); - $request = (new ListNotificationsRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listNotifications($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getNotifications()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/ListNotifications', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNotificationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[ORGANIZATION]', '[LOCATION]'); - $request = (new ListNotificationsRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listNotifications($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSettingsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $etag = 'etag3123477'; - $expectedResponse = new Settings(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $settings = new Settings(); - $notificationSettingsValue = new NotificationSettings(); - $settingsNotificationSettings = [ - 'notificationSettingsKey' => $notificationSettingsValue, - ]; - $settings->setNotificationSettings($settingsNotificationSettings); - $settingsEtag = 'settingsEtag533925848'; - $settings->setEtag($settingsEtag); - $request = (new UpdateSettingsRequest()) - ->setSettings($settings); - $response = $gapicClient->updateSettings($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/UpdateSettings', $actualFuncCall); - $actualValue = $actualRequestObject->getSettings(); - $this->assertProtobufEquals($settings, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSettingsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $settings = new Settings(); - $notificationSettingsValue = new NotificationSettings(); - $settingsNotificationSettings = [ - 'notificationSettingsKey' => $notificationSettingsValue, - ]; - $settings->setNotificationSettings($settingsNotificationSettings); - $settingsEtag = 'settingsEtag533925848'; - $settings->setEtag($settingsEtag); - $request = (new UpdateSettingsRequest()) - ->setSettings($settings); - try { - $gapicClient->updateSettings($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNotificationAsyncTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new Notification(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->notificationName('[ORGANIZATION]', '[LOCATION]', '[NOTIFICATION]'); - $request = (new GetNotificationRequest()) - ->setName($formattedName); - $response = $gapicClient->getNotificationAsync($request)->wait(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.advisorynotifications.v1.AdvisoryNotificationsService/GetNotification', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } -}