From 80294fb1fafa481f798ec09ba0602ac96172ef73 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 31 May 2024 19:02:31 +0000 Subject: [PATCH 1/2] docs: Resource Settings is deprecated. As of November 7, 2023, no organizations will be onboarded for any of the enabled settings, and the service will be shut down on October 1, 2024 PiperOrigin-RevId: 639070750 Source-Link: https://github.com/googleapis/googleapis/commit/7f62415454d05722b611faf0371242e287512710 Source-Link: https://github.com/googleapis/googleapis-gen/commit/9fd8f8e913697db4245bf991fcfe93bbac4ef185 Copy-Tag: eyJwIjoiUmVzb3VyY2VTZXR0aW5ncy8uT3dsQm90LnlhbWwiLCJoIjoiOWZkOGY4ZTkxMzY5N2RiNDI0NWJmOTkxZmNmZTkzYmJhYzRlZjE4NSJ9 --- .../Resourcesettings/V1/ResourceSettings.php | Bin 0 -> 3819 bytes .../ResourceSettings/V1/GetSettingRequest.php | 125 ++++ .../V1/ListSettingsRequest.php | 208 +++++++ .../V1/ListSettingsResponse.php | 101 ++++ .../Cloud/ResourceSettings/V1/Setting.php | 329 +++++++++++ .../ResourceSettings/V1/SettingMetadata.php | 229 ++++++++ .../V1/SettingMetadata/DataType.php | 80 +++ .../Cloud/ResourceSettings/V1/SettingView.php | 76 +++ .../V1/UpdateSettingRequest.php | 81 +++ .../Cloud/ResourceSettings/V1/Value.php | 174 ++++++ .../ResourceSettings/V1/Value/EnumValue.php | 72 +++ .../ResourceSettings/V1/Value/StringSet.php | 72 +++ .../get_setting.php | 76 +++ .../list_settings.php | 81 +++ .../update_setting.php | 74 +++ .../Client/ResourceSettingsServiceClient.php | 383 ++++++++++++ .../ResourceSettingsServiceGapicClient.php | 545 ++++++++++++++++++ .../src/V1/ResourceSettingsServiceClient.php | 34 ++ .../v1/src/V1/gapic_metadata.json | 33 ++ ...source_settings_service_client_config.json | 50 ++ ...rce_settings_service_descriptor_config.php | 79 +++ ...ce_settings_service_rest_client_config.php | 96 +++ .../ResourceSettingsServiceClientTest.php | 300 ++++++++++ .../V1/ResourceSettingsServiceClientTest.php | 254 ++++++++ 24 files changed, 3552 insertions(+) create mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/GPBMetadata/Google/Cloud/Resourcesettings/V1/ResourceSettings.php create mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/GetSettingRequest.php create mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsRequest.php create mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsResponse.php create mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Setting.php create mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata.php create mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata/DataType.php create mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingView.php create mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/UpdateSettingRequest.php create mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value.php create mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/EnumValue.php create mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/StringSet.php create mode 100644 owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/get_setting.php create mode 100644 owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/list_settings.php create mode 100644 owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/update_setting.php create mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/Client/ResourceSettingsServiceClient.php create mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/Gapic/ResourceSettingsServiceGapicClient.php create mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/ResourceSettingsServiceClient.php create mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/gapic_metadata.json create mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/resources/resource_settings_service_client_config.json create mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/resources/resource_settings_service_descriptor_config.php create mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/resources/resource_settings_service_rest_client_config.php create mode 100644 owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/Client/ResourceSettingsServiceClientTest.php create mode 100644 owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/ResourceSettingsServiceClientTest.php diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/GPBMetadata/Google/Cloud/Resourcesettings/V1/ResourceSettings.php b/owl-bot-staging/ResourceSettings/v1/proto/src/GPBMetadata/Google/Cloud/Resourcesettings/V1/ResourceSettings.php new file mode 100644 index 0000000000000000000000000000000000000000..0ddd1d8f7c88c52b096800ab85dfa2b2b8b3fc65 GIT binary patch literal 3819 zcmbVP&2Jk;6z|&k@=MaD(~r2JQnzkVoQSLy7ZBPst=5T?TFQsjIIgHHR%?6gENpg{ z-LXR&Swe8(h6G$Wa6|k9To8h5kLA`=4_xS9fKU(2&d#paPNKxkCF?iu{pP*j`&4tACR$x1 zT4kN#RaQK_%Huw~N_lY!pk`>UD+X&jd@ncxk^b4Os-f3JmuQ6kyQ{mZZt6tW4E-4m zb6IR?hKni4aotACtP$NZMbBW{tl{*W=wo`icWsN(vMdG;7CojYOO=92uw!aQWfi+M zN4JUP6sf8#H!%tM^(5&zzO4tRH^j8>qbwhDa#NJcX@)C?j!iO{&65vAGlv((58a{g4l0>|iC05K*e=$q##hGc2t=T#)d5dZn0%U(F^=lkPc@?7x81nieDTqQkfgZuwK5vZVD3y$77bPF(bRQ)S6?9ZC{z{3X z`!H@;HO)}ln$g0^F$PwdJsYj;>7zVc!gL_e{%B(kkr)iZcY}sU<7p< zKxH-{BpeZbkd$Rtq9Z61u(L=<$EVZ_H*>_lRI{~T#ZD&^m}ZXnm+JA@LFtBN)UiV? z{EyQ$-?yBmX6n!UmdPANf1YZU`aK4hxO)NP=qgOqb=NkuL*@ie<`o#P^ASONG8ywI zK$jumV6CoNrg4~zQ_&dOgoHNs~-BioU#%_LUDD_)cckq#kxT0!o=(inKqAydlQ7H{{Tj)Q@}H?61h}%HyM(9JeT+Y+2n5}L5nFTU z+~Ed^S4!+ZB@V*8S4y_l#HveAI#yl7h~|Nbi1isZS$QSU5)8F=YXQbNrpGk82}#;6CE7x2 zxsZR-*KF4T^{nQUox%$3I}vX7$n$G!`ISfC2WO`^s?VvK`EXD(zs6FXmkO`_um1Y``Wds)VOZL}tXFvC44DQkk&zZHAyVl>OMejXQ6rL9S%WH5;q?f0r6~4hZrEZ2g5qX*g zV!OK3ACX=CR}g-QiRUVI*?RQS^^e7gl>q(UEWuVZ(7AX#QevfK|P j%jL!D2&JD`_h!Sp{d@j{DDr+f_3gwo{WnerIspFz4MzrJ literal 0 HcmV?d00001 diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/GetSettingRequest.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/GetSettingRequest.php new file mode 100644 index 000000000000..c6eee9fa8d14 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/GetSettingRequest.php @@ -0,0 +1,125 @@ +google.cloud.resourcesettings.v1.GetSettingRequest + */ +class GetSettingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * requirements. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The SettingView for this request. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingView view = 2; + */ + protected $view = 0; + + /** + * @param string $name Required. The name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * requirements. Please see + * {@see ResourceSettingsServiceClient::settingName()} for help formatting this field. + * + * @return \Google\Cloud\ResourceSettings\V1\GetSettingRequest + * + * @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 name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * requirements. + * @type int $view + * The SettingView for this request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * requirements. + * + * 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 name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * requirements. + * + * 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; + } + + /** + * The SettingView for this request. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingView view = 2; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * The SettingView for this request. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingView view = 2; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\ResourceSettings\V1\SettingView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsRequest.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsRequest.php new file mode 100644 index 000000000000..55dbf4f3fa79 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsRequest.php @@ -0,0 +1,208 @@ +google.cloud.resourcesettings.v1.ListSettingsRequest + */ +class ListSettingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Cloud resource that parents the setting. Must be in one of + * the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Unused. The size of the page to be returned. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * Unused. A page token used to retrieve the next page. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The SettingView for this request. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingView view = 4; + */ + protected $view = 0; + + /** + * @param string $parent Required. The Cloud resource that parents the setting. Must be in one of + * the following forms: + * + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * @return \Google\Cloud\ResourceSettings\V1\ListSettingsRequest + * + * @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 Cloud resource that parents the setting. Must be in one of + * the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * @type int $page_size + * Unused. The size of the page to be returned. + * @type string $page_token + * Unused. A page token used to retrieve the next page. + * @type int $view + * The SettingView for this request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Cloud resource that parents the setting. Must be in one of + * the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * 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 Cloud resource that parents the setting. Must be in one of + * the following forms: + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * + * 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; + } + + /** + * Unused. The size of the page to be returned. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Unused. The size of the page to be returned. + * + * 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; + } + + /** + * Unused. A page token used to retrieve the next page. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Unused. A page token used to retrieve the next page. + * + * 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; + } + + /** + * The SettingView for this request. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingView view = 4; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * The SettingView for this request. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingView view = 4; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\ResourceSettings\V1\SettingView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsResponse.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsResponse.php new file mode 100644 index 000000000000..7b1ed2d089dc --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsResponse.php @@ -0,0 +1,101 @@ +google.cloud.resourcesettings.v1.ListSettingsResponse + */ +class ListSettingsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of settings that are available at the specified Cloud resource. + * + * Generated from protobuf field repeated .google.cloud.resourcesettings.v1.Setting settings = 1; + */ + private $settings; + /** + * Unused. A page token used to retrieve the next page. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\ResourceSettings\V1\Setting>|\Google\Protobuf\Internal\RepeatedField $settings + * A list of settings that are available at the specified Cloud resource. + * @type string $next_page_token + * Unused. A page token used to retrieve the next page. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); + parent::__construct($data); + } + + /** + * A list of settings that are available at the specified Cloud resource. + * + * Generated from protobuf field repeated .google.cloud.resourcesettings.v1.Setting settings = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSettings() + { + return $this->settings; + } + + /** + * A list of settings that are available at the specified Cloud resource. + * + * Generated from protobuf field repeated .google.cloud.resourcesettings.v1.Setting settings = 1; + * @param array<\Google\Cloud\ResourceSettings\V1\Setting>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSettings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ResourceSettings\V1\Setting::class); + $this->settings = $arr; + + return $this; + } + + /** + * Unused. A page token used to retrieve the next page. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Unused. A page token used to retrieve the next page. + * + * 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; + } + +} + diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Setting.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Setting.php new file mode 100644 index 000000000000..5f66a0f43113 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Setting.php @@ -0,0 +1,329 @@ +google.cloud.resourcesettings.v1.Setting + */ +class Setting extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the setting. Must be in one of the following forms: + * * `projects/{project_number}/settings/{setting_name}` + * * `folders/{folder_id}/settings/{setting_name}` + * * `organizations/{organization_id}/settings/{setting_name}` + * For example, "/projects/123/settings/gcp-enableMyFeature" + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. Metadata about a setting which is not editable by the end + * user. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $metadata = null; + /** + * The configured value of the setting at the given parent resource (ignoring + * the resource hierarchy). The data type of + * [Value][google.cloud.resourcesettings.v1.Value] must always be consistent + * with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value local_value = 8; + */ + protected $local_value = null; + /** + * Output only. The computed effective value of the setting at the given + * parent resource (based on the resource hierarchy). + * The effective value evaluates to one of the following options in the given + * order (the next option is used if the previous one does not exist): + * 1. the local setting value on the given resource: + * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] + * 2. if one of the given resource's ancestors have a local setting value, + * the local value at the nearest such ancestor + * 3. the setting's default value: + * [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] + * 4. an empty value (defined as a `Value` with all fields unset) + * The data type of [Value][google.cloud.resourcesettings.v1.Value] must + * always be consistent with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value effective_value = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $effective_value = null; + /** + * A fingerprint used for optimistic concurrency. See + * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] + * for more details. + * + * Generated from protobuf field string etag = 10; + */ + protected $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the setting. Must be in one of the following forms: + * * `projects/{project_number}/settings/{setting_name}` + * * `folders/{folder_id}/settings/{setting_name}` + * * `organizations/{organization_id}/settings/{setting_name}` + * For example, "/projects/123/settings/gcp-enableMyFeature" + * @type \Google\Cloud\ResourceSettings\V1\SettingMetadata $metadata + * Output only. Metadata about a setting which is not editable by the end + * user. + * @type \Google\Cloud\ResourceSettings\V1\Value $local_value + * The configured value of the setting at the given parent resource (ignoring + * the resource hierarchy). The data type of + * [Value][google.cloud.resourcesettings.v1.Value] must always be consistent + * with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * @type \Google\Cloud\ResourceSettings\V1\Value $effective_value + * Output only. The computed effective value of the setting at the given + * parent resource (based on the resource hierarchy). + * The effective value evaluates to one of the following options in the given + * order (the next option is used if the previous one does not exist): + * 1. the local setting value on the given resource: + * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] + * 2. if one of the given resource's ancestors have a local setting value, + * the local value at the nearest such ancestor + * 3. the setting's default value: + * [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] + * 4. an empty value (defined as a `Value` with all fields unset) + * The data type of [Value][google.cloud.resourcesettings.v1.Value] must + * always be consistent with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * @type string $etag + * A fingerprint used for optimistic concurrency. See + * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] + * for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the setting. Must be in one of the following forms: + * * `projects/{project_number}/settings/{setting_name}` + * * `folders/{folder_id}/settings/{setting_name}` + * * `organizations/{organization_id}/settings/{setting_name}` + * For example, "/projects/123/settings/gcp-enableMyFeature" + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the setting. Must be in one of the following forms: + * * `projects/{project_number}/settings/{setting_name}` + * * `folders/{folder_id}/settings/{setting_name}` + * * `organizations/{organization_id}/settings/{setting_name}` + * For example, "/projects/123/settings/gcp-enableMyFeature" + * + * 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; + } + + /** + * Output only. Metadata about a setting which is not editable by the end + * user. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\ResourceSettings\V1\SettingMetadata|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Output only. Metadata about a setting which is not editable by the end + * user. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\ResourceSettings\V1\SettingMetadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\SettingMetadata::class); + $this->metadata = $var; + + return $this; + } + + /** + * The configured value of the setting at the given parent resource (ignoring + * the resource hierarchy). The data type of + * [Value][google.cloud.resourcesettings.v1.Value] must always be consistent + * with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value local_value = 8; + * @return \Google\Cloud\ResourceSettings\V1\Value|null + */ + public function getLocalValue() + { + return $this->local_value; + } + + public function hasLocalValue() + { + return isset($this->local_value); + } + + public function clearLocalValue() + { + unset($this->local_value); + } + + /** + * The configured value of the setting at the given parent resource (ignoring + * the resource hierarchy). The data type of + * [Value][google.cloud.resourcesettings.v1.Value] must always be consistent + * with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value local_value = 8; + * @param \Google\Cloud\ResourceSettings\V1\Value $var + * @return $this + */ + public function setLocalValue($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\Value::class); + $this->local_value = $var; + + return $this; + } + + /** + * Output only. The computed effective value of the setting at the given + * parent resource (based on the resource hierarchy). + * The effective value evaluates to one of the following options in the given + * order (the next option is used if the previous one does not exist): + * 1. the local setting value on the given resource: + * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] + * 2. if one of the given resource's ancestors have a local setting value, + * the local value at the nearest such ancestor + * 3. the setting's default value: + * [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] + * 4. an empty value (defined as a `Value` with all fields unset) + * The data type of [Value][google.cloud.resourcesettings.v1.Value] must + * always be consistent with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value effective_value = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\ResourceSettings\V1\Value|null + */ + public function getEffectiveValue() + { + return $this->effective_value; + } + + public function hasEffectiveValue() + { + return isset($this->effective_value); + } + + public function clearEffectiveValue() + { + unset($this->effective_value); + } + + /** + * Output only. The computed effective value of the setting at the given + * parent resource (based on the resource hierarchy). + * The effective value evaluates to one of the following options in the given + * order (the next option is used if the previous one does not exist): + * 1. the local setting value on the given resource: + * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] + * 2. if one of the given resource's ancestors have a local setting value, + * the local value at the nearest such ancestor + * 3. the setting's default value: + * [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] + * 4. an empty value (defined as a `Value` with all fields unset) + * The data type of [Value][google.cloud.resourcesettings.v1.Value] must + * always be consistent with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value effective_value = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\ResourceSettings\V1\Value $var + * @return $this + */ + public function setEffectiveValue($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\Value::class); + $this->effective_value = $var; + + return $this; + } + + /** + * A fingerprint used for optimistic concurrency. See + * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] + * for more details. + * + * Generated from protobuf field string etag = 10; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * A fingerprint used for optimistic concurrency. See + * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] + * for more details. + * + * Generated from protobuf field string etag = 10; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata.php new file mode 100644 index 000000000000..0c7450691b76 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata.php @@ -0,0 +1,229 @@ +google.cloud.resourcesettings.v1.SettingMetadata + */ +class SettingMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The human readable name for this setting. + * + * Generated from protobuf field string display_name = 1; + */ + protected $display_name = ''; + /** + * A detailed description of what this setting does. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * A flag indicating that values of this setting cannot be modified (see + * documentation of the specific setting for updates and reasons). + * + * Generated from protobuf field bool read_only = 3; + */ + protected $read_only = false; + /** + * The data type for this setting. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata.DataType data_type = 4; + */ + protected $data_type = 0; + /** + * The value provided by + * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] + * if no setting value is explicitly set. + * Note: not all settings have a default value. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value default_value = 5; + */ + protected $default_value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $display_name + * The human readable name for this setting. + * @type string $description + * A detailed description of what this setting does. + * @type bool $read_only + * A flag indicating that values of this setting cannot be modified (see + * documentation of the specific setting for updates and reasons). + * @type int $data_type + * The data type for this setting. + * @type \Google\Cloud\ResourceSettings\V1\Value $default_value + * The value provided by + * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] + * if no setting value is explicitly set. + * Note: not all settings have a default value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); + parent::__construct($data); + } + + /** + * The human readable name for this setting. + * + * Generated from protobuf field string display_name = 1; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The human readable name for this setting. + * + * 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; + } + + /** + * A detailed description of what this setting does. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A detailed description of what this setting does. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * A flag indicating that values of this setting cannot be modified (see + * documentation of the specific setting for updates and reasons). + * + * Generated from protobuf field bool read_only = 3; + * @return bool + */ + public function getReadOnly() + { + return $this->read_only; + } + + /** + * A flag indicating that values of this setting cannot be modified (see + * documentation of the specific setting for updates and reasons). + * + * Generated from protobuf field bool read_only = 3; + * @param bool $var + * @return $this + */ + public function setReadOnly($var) + { + GPBUtil::checkBool($var); + $this->read_only = $var; + + return $this; + } + + /** + * The data type for this setting. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata.DataType data_type = 4; + * @return int + */ + public function getDataType() + { + return $this->data_type; + } + + /** + * The data type for this setting. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata.DataType data_type = 4; + * @param int $var + * @return $this + */ + public function setDataType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\ResourceSettings\V1\SettingMetadata\DataType::class); + $this->data_type = $var; + + return $this; + } + + /** + * The value provided by + * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] + * if no setting value is explicitly set. + * Note: not all settings have a default value. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value default_value = 5; + * @return \Google\Cloud\ResourceSettings\V1\Value|null + */ + public function getDefaultValue() + { + return $this->default_value; + } + + public function hasDefaultValue() + { + return isset($this->default_value); + } + + public function clearDefaultValue() + { + unset($this->default_value); + } + + /** + * The value provided by + * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] + * if no setting value is explicitly set. + * Note: not all settings have a default value. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value default_value = 5; + * @param \Google\Cloud\ResourceSettings\V1\Value $var + * @return $this + */ + public function setDefaultValue($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\Value::class); + $this->default_value = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata/DataType.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata/DataType.php new file mode 100644 index 000000000000..933bb281ab6a --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata/DataType.php @@ -0,0 +1,80 @@ +google.cloud.resourcesettings.v1.SettingMetadata.DataType + */ +class DataType +{ + /** + * Unspecified data type. + * + * Generated from protobuf enum DATA_TYPE_UNSPECIFIED = 0; + */ + const DATA_TYPE_UNSPECIFIED = 0; + /** + * A boolean setting. + * + * Generated from protobuf enum BOOLEAN = 1; + */ + const BOOLEAN = 1; + /** + * A string setting. + * + * Generated from protobuf enum STRING = 2; + */ + const STRING = 2; + /** + * A string set setting. + * + * Generated from protobuf enum STRING_SET = 3; + */ + const STRING_SET = 3; + /** + * A Enum setting + * + * Generated from protobuf enum ENUM_VALUE = 4; + */ + const ENUM_VALUE = 4; + + private static $valueToName = [ + self::DATA_TYPE_UNSPECIFIED => 'DATA_TYPE_UNSPECIFIED', + self::BOOLEAN => 'BOOLEAN', + self::STRING => 'STRING', + self::STRING_SET => 'STRING_SET', + self::ENUM_VALUE => 'ENUM_VALUE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DataType::class, \Google\Cloud\ResourceSettings\V1\SettingMetadata_DataType::class); + diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingView.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingView.php new file mode 100644 index 000000000000..80dad94f8b5f --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingView.php @@ -0,0 +1,76 @@ +google.cloud.resourcesettings.v1.SettingView + */ +class SettingView +{ + /** + * The default / unset value. + * The API will default to the SETTING_VIEW_BASIC view. + * + * Generated from protobuf enum SETTING_VIEW_UNSPECIFIED = 0; + */ + const SETTING_VIEW_UNSPECIFIED = 0; + /** + * Include + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata], but + * nothing else. This is the default value (for both ListSettings and + * GetSetting). + * + * Generated from protobuf enum SETTING_VIEW_BASIC = 1; + */ + const SETTING_VIEW_BASIC = 1; + /** + * Include + * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value], + * but nothing else. + * + * Generated from protobuf enum SETTING_VIEW_EFFECTIVE_VALUE = 2; + */ + const SETTING_VIEW_EFFECTIVE_VALUE = 2; + /** + * Include + * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value], + * but nothing else. + * + * Generated from protobuf enum SETTING_VIEW_LOCAL_VALUE = 3; + */ + const SETTING_VIEW_LOCAL_VALUE = 3; + + private static $valueToName = [ + self::SETTING_VIEW_UNSPECIFIED => 'SETTING_VIEW_UNSPECIFIED', + self::SETTING_VIEW_BASIC => 'SETTING_VIEW_BASIC', + self::SETTING_VIEW_EFFECTIVE_VALUE => 'SETTING_VIEW_EFFECTIVE_VALUE', + self::SETTING_VIEW_LOCAL_VALUE => 'SETTING_VIEW_LOCAL_VALUE', + ]; + + 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/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/UpdateSettingRequest.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/UpdateSettingRequest.php new file mode 100644 index 000000000000..9f21c56b4550 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/UpdateSettingRequest.php @@ -0,0 +1,81 @@ +google.cloud.resourcesettings.v1.UpdateSettingRequest + */ +class UpdateSettingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The setting to update. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Setting setting = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $setting = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\ResourceSettings\V1\Setting $setting + * Required. The setting to update. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); + parent::__construct($data); + } + + /** + * Required. The setting to update. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Setting setting = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\ResourceSettings\V1\Setting|null + */ + public function getSetting() + { + return $this->setting; + } + + public function hasSetting() + { + return isset($this->setting); + } + + public function clearSetting() + { + unset($this->setting); + } + + /** + * Required. The setting to update. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Setting setting = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\ResourceSettings\V1\Setting $var + * @return $this + */ + public function setSetting($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\Setting::class); + $this->setting = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value.php new file mode 100644 index 000000000000..e43966d7129a --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value.php @@ -0,0 +1,174 @@ +google.cloud.resourcesettings.v1.Value + */ +class Value extends \Google\Protobuf\Internal\Message +{ + protected $value; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $boolean_value + * Defines this value as being a boolean value. + * @type string $string_value + * Defines this value as being a string value. + * @type \Google\Cloud\ResourceSettings\V1\Value\StringSet $string_set_value + * Defines this value as being a StringSet. + * @type \Google\Cloud\ResourceSettings\V1\Value\EnumValue $enum_value + * Defines this value as being a Enum. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); + parent::__construct($data); + } + + /** + * Defines this value as being a boolean value. + * + * Generated from protobuf field bool boolean_value = 1; + * @return bool + */ + public function getBooleanValue() + { + return $this->readOneof(1); + } + + public function hasBooleanValue() + { + return $this->hasOneof(1); + } + + /** + * Defines this value as being a boolean value. + * + * Generated from protobuf field bool boolean_value = 1; + * @param bool $var + * @return $this + */ + public function setBooleanValue($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Defines this value as being a string value. + * + * Generated from protobuf field string string_value = 2; + * @return string + */ + public function getStringValue() + { + return $this->readOneof(2); + } + + public function hasStringValue() + { + return $this->hasOneof(2); + } + + /** + * Defines this value as being a string value. + * + * Generated from protobuf field string string_value = 2; + * @param string $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Defines this value as being a StringSet. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value.StringSet string_set_value = 3; + * @return \Google\Cloud\ResourceSettings\V1\Value\StringSet|null + */ + public function getStringSetValue() + { + return $this->readOneof(3); + } + + public function hasStringSetValue() + { + return $this->hasOneof(3); + } + + /** + * Defines this value as being a StringSet. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value.StringSet string_set_value = 3; + * @param \Google\Cloud\ResourceSettings\V1\Value\StringSet $var + * @return $this + */ + public function setStringSetValue($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\Value\StringSet::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Defines this value as being a Enum. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value.EnumValue enum_value = 4; + * @return \Google\Cloud\ResourceSettings\V1\Value\EnumValue|null + */ + public function getEnumValue() + { + return $this->readOneof(4); + } + + public function hasEnumValue() + { + return $this->hasOneof(4); + } + + /** + * Defines this value as being a Enum. + * + * Generated from protobuf field .google.cloud.resourcesettings.v1.Value.EnumValue enum_value = 4; + * @param \Google\Cloud\ResourceSettings\V1\Value\EnumValue $var + * @return $this + */ + public function setEnumValue($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\Value\EnumValue::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->whichOneof("value"); + } + +} + diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/EnumValue.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/EnumValue.php new file mode 100644 index 000000000000..b1b28bd71728 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/EnumValue.php @@ -0,0 +1,72 @@ +google.cloud.resourcesettings.v1.Value.EnumValue + */ +class EnumValue extends \Google\Protobuf\Internal\Message +{ + /** + * The value of this enum + * + * Generated from protobuf field string value = 1; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $value + * The value of this enum + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); + parent::__construct($data); + } + + /** + * The value of this enum + * + * Generated from protobuf field string value = 1; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The value of this enum + * + * Generated from protobuf field string value = 1; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EnumValue::class, \Google\Cloud\ResourceSettings\V1\Value_EnumValue::class); + diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/StringSet.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/StringSet.php new file mode 100644 index 000000000000..2639831851a8 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/StringSet.php @@ -0,0 +1,72 @@ +google.cloud.resourcesettings.v1.Value.StringSet + */ +class StringSet extends \Google\Protobuf\Internal\Message +{ + /** + * The strings in the set + * + * Generated from protobuf field repeated string values = 1; + */ + private $values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $values + * The strings in the set + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); + parent::__construct($data); + } + + /** + * The strings in the set + * + * Generated from protobuf field repeated string values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * The strings in the set + * + * Generated from protobuf field repeated string values = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->values = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StringSet::class, \Google\Cloud\ResourceSettings\V1\Value_StringSet::class); + diff --git a/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/get_setting.php b/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/get_setting.php new file mode 100644 index 000000000000..9e69e9c6355b --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/get_setting.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Setting $response */ + $response = $resourceSettingsServiceClient->getSetting($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 = ResourceSettingsServiceClient::settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); + + get_setting_sample($formattedName); +} +// [END resourcesettings_v1_generated_ResourceSettingsService_GetSetting_sync] diff --git a/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/list_settings.php b/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/list_settings.php new file mode 100644 index 000000000000..eae0ab609c4b --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/list_settings.php @@ -0,0 +1,81 @@ +setParent($parent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $resourceSettingsServiceClient->listSettings($request); + + /** @var Setting $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 +{ + $parent = '[PARENT]'; + + list_settings_sample($parent); +} +// [END resourcesettings_v1_generated_ResourceSettingsService_ListSettings_sync] diff --git a/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/update_setting.php b/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/update_setting.php new file mode 100644 index 000000000000..69c6244265cf --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/update_setting.php @@ -0,0 +1,74 @@ +setSetting($setting); + + // Call the API and handle any network failures. + try { + /** @var Setting $response */ + $response = $resourceSettingsServiceClient->updateSetting($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END resourcesettings_v1_generated_ResourceSettingsService_UpdateSetting_sync] diff --git a/owl-bot-staging/ResourceSettings/v1/src/V1/Client/ResourceSettingsServiceClient.php b/owl-bot-staging/ResourceSettings/v1/src/V1/Client/ResourceSettingsServiceClient.php new file mode 100644 index 000000000000..c59c18c08bb7 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/src/V1/Client/ResourceSettingsServiceClient.php @@ -0,0 +1,383 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/resource_settings_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/resource_settings_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/resource_settings_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/resource_settings_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_setting_name resource. + * + * @param string $folder + * @param string $settingName + * + * @return string The formatted folder_setting_name resource. + */ + public static function folderSettingNameName(string $folder, string $settingName): string + { + return self::getPathTemplate('folderSettingName')->render([ + 'folder' => $folder, + 'setting_name' => $settingName, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_setting_name resource. + * + * @param string $organization + * @param string $settingName + * + * @return string The formatted organization_setting_name resource. + */ + public static function organizationSettingNameName(string $organization, string $settingName): string + { + return self::getPathTemplate('organizationSettingName')->render([ + 'organization' => $organization, + 'setting_name' => $settingName, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_number_setting_name resource. + * + * @param string $projectNumber + * @param string $settingName + * + * @return string The formatted project_number_setting_name resource. + */ + public static function projectNumberSettingNameName(string $projectNumber, string $settingName): string + { + return self::getPathTemplate('projectNumberSettingName')->render([ + 'project_number' => $projectNumber, + 'setting_name' => $settingName, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a setting + * resource. + * + * @param string $projectNumber + * @param string $settingName + * + * @return string The formatted setting resource. + */ + public static function settingName(string $projectNumber, string $settingName): string + { + return self::getPathTemplate('setting')->render([ + 'project_number' => $projectNumber, + 'setting_name' => $settingName, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folderSettingName: folders/{folder}/settings/{setting_name} + * - organizationSettingName: organizations/{organization}/settings/{setting_name} + * - projectNumberSettingName: projects/{project_number}/settings/{setting_name} + * - setting: projects/{project_number}/settings/{setting_name} + * + * 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 'resourcesettings.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 setting. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * setting does not exist. + * + * The async variant is {@see ResourceSettingsServiceClient::getSettingAsync()} . + * + * @example samples/V1/ResourceSettingsServiceClient/get_setting.php + * + * @param GetSettingRequest $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 Setting + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSetting(GetSettingRequest $request, array $callOptions = []): Setting + { + return $this->startApiCall('GetSetting', $request, $callOptions)->wait(); + } + + /** + * Lists all the settings that are available on the Cloud resource `parent`. + * + * The async variant is {@see ResourceSettingsServiceClient::listSettingsAsync()} . + * + * @example samples/V1/ResourceSettingsServiceClient/list_settings.php + * + * @param ListSettingsRequest $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 listSettings(ListSettingsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSettings', $request, $callOptions); + } + + /** + * Updates a setting. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * setting does not exist. + * Returns a `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if + * the setting is flagged as read only. + * Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag + * supplied in the request does not match the persisted etag of the setting + * value. + * + * On success, the response will contain only `name`, `local_value` and + * `etag`. The `metadata` and `effective_value` cannot be updated through + * this API. + * + * Note: the supplied setting will perform a full overwrite of the + * `local_value` field. + * + * The async variant is {@see ResourceSettingsServiceClient::updateSettingAsync()} + * . + * + * @example samples/V1/ResourceSettingsServiceClient/update_setting.php + * + * @param UpdateSettingRequest $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 Setting + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSetting(UpdateSettingRequest $request, array $callOptions = []): Setting + { + return $this->startApiCall('UpdateSetting', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/ResourceSettings/v1/src/V1/Gapic/ResourceSettingsServiceGapicClient.php b/owl-bot-staging/ResourceSettings/v1/src/V1/Gapic/ResourceSettingsServiceGapicClient.php new file mode 100644 index 000000000000..aa3d95bc24c1 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/src/V1/Gapic/ResourceSettingsServiceGapicClient.php @@ -0,0 +1,545 @@ +settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); + * $response = $resourceSettingsServiceClient->getSetting($formattedName); + * } finally { + * $resourceSettingsServiceClient->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. + * + * @deprecated Please use the new service client {@see \Google\Cloud\ResourceSettings\V1\Client\ResourceSettingsServiceClient}. + */ +class ResourceSettingsServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.resourcesettings.v1.ResourceSettingsService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'resourcesettings.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'resourcesettings.UNIVERSE_DOMAIN'; + + /** 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 $folderSettingNameNameTemplate; + + private static $organizationSettingNameNameTemplate; + + private static $projectNumberSettingNameNameTemplate; + + private static $settingNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/resource_settings_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/resource_settings_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/resource_settings_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/resource_settings_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getFolderSettingNameNameTemplate() + { + if (self::$folderSettingNameNameTemplate == null) { + self::$folderSettingNameNameTemplate = new PathTemplate('folders/{folder}/settings/{setting_name}'); + } + + return self::$folderSettingNameNameTemplate; + } + + private static function getOrganizationSettingNameNameTemplate() + { + if (self::$organizationSettingNameNameTemplate == null) { + self::$organizationSettingNameNameTemplate = new PathTemplate('organizations/{organization}/settings/{setting_name}'); + } + + return self::$organizationSettingNameNameTemplate; + } + + private static function getProjectNumberSettingNameNameTemplate() + { + if (self::$projectNumberSettingNameNameTemplate == null) { + self::$projectNumberSettingNameNameTemplate = new PathTemplate('projects/{project_number}/settings/{setting_name}'); + } + + return self::$projectNumberSettingNameNameTemplate; + } + + private static function getSettingNameTemplate() + { + if (self::$settingNameTemplate == null) { + self::$settingNameTemplate = new PathTemplate('projects/{project_number}/settings/{setting_name}'); + } + + return self::$settingNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'folderSettingName' => self::getFolderSettingNameNameTemplate(), + 'organizationSettingName' => self::getOrganizationSettingNameNameTemplate(), + 'projectNumberSettingName' => self::getProjectNumberSettingNameNameTemplate(), + 'setting' => self::getSettingNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_setting_name resource. + * + * @param string $folder + * @param string $settingName + * + * @return string The formatted folder_setting_name resource. + */ + public static function folderSettingNameName($folder, $settingName) + { + return self::getFolderSettingNameNameTemplate()->render([ + 'folder' => $folder, + 'setting_name' => $settingName, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_setting_name resource. + * + * @param string $organization + * @param string $settingName + * + * @return string The formatted organization_setting_name resource. + */ + public static function organizationSettingNameName($organization, $settingName) + { + return self::getOrganizationSettingNameNameTemplate()->render([ + 'organization' => $organization, + 'setting_name' => $settingName, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_number_setting_name resource. + * + * @param string $projectNumber + * @param string $settingName + * + * @return string The formatted project_number_setting_name resource. + */ + public static function projectNumberSettingNameName($projectNumber, $settingName) + { + return self::getProjectNumberSettingNameNameTemplate()->render([ + 'project_number' => $projectNumber, + 'setting_name' => $settingName, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a setting + * resource. + * + * @param string $projectNumber + * @param string $settingName + * + * @return string The formatted setting resource. + */ + public static function settingName($projectNumber, $settingName) + { + return self::getSettingNameTemplate()->render([ + 'project_number' => $projectNumber, + 'setting_name' => $settingName, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folderSettingName: folders/{folder}/settings/{setting_name} + * - organizationSettingName: organizations/{organization}/settings/{setting_name} + * - projectNumberSettingName: projects/{project_number}/settings/{setting_name} + * - setting: projects/{project_number}/settings/{setting_name} + * + * 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 'resourcesettings.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 setting. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * setting does not exist. + * + * Sample code: + * ``` + * $resourceSettingsServiceClient = new ResourceSettingsServiceClient(); + * try { + * $formattedName = $resourceSettingsServiceClient->settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); + * $response = $resourceSettingsServiceClient->getSetting($formattedName); + * } finally { + * $resourceSettingsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * requirements. + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * The SettingView for this request. + * For allowed values, use constants defined on {@see \Google\Cloud\ResourceSettings\V1\SettingView} + * @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\ResourceSettings\V1\Setting + * + * @throws ApiException if the remote call fails + */ + public function getSetting($name, array $optionalArgs = []) + { + $request = new GetSettingRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSetting', Setting::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists all the settings that are available on the Cloud resource `parent`. + * + * Sample code: + * ``` + * $resourceSettingsServiceClient = new ResourceSettingsServiceClient(); + * try { + * $parent = 'parent'; + * // Iterate over pages of elements + * $pagedResponse = $resourceSettingsServiceClient->listSettings($parent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $resourceSettingsServiceClient->listSettings($parent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $resourceSettingsServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The Cloud resource that parents the setting. Must be in one of + * the following forms: + * + * * `projects/{project_number}` + * * `projects/{project_id}` + * * `folders/{folder_id}` + * * `organizations/{organization_id}` + * @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 + * The SettingView for this request. + * For allowed values, use constants defined on {@see \Google\Cloud\ResourceSettings\V1\SettingView} + * @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 listSettings($parent, array $optionalArgs = []) + { + $request = new ListSettingsRequest(); + $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']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSettings', $optionalArgs, ListSettingsResponse::class, $request); + } + + /** + * Updates a setting. + * + * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the + * setting does not exist. + * Returns a `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if + * the setting is flagged as read only. + * Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag + * supplied in the request does not match the persisted etag of the setting + * value. + * + * On success, the response will contain only `name`, `local_value` and + * `etag`. The `metadata` and `effective_value` cannot be updated through + * this API. + * + * Note: the supplied setting will perform a full overwrite of the + * `local_value` field. + * + * Sample code: + * ``` + * $resourceSettingsServiceClient = new ResourceSettingsServiceClient(); + * try { + * $setting = new Setting(); + * $response = $resourceSettingsServiceClient->updateSetting($setting); + * } finally { + * $resourceSettingsServiceClient->close(); + * } + * ``` + * + * @param Setting $setting Required. The setting to update. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. + * @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\ResourceSettings\V1\Setting + * + * @throws ApiException if the remote call fails + */ + public function updateSetting($setting, array $optionalArgs = []) + { + $request = new UpdateSettingRequest(); + $requestParamHeaders = []; + $request->setSetting($setting); + $requestParamHeaders['setting.name'] = $setting->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateSetting', Setting::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/ResourceSettings/v1/src/V1/ResourceSettingsServiceClient.php b/owl-bot-staging/ResourceSettings/v1/src/V1/ResourceSettingsServiceClient.php new file mode 100644 index 000000000000..83b4d8c98b05 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/src/V1/ResourceSettingsServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.resourcesettings.v1.ResourceSettingsService' => [ + 'GetSetting' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ResourceSettings\V1\Setting', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListSettings' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSettings', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\ResourceSettings\V1\ListSettingsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateSetting' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\ResourceSettings\V1\Setting', + 'headerParams' => [ + [ + 'keyName' => 'setting.name', + 'fieldAccessors' => [ + 'getSetting', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'folderSettingName' => 'folders/{folder}/settings/{setting_name}', + 'organizationSettingName' => 'organizations/{organization}/settings/{setting_name}', + 'projectNumberSettingName' => 'projects/{project_number}/settings/{setting_name}', + 'setting' => 'projects/{project_number}/settings/{setting_name}', + ], + ], + ], +]; diff --git a/owl-bot-staging/ResourceSettings/v1/src/V1/resources/resource_settings_service_rest_client_config.php b/owl-bot-staging/ResourceSettings/v1/src/V1/resources/resource_settings_service_rest_client_config.php new file mode 100644 index 000000000000..af1aea760155 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/src/V1/resources/resource_settings_service_rest_client_config.php @@ -0,0 +1,96 @@ + [ + 'google.cloud.resourcesettings.v1.ResourceSettingsService' => [ + 'GetSetting' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/settings/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=folders/*/settings/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/settings/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListSettings' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=organizations/*}/settings', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=folders/*}/settings', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*}/settings', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateSetting' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{setting.name=organizations/*/settings/*}', + 'body' => 'setting', + 'additionalBindings' => [ + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{setting.name=folders/*/settings/*}', + 'body' => 'setting', + ], + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{setting.name=projects/*/settings/*}', + 'body' => 'setting', + ], + ], + 'placeholders' => [ + 'setting.name' => [ + 'getters' => [ + 'getSetting', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/Client/ResourceSettingsServiceClientTest.php b/owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/Client/ResourceSettingsServiceClientTest.php new file mode 100644 index 000000000000..68b79b6962d1 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/Client/ResourceSettingsServiceClientTest.php @@ -0,0 +1,300 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ResourceSettingsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ResourceSettingsServiceClient($options); + } + + /** @test */ + public function getSettingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $expectedResponse = new Setting(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); + $request = (new GetSettingRequest()) + ->setName($formattedName); + $response = $gapicClient->getSetting($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.resourcesettings.v1.ResourceSettingsService/GetSetting', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSettingExceptionTest() + { + $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->settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); + $request = (new GetSettingRequest()) + ->setName($formattedName); + try { + $gapicClient->getSetting($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 listSettingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $settingsElement = new Setting(); + $settings = [ + $settingsElement, + ]; + $expectedResponse = new ListSettingsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSettings($settings); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $request = (new ListSettingsRequest()) + ->setParent($parent); + $response = $gapicClient->listSettings($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSettings()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.resourcesettings.v1.ResourceSettingsService/ListSettings', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSettingsExceptionTest() + { + $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 + $parent = 'parent-995424086'; + $request = (new ListSettingsRequest()) + ->setParent($parent); + try { + $gapicClient->listSettings($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 updateSettingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $expectedResponse = new Setting(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $setting = new Setting(); + $request = (new UpdateSettingRequest()) + ->setSetting($setting); + $response = $gapicClient->updateSetting($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.resourcesettings.v1.ResourceSettingsService/UpdateSetting', $actualFuncCall); + $actualValue = $actualRequestObject->getSetting(); + $this->assertProtobufEquals($setting, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSettingExceptionTest() + { + $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 + $setting = new Setting(); + $request = (new UpdateSettingRequest()) + ->setSetting($setting); + try { + $gapicClient->updateSetting($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 getSettingAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $expectedResponse = new Setting(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); + $request = (new GetSettingRequest()) + ->setName($formattedName); + $response = $gapicClient->getSettingAsync($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.resourcesettings.v1.ResourceSettingsService/GetSetting', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/ResourceSettingsServiceClientTest.php b/owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/ResourceSettingsServiceClientTest.php new file mode 100644 index 000000000000..5b92c7779a55 --- /dev/null +++ b/owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/ResourceSettingsServiceClientTest.php @@ -0,0 +1,254 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ResourceSettingsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ResourceSettingsServiceClient($options); + } + + /** @test */ + public function getSettingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $expectedResponse = new Setting(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); + $response = $gapicClient->getSetting($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.resourcesettings.v1.ResourceSettingsService/GetSetting', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSettingExceptionTest() + { + $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->settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); + try { + $gapicClient->getSetting($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 listSettingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $settingsElement = new Setting(); + $settings = [ + $settingsElement, + ]; + $expectedResponse = new ListSettingsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSettings($settings); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $response = $gapicClient->listSettings($parent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSettings()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.resourcesettings.v1.ResourceSettingsService/ListSettings', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSettingsExceptionTest() + { + $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 + $parent = 'parent-995424086'; + try { + $gapicClient->listSettings($parent); + // 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 updateSettingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $expectedResponse = new Setting(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $setting = new Setting(); + $response = $gapicClient->updateSetting($setting); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.resourcesettings.v1.ResourceSettingsService/UpdateSetting', $actualFuncCall); + $actualValue = $actualRequestObject->getSetting(); + $this->assertProtobufEquals($setting, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSettingExceptionTest() + { + $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 + $setting = new Setting(); + try { + $gapicClient->updateSetting($setting); + // 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()); + } +} From e0bd37a1a7ae8651ce7a67de4899449b25b5e852 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 31 May 2024 19:05:42 +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 --- .../metadata/V1/ResourceSettings.php | Bin 3816 -> 3819 bytes .../get_setting.php | 3 +- .../list_settings.php | 4 +- .../Client/ResourceSettingsServiceClient.php | 5 + .../ResourceSettingsServiceGapicClient.php | 13 +- ResourceSettings/src/V1/GetSettingRequest.php | 15 +- .../src/V1/ListSettingsRequest.php | 20 +- ResourceSettings/src/V1/Setting.php | 112 ++-- ResourceSettings/src/V1/SettingMetadata.php | 20 +- .../src/V1/SettingMetadata/DataType.php | 5 +- ResourceSettings/src/V1/SettingView.php | 14 +- .../src/V1/UpdateSettingRequest.php | 12 +- .../Resourcesettings/V1/ResourceSettings.php | Bin 3819 -> 0 bytes .../ResourceSettings/V1/GetSettingRequest.php | 125 ---- .../V1/ListSettingsRequest.php | 208 ------- .../V1/ListSettingsResponse.php | 101 ---- .../Cloud/ResourceSettings/V1/Setting.php | 329 ----------- .../ResourceSettings/V1/SettingMetadata.php | 229 -------- .../V1/SettingMetadata/DataType.php | 80 --- .../Cloud/ResourceSettings/V1/SettingView.php | 76 --- .../V1/UpdateSettingRequest.php | 81 --- .../Cloud/ResourceSettings/V1/Value.php | 174 ------ .../ResourceSettings/V1/Value/EnumValue.php | 72 --- .../ResourceSettings/V1/Value/StringSet.php | 72 --- .../get_setting.php | 76 --- .../list_settings.php | 81 --- .../update_setting.php | 74 --- .../Client/ResourceSettingsServiceClient.php | 383 ------------ .../ResourceSettingsServiceGapicClient.php | 545 ------------------ .../src/V1/ResourceSettingsServiceClient.php | 34 -- .../v1/src/V1/gapic_metadata.json | 33 -- ...source_settings_service_client_config.json | 50 -- ...rce_settings_service_descriptor_config.php | 79 --- ...ce_settings_service_rest_client_config.php | 96 --- .../ResourceSettingsServiceClientTest.php | 300 ---------- .../V1/ResourceSettingsServiceClientTest.php | 254 -------- 36 files changed, 139 insertions(+), 3636 deletions(-) delete mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/GPBMetadata/Google/Cloud/Resourcesettings/V1/ResourceSettings.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/GetSettingRequest.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsRequest.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsResponse.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Setting.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata/DataType.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingView.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/UpdateSettingRequest.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/EnumValue.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/StringSet.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/get_setting.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/list_settings.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/update_setting.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/Client/ResourceSettingsServiceClient.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/Gapic/ResourceSettingsServiceGapicClient.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/ResourceSettingsServiceClient.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/gapic_metadata.json delete mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/resources/resource_settings_service_client_config.json delete mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/resources/resource_settings_service_descriptor_config.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/src/V1/resources/resource_settings_service_rest_client_config.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/Client/ResourceSettingsServiceClientTest.php delete mode 100644 owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/ResourceSettingsServiceClientTest.php diff --git a/ResourceSettings/metadata/V1/ResourceSettings.php b/ResourceSettings/metadata/V1/ResourceSettings.php index 978b2e87241f3a684cf11d66656a8c0589d12f7c..0ddd1d8f7c88c52b096800ab85dfa2b2b8b3fc65 100644 GIT binary patch delta 38 ucmaDM`&xFxEhff;n{PAOu`~YJEXAeH%pTUk#CXb4e)0qs`OPW3EsOvn5DhQ@ delta 35 rcmaDY`$BfZEhff&n{PAOu`~YMEXAeH%o2RcQGW6S7WvKTye*6X|8NYP diff --git a/ResourceSettings/samples/V1/ResourceSettingsServiceClient/get_setting.php b/ResourceSettings/samples/V1/ResourceSettingsServiceClient/get_setting.php index 383b62101fcb..d09a9930816d 100644 --- a/ResourceSettings/samples/V1/ResourceSettingsServiceClient/get_setting.php +++ b/ResourceSettings/samples/V1/ResourceSettingsServiceClient/get_setting.php @@ -34,7 +34,8 @@ * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the * setting does not exist. * - * @param string $formattedName The name of the setting to get. See [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * @param string $formattedName The name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming * requirements. Please see * {@see ResourceSettingsServiceClient::settingName()} for help formatting this field. */ diff --git a/ResourceSettings/samples/V1/ResourceSettingsServiceClient/list_settings.php b/ResourceSettings/samples/V1/ResourceSettingsServiceClient/list_settings.php index 53580af9b606..3f444af5b71d 100644 --- a/ResourceSettings/samples/V1/ResourceSettingsServiceClient/list_settings.php +++ b/ResourceSettings/samples/V1/ResourceSettingsServiceClient/list_settings.php @@ -32,8 +32,8 @@ /** * Lists all the settings that are available on the Cloud resource `parent`. * - * @param string $parent The Cloud resource that parents the setting. Must be in one of the - * following forms: + * @param string $parent The Cloud resource that parents the setting. Must be in one of + * the following forms: * * * `projects/{project_number}` * * `projects/{project_id}` diff --git a/ResourceSettings/src/V1/Client/ResourceSettingsServiceClient.php b/ResourceSettings/src/V1/Client/ResourceSettingsServiceClient.php index bce2a4ead91e..6d5483bb3dfe 100644 --- a/ResourceSettings/src/V1/Client/ResourceSettingsServiceClient.php +++ b/ResourceSettings/src/V1/Client/ResourceSettingsServiceClient.php @@ -52,6 +52,9 @@ * resource is not in a Cloud Organization. * For all requests, returns a `google.rpc.Status` with * `google.rpc.Code.INVALID_ARGUMENT` if the request is malformed. + * (== deprecation_description Resource Settings is deprecated. As of November + * 7, 2023, no organizations will be onboarded for any of the enabled settings, + * and the service will be shut down on October 1, 2024. ==) * * This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. @@ -61,6 +64,8 @@ * name, and additionally a parseName method to extract the individual identifiers * contained within formatted names that are returned by the API. * + * @deprecated This class will be removed in the next major version update. + * * @method PromiseInterface getSettingAsync(GetSettingRequest $request, array $optionalArgs = []) * @method PromiseInterface listSettingsAsync(ListSettingsRequest $request, array $optionalArgs = []) * @method PromiseInterface updateSettingAsync(UpdateSettingRequest $request, array $optionalArgs = []) diff --git a/ResourceSettings/src/V1/Gapic/ResourceSettingsServiceGapicClient.php b/ResourceSettings/src/V1/Gapic/ResourceSettingsServiceGapicClient.php index 81b66a825428..735b280de306 100644 --- a/ResourceSettings/src/V1/Gapic/ResourceSettingsServiceGapicClient.php +++ b/ResourceSettings/src/V1/Gapic/ResourceSettingsServiceGapicClient.php @@ -53,6 +53,9 @@ * resource is not in a Cloud Organization. * For all requests, returns a `google.rpc.Status` with * `google.rpc.Code.INVALID_ARGUMENT` if the request is malformed. + * (== deprecation_description Resource Settings is deprecated. As of November + * 7, 2023, no organizations will be onboarded for any of the enabled settings, + * and the service will be shut down on October 1, 2024. ==) * * This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: @@ -395,7 +398,8 @@ public function __construct(array $options = []) * } * ``` * - * @param string $name Required. The name of the setting to get. See [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * @param string $name Required. The name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming * requirements. * @param array $optionalArgs { * Optional. @@ -463,8 +467,8 @@ public function getSetting($name, array $optionalArgs = []) * } * ``` * - * @param string $parent Required. The Cloud resource that parents the setting. Must be in one of the - * following forms: + * @param string $parent Required. The Cloud resource that parents the setting. Must be in one of + * the following forms: * * * `projects/{project_number}` * * `projects/{project_id}` @@ -556,7 +560,8 @@ public function listSettings($parent, array $optionalArgs = []) * } * ``` * - * @param Setting $setting Required. The setting to update. See [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. + * @param Setting $setting Required. The setting to update. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. * @param array $optionalArgs { * Optional. * diff --git a/ResourceSettings/src/V1/GetSettingRequest.php b/ResourceSettings/src/V1/GetSettingRequest.php index 7bf36eeab4c8..4e9469b716bd 100644 --- a/ResourceSettings/src/V1/GetSettingRequest.php +++ b/ResourceSettings/src/V1/GetSettingRequest.php @@ -16,7 +16,8 @@ class GetSettingRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The name of the setting to get. See [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * Required. The name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming * requirements. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { @@ -30,7 +31,8 @@ class GetSettingRequest extends \Google\Protobuf\Internal\Message private $view = 0; /** - * @param string $name Required. The name of the setting to get. See [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * @param string $name Required. The name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming * requirements. Please see * {@see ResourceSettingsServiceClient::settingName()} for help formatting this field. * @@ -51,7 +53,8 @@ public static function build(string $name): self * Optional. Data for populating the Message object. * * @type string $name - * Required. The name of the setting to get. See [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * Required. The name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming * requirements. * @type int $view * The SettingView for this request. @@ -63,7 +66,8 @@ public function __construct($data = NULL) { } /** - * Required. The name of the setting to get. See [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * Required. The name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming * requirements. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { @@ -75,7 +79,8 @@ public function getName() } /** - * Required. The name of the setting to get. See [Setting][google.cloud.resourcesettings.v1.Setting] for naming + * Required. The name of the setting to get. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for naming * requirements. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { diff --git a/ResourceSettings/src/V1/ListSettingsRequest.php b/ResourceSettings/src/V1/ListSettingsRequest.php index da218cbb94b9..869cbbe3267f 100644 --- a/ResourceSettings/src/V1/ListSettingsRequest.php +++ b/ResourceSettings/src/V1/ListSettingsRequest.php @@ -16,8 +16,8 @@ class ListSettingsRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The Cloud resource that parents the setting. Must be in one of the - * following forms: + * Required. The Cloud resource that parents the setting. Must be in one of + * the following forms: * * `projects/{project_number}` * * `projects/{project_id}` * * `folders/{folder_id}` @@ -46,8 +46,8 @@ class ListSettingsRequest extends \Google\Protobuf\Internal\Message private $view = 0; /** - * @param string $parent Required. The Cloud resource that parents the setting. Must be in one of the - * following forms: + * @param string $parent Required. The Cloud resource that parents the setting. Must be in one of + * the following forms: * * * `projects/{project_number}` * * `projects/{project_id}` @@ -71,8 +71,8 @@ public static function build(string $parent): self * Optional. Data for populating the Message object. * * @type string $parent - * Required. The Cloud resource that parents the setting. Must be in one of the - * following forms: + * Required. The Cloud resource that parents the setting. Must be in one of + * the following forms: * * `projects/{project_number}` * * `projects/{project_id}` * * `folders/{folder_id}` @@ -91,8 +91,8 @@ public function __construct($data = NULL) { } /** - * Required. The Cloud resource that parents the setting. Must be in one of the - * following forms: + * Required. The Cloud resource that parents the setting. Must be in one of + * the following forms: * * `projects/{project_number}` * * `projects/{project_id}` * * `folders/{folder_id}` @@ -107,8 +107,8 @@ public function getParent() } /** - * Required. The Cloud resource that parents the setting. Must be in one of the - * following forms: + * Required. The Cloud resource that parents the setting. Must be in one of + * the following forms: * * `projects/{project_number}` * * `projects/{project_id}` * * `folders/{folder_id}` diff --git a/ResourceSettings/src/V1/Setting.php b/ResourceSettings/src/V1/Setting.php index 77f510c0f6f1..88d798f2e288 100644 --- a/ResourceSettings/src/V1/Setting.php +++ b/ResourceSettings/src/V1/Setting.php @@ -26,39 +26,45 @@ class Setting extends \Google\Protobuf\Internal\Message */ private $name = ''; /** - * Output only. Metadata about a setting which is not editable by the end user. + * Output only. Metadata about a setting which is not editable by the end + * user. * * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ private $metadata = null; /** * The configured value of the setting at the given parent resource (ignoring - * the resource hierarchy). The data type of [Value][google.cloud.resourcesettings.v1.Value] must always be - * consistent with the data type defined in [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * the resource hierarchy). The data type of + * [Value][google.cloud.resourcesettings.v1.Value] must always be consistent + * with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. * * Generated from protobuf field .google.cloud.resourcesettings.v1.Value local_value = 8; */ private $local_value = null; /** - * Output only. The computed effective value of the setting at the given parent resource - * (based on the resource hierarchy). + * Output only. The computed effective value of the setting at the given + * parent resource (based on the resource hierarchy). * The effective value evaluates to one of the following options in the given * order (the next option is used if the previous one does not exist): - * 1. the local setting value on the given resource: [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] + * 1. the local setting value on the given resource: + * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] * 2. if one of the given resource's ancestors have a local setting value, * the local value at the nearest such ancestor - * 3. the setting's default value: [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] + * 3. the setting's default value: + * [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] * 4. an empty value (defined as a `Value` with all fields unset) - * The data type of [Value][google.cloud.resourcesettings.v1.Value] must always be - * consistent with the data type defined in [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * The data type of [Value][google.cloud.resourcesettings.v1.Value] must + * always be consistent with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. * * Generated from protobuf field .google.cloud.resourcesettings.v1.Value effective_value = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ private $effective_value = null; /** * A fingerprint used for optimistic concurrency. See - * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] for more - * details. + * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] + * for more details. * * Generated from protobuf field string etag = 10; */ @@ -77,27 +83,33 @@ class Setting extends \Google\Protobuf\Internal\Message * * `organizations/{organization_id}/settings/{setting_name}` * For example, "/projects/123/settings/gcp-enableMyFeature" * @type \Google\Cloud\ResourceSettings\V1\SettingMetadata $metadata - * Output only. Metadata about a setting which is not editable by the end user. + * Output only. Metadata about a setting which is not editable by the end + * user. * @type \Google\Cloud\ResourceSettings\V1\Value $local_value * The configured value of the setting at the given parent resource (ignoring - * the resource hierarchy). The data type of [Value][google.cloud.resourcesettings.v1.Value] must always be - * consistent with the data type defined in [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * the resource hierarchy). The data type of + * [Value][google.cloud.resourcesettings.v1.Value] must always be consistent + * with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. * @type \Google\Cloud\ResourceSettings\V1\Value $effective_value - * Output only. The computed effective value of the setting at the given parent resource - * (based on the resource hierarchy). + * Output only. The computed effective value of the setting at the given + * parent resource (based on the resource hierarchy). * The effective value evaluates to one of the following options in the given * order (the next option is used if the previous one does not exist): - * 1. the local setting value on the given resource: [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] + * 1. the local setting value on the given resource: + * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] * 2. if one of the given resource's ancestors have a local setting value, * the local value at the nearest such ancestor - * 3. the setting's default value: [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] + * 3. the setting's default value: + * [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] * 4. an empty value (defined as a `Value` with all fields unset) - * The data type of [Value][google.cloud.resourcesettings.v1.Value] must always be - * consistent with the data type defined in [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * The data type of [Value][google.cloud.resourcesettings.v1.Value] must + * always be consistent with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. * @type string $etag * A fingerprint used for optimistic concurrency. See - * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] for more - * details. + * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] + * for more details. * } */ public function __construct($data = NULL) { @@ -140,7 +152,8 @@ public function setName($var) } /** - * Output only. Metadata about a setting which is not editable by the end user. + * Output only. Metadata about a setting which is not editable by the end + * user. * * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @return \Google\Cloud\ResourceSettings\V1\SettingMetadata|null @@ -161,7 +174,8 @@ public function clearMetadata() } /** - * Output only. Metadata about a setting which is not editable by the end user. + * Output only. Metadata about a setting which is not editable by the end + * user. * * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @param \Google\Cloud\ResourceSettings\V1\SettingMetadata $var @@ -177,8 +191,10 @@ public function setMetadata($var) /** * The configured value of the setting at the given parent resource (ignoring - * the resource hierarchy). The data type of [Value][google.cloud.resourcesettings.v1.Value] must always be - * consistent with the data type defined in [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * the resource hierarchy). The data type of + * [Value][google.cloud.resourcesettings.v1.Value] must always be consistent + * with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. * * Generated from protobuf field .google.cloud.resourcesettings.v1.Value local_value = 8; * @return \Google\Cloud\ResourceSettings\V1\Value|null @@ -200,8 +216,10 @@ public function clearLocalValue() /** * The configured value of the setting at the given parent resource (ignoring - * the resource hierarchy). The data type of [Value][google.cloud.resourcesettings.v1.Value] must always be - * consistent with the data type defined in [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * the resource hierarchy). The data type of + * [Value][google.cloud.resourcesettings.v1.Value] must always be consistent + * with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. * * Generated from protobuf field .google.cloud.resourcesettings.v1.Value local_value = 8; * @param \Google\Cloud\ResourceSettings\V1\Value $var @@ -216,17 +234,20 @@ public function setLocalValue($var) } /** - * Output only. The computed effective value of the setting at the given parent resource - * (based on the resource hierarchy). + * Output only. The computed effective value of the setting at the given + * parent resource (based on the resource hierarchy). * The effective value evaluates to one of the following options in the given * order (the next option is used if the previous one does not exist): - * 1. the local setting value on the given resource: [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] + * 1. the local setting value on the given resource: + * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] * 2. if one of the given resource's ancestors have a local setting value, * the local value at the nearest such ancestor - * 3. the setting's default value: [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] + * 3. the setting's default value: + * [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] * 4. an empty value (defined as a `Value` with all fields unset) - * The data type of [Value][google.cloud.resourcesettings.v1.Value] must always be - * consistent with the data type defined in [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * The data type of [Value][google.cloud.resourcesettings.v1.Value] must + * always be consistent with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. * * Generated from protobuf field .google.cloud.resourcesettings.v1.Value effective_value = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @return \Google\Cloud\ResourceSettings\V1\Value|null @@ -247,17 +268,20 @@ public function clearEffectiveValue() } /** - * Output only. The computed effective value of the setting at the given parent resource - * (based on the resource hierarchy). + * Output only. The computed effective value of the setting at the given + * parent resource (based on the resource hierarchy). * The effective value evaluates to one of the following options in the given * order (the next option is used if the previous one does not exist): - * 1. the local setting value on the given resource: [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] + * 1. the local setting value on the given resource: + * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] * 2. if one of the given resource's ancestors have a local setting value, * the local value at the nearest such ancestor - * 3. the setting's default value: [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] + * 3. the setting's default value: + * [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] * 4. an empty value (defined as a `Value` with all fields unset) - * The data type of [Value][google.cloud.resourcesettings.v1.Value] must always be - * consistent with the data type defined in [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. + * The data type of [Value][google.cloud.resourcesettings.v1.Value] must + * always be consistent with the data type defined in + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. * * Generated from protobuf field .google.cloud.resourcesettings.v1.Value effective_value = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @param \Google\Cloud\ResourceSettings\V1\Value $var @@ -273,8 +297,8 @@ public function setEffectiveValue($var) /** * A fingerprint used for optimistic concurrency. See - * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] for more - * details. + * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] + * for more details. * * Generated from protobuf field string etag = 10; * @return string @@ -286,8 +310,8 @@ public function getEtag() /** * A fingerprint used for optimistic concurrency. See - * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] for more - * details. + * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] + * for more details. * * Generated from protobuf field string etag = 10; * @param string $var diff --git a/ResourceSettings/src/V1/SettingMetadata.php b/ResourceSettings/src/V1/SettingMetadata.php index 1d7faac979f7..cf7f941b300f 100644 --- a/ResourceSettings/src/V1/SettingMetadata.php +++ b/ResourceSettings/src/V1/SettingMetadata.php @@ -41,8 +41,9 @@ class SettingMetadata extends \Google\Protobuf\Internal\Message */ private $data_type = 0; /** - * The value provided by [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] if no setting value is - * explicitly set. + * The value provided by + * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] + * if no setting value is explicitly set. * Note: not all settings have a default value. * * Generated from protobuf field .google.cloud.resourcesettings.v1.Value default_value = 5; @@ -65,8 +66,9 @@ class SettingMetadata extends \Google\Protobuf\Internal\Message * @type int $data_type * The data type for this setting. * @type \Google\Cloud\ResourceSettings\V1\Value $default_value - * The value provided by [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] if no setting value is - * explicitly set. + * The value provided by + * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] + * if no setting value is explicitly set. * Note: not all settings have a default value. * } */ @@ -182,8 +184,9 @@ public function setDataType($var) } /** - * The value provided by [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] if no setting value is - * explicitly set. + * The value provided by + * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] + * if no setting value is explicitly set. * Note: not all settings have a default value. * * Generated from protobuf field .google.cloud.resourcesettings.v1.Value default_value = 5; @@ -205,8 +208,9 @@ public function clearDefaultValue() } /** - * The value provided by [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] if no setting value is - * explicitly set. + * The value provided by + * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] + * if no setting value is explicitly set. * Note: not all settings have a default value. * * Generated from protobuf field .google.cloud.resourcesettings.v1.Value default_value = 5; diff --git a/ResourceSettings/src/V1/SettingMetadata/DataType.php b/ResourceSettings/src/V1/SettingMetadata/DataType.php index ee1b2fa553c5..69a636bedaa5 100644 --- a/ResourceSettings/src/V1/SettingMetadata/DataType.php +++ b/ResourceSettings/src/V1/SettingMetadata/DataType.php @@ -7,8 +7,9 @@ use UnexpectedValueException; /** - * The data type for setting values of this setting. See [Value][google.cloud.resourcesettings.v1.Value] for more - * details on the available data types. + * The data type for setting values of this setting. See + * [Value][google.cloud.resourcesettings.v1.Value] for more details on the + * available data types. * * Protobuf type google.cloud.resourcesettings.v1.SettingMetadata.DataType */ diff --git a/ResourceSettings/src/V1/SettingView.php b/ResourceSettings/src/V1/SettingView.php index f20206bdce88..80dad94f8b5f 100644 --- a/ResourceSettings/src/V1/SettingView.php +++ b/ResourceSettings/src/V1/SettingView.php @@ -21,20 +21,26 @@ class SettingView */ const SETTING_VIEW_UNSPECIFIED = 0; /** - * Include [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata], but nothing else. - * This is the default value (for both ListSettings and GetSetting). + * Include + * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata], but + * nothing else. This is the default value (for both ListSettings and + * GetSetting). * * Generated from protobuf enum SETTING_VIEW_BASIC = 1; */ const SETTING_VIEW_BASIC = 1; /** - * Include [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value], but nothing else. + * Include + * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value], + * but nothing else. * * Generated from protobuf enum SETTING_VIEW_EFFECTIVE_VALUE = 2; */ const SETTING_VIEW_EFFECTIVE_VALUE = 2; /** - * Include [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value], but nothing else. + * Include + * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value], + * but nothing else. * * Generated from protobuf enum SETTING_VIEW_LOCAL_VALUE = 3; */ diff --git a/ResourceSettings/src/V1/UpdateSettingRequest.php b/ResourceSettings/src/V1/UpdateSettingRequest.php index 7552b423dfa0..e3f37d99cb30 100644 --- a/ResourceSettings/src/V1/UpdateSettingRequest.php +++ b/ResourceSettings/src/V1/UpdateSettingRequest.php @@ -16,7 +16,8 @@ class UpdateSettingRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The setting to update. See [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. + * Required. The setting to update. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. * * Generated from protobuf field .google.cloud.resourcesettings.v1.Setting setting = 1 [(.google.api.field_behavior) = REQUIRED]; */ @@ -29,7 +30,8 @@ class UpdateSettingRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type \Google\Cloud\ResourceSettings\V1\Setting $setting - * Required. The setting to update. See [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. + * Required. The setting to update. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. * } */ public function __construct($data = NULL) { @@ -38,7 +40,8 @@ public function __construct($data = NULL) { } /** - * Required. The setting to update. See [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. + * Required. The setting to update. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. * * Generated from protobuf field .google.cloud.resourcesettings.v1.Setting setting = 1 [(.google.api.field_behavior) = REQUIRED]; * @return \Google\Cloud\ResourceSettings\V1\Setting|null @@ -59,7 +62,8 @@ public function clearSetting() } /** - * Required. The setting to update. See [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. + * Required. The setting to update. See + * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. * * Generated from protobuf field .google.cloud.resourcesettings.v1.Setting setting = 1 [(.google.api.field_behavior) = REQUIRED]; * @param \Google\Cloud\ResourceSettings\V1\Setting $var diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/GPBMetadata/Google/Cloud/Resourcesettings/V1/ResourceSettings.php b/owl-bot-staging/ResourceSettings/v1/proto/src/GPBMetadata/Google/Cloud/Resourcesettings/V1/ResourceSettings.php deleted file mode 100644 index 0ddd1d8f7c88c52b096800ab85dfa2b2b8b3fc65..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3819 zcmbVP&2Jk;6z|&k@=MaD(~r2JQnzkVoQSLy7ZBPst=5T?TFQsjIIgHHR%?6gENpg{ z-LXR&Swe8(h6G$Wa6|k9To8h5kLA`=4_xS9fKU(2&d#paPNKxkCF?iu{pP*j`&4tACR$x1 zT4kN#RaQK_%Huw~N_lY!pk`>UD+X&jd@ncxk^b4Os-f3JmuQ6kyQ{mZZt6tW4E-4m zb6IR?hKni4aotACtP$NZMbBW{tl{*W=wo`icWsN(vMdG;7CojYOO=92uw!aQWfi+M zN4JUP6sf8#H!%tM^(5&zzO4tRH^j8>qbwhDa#NJcX@)C?j!iO{&65vAGlv((58a{g4l0>|iC05K*e=$q##hGc2t=T#)d5dZn0%U(F^=lkPc@?7x81nieDTqQkfgZuwK5vZVD3y$77bPF(bRQ)S6?9ZC{z{3X z`!H@;HO)}ln$g0^F$PwdJsYj;>7zVc!gL_e{%B(kkr)iZcY}sU<7p< zKxH-{BpeZbkd$Rtq9Z61u(L=<$EVZ_H*>_lRI{~T#ZD&^m}ZXnm+JA@LFtBN)UiV? z{EyQ$-?yBmX6n!UmdPANf1YZU`aK4hxO)NP=qgOqb=NkuL*@ie<`o#P^ASONG8ywI zK$jumV6CoNrg4~zQ_&dOgoHNs~-BioU#%_LUDD_)cckq#kxT0!o=(inKqAydlQ7H{{Tj)Q@}H?61h}%HyM(9JeT+Y+2n5}L5nFTU z+~Ed^S4!+ZB@V*8S4y_l#HveAI#yl7h~|Nbi1isZS$QSU5)8F=YXQbNrpGk82}#;6CE7x2 zxsZR-*KF4T^{nQUox%$3I}vX7$n$G!`ISfC2WO`^s?VvK`EXD(zs6FXmkO`_um1Y``Wds)VOZL}tXFvC44DQkk&zZHAyVl>OMejXQ6rL9S%WH5;q?f0r6~4hZrEZ2g5qX*g zV!OK3ACX=CR}g-QiRUVI*?RQS^^e7gl>q(UEWuVZ(7AX#QevfK|P j%jL!D2&JD`_h!Sp{d@j{DDr+f_3gwo{WnerIspFz4MzrJ diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/GetSettingRequest.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/GetSettingRequest.php deleted file mode 100644 index c6eee9fa8d14..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/GetSettingRequest.php +++ /dev/null @@ -1,125 +0,0 @@ -google.cloud.resourcesettings.v1.GetSettingRequest - */ -class GetSettingRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the setting to get. See - * [Setting][google.cloud.resourcesettings.v1.Setting] for naming - * requirements. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * The SettingView for this request. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingView view = 2; - */ - protected $view = 0; - - /** - * @param string $name Required. The name of the setting to get. See - * [Setting][google.cloud.resourcesettings.v1.Setting] for naming - * requirements. Please see - * {@see ResourceSettingsServiceClient::settingName()} for help formatting this field. - * - * @return \Google\Cloud\ResourceSettings\V1\GetSettingRequest - * - * @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 name of the setting to get. See - * [Setting][google.cloud.resourcesettings.v1.Setting] for naming - * requirements. - * @type int $view - * The SettingView for this request. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the setting to get. See - * [Setting][google.cloud.resourcesettings.v1.Setting] for naming - * requirements. - * - * 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 name of the setting to get. See - * [Setting][google.cloud.resourcesettings.v1.Setting] for naming - * requirements. - * - * 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; - } - - /** - * The SettingView for this request. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingView view = 2; - * @return int - */ - public function getView() - { - return $this->view; - } - - /** - * The SettingView for this request. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingView view = 2; - * @param int $var - * @return $this - */ - public function setView($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\ResourceSettings\V1\SettingView::class); - $this->view = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsRequest.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsRequest.php deleted file mode 100644 index 55dbf4f3fa79..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsRequest.php +++ /dev/null @@ -1,208 +0,0 @@ -google.cloud.resourcesettings.v1.ListSettingsRequest - */ -class ListSettingsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The Cloud resource that parents the setting. Must be in one of - * the following forms: - * * `projects/{project_number}` - * * `projects/{project_id}` - * * `folders/{folder_id}` - * * `organizations/{organization_id}` - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Unused. The size of the page to be returned. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * Unused. A page token used to retrieve the next page. - * - * Generated from protobuf field string page_token = 3; - */ - protected $page_token = ''; - /** - * The SettingView for this request. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingView view = 4; - */ - protected $view = 0; - - /** - * @param string $parent Required. The Cloud resource that parents the setting. Must be in one of - * the following forms: - * - * * `projects/{project_number}` - * * `projects/{project_id}` - * * `folders/{folder_id}` - * * `organizations/{organization_id}` - * - * @return \Google\Cloud\ResourceSettings\V1\ListSettingsRequest - * - * @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 Cloud resource that parents the setting. Must be in one of - * the following forms: - * * `projects/{project_number}` - * * `projects/{project_id}` - * * `folders/{folder_id}` - * * `organizations/{organization_id}` - * @type int $page_size - * Unused. The size of the page to be returned. - * @type string $page_token - * Unused. A page token used to retrieve the next page. - * @type int $view - * The SettingView for this request. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); - parent::__construct($data); - } - - /** - * Required. The Cloud resource that parents the setting. Must be in one of - * the following forms: - * * `projects/{project_number}` - * * `projects/{project_id}` - * * `folders/{folder_id}` - * * `organizations/{organization_id}` - * - * 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 Cloud resource that parents the setting. Must be in one of - * the following forms: - * * `projects/{project_number}` - * * `projects/{project_id}` - * * `folders/{folder_id}` - * * `organizations/{organization_id}` - * - * 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; - } - - /** - * Unused. The size of the page to be returned. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Unused. The size of the page to be returned. - * - * 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; - } - - /** - * Unused. A page token used to retrieve the next page. - * - * Generated from protobuf field string page_token = 3; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * Unused. A page token used to retrieve the next page. - * - * 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; - } - - /** - * The SettingView for this request. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingView view = 4; - * @return int - */ - public function getView() - { - return $this->view; - } - - /** - * The SettingView for this request. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingView view = 4; - * @param int $var - * @return $this - */ - public function setView($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\ResourceSettings\V1\SettingView::class); - $this->view = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsResponse.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsResponse.php deleted file mode 100644 index 7b1ed2d089dc..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/ListSettingsResponse.php +++ /dev/null @@ -1,101 +0,0 @@ -google.cloud.resourcesettings.v1.ListSettingsResponse - */ -class ListSettingsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * A list of settings that are available at the specified Cloud resource. - * - * Generated from protobuf field repeated .google.cloud.resourcesettings.v1.Setting settings = 1; - */ - private $settings; - /** - * Unused. A page token used to retrieve the next page. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\ResourceSettings\V1\Setting>|\Google\Protobuf\Internal\RepeatedField $settings - * A list of settings that are available at the specified Cloud resource. - * @type string $next_page_token - * Unused. A page token used to retrieve the next page. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); - parent::__construct($data); - } - - /** - * A list of settings that are available at the specified Cloud resource. - * - * Generated from protobuf field repeated .google.cloud.resourcesettings.v1.Setting settings = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSettings() - { - return $this->settings; - } - - /** - * A list of settings that are available at the specified Cloud resource. - * - * Generated from protobuf field repeated .google.cloud.resourcesettings.v1.Setting settings = 1; - * @param array<\Google\Cloud\ResourceSettings\V1\Setting>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSettings($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ResourceSettings\V1\Setting::class); - $this->settings = $arr; - - return $this; - } - - /** - * Unused. A page token used to retrieve the next page. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * Unused. A page token used to retrieve the next page. - * - * 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; - } - -} - diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Setting.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Setting.php deleted file mode 100644 index 5f66a0f43113..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Setting.php +++ /dev/null @@ -1,329 +0,0 @@ -google.cloud.resourcesettings.v1.Setting - */ -class Setting extends \Google\Protobuf\Internal\Message -{ - /** - * The resource name of the setting. Must be in one of the following forms: - * * `projects/{project_number}/settings/{setting_name}` - * * `folders/{folder_id}/settings/{setting_name}` - * * `organizations/{organization_id}/settings/{setting_name}` - * For example, "/projects/123/settings/gcp-enableMyFeature" - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * Output only. Metadata about a setting which is not editable by the end - * user. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $metadata = null; - /** - * The configured value of the setting at the given parent resource (ignoring - * the resource hierarchy). The data type of - * [Value][google.cloud.resourcesettings.v1.Value] must always be consistent - * with the data type defined in - * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value local_value = 8; - */ - protected $local_value = null; - /** - * Output only. The computed effective value of the setting at the given - * parent resource (based on the resource hierarchy). - * The effective value evaluates to one of the following options in the given - * order (the next option is used if the previous one does not exist): - * 1. the local setting value on the given resource: - * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] - * 2. if one of the given resource's ancestors have a local setting value, - * the local value at the nearest such ancestor - * 3. the setting's default value: - * [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] - * 4. an empty value (defined as a `Value` with all fields unset) - * The data type of [Value][google.cloud.resourcesettings.v1.Value] must - * always be consistent with the data type defined in - * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value effective_value = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $effective_value = null; - /** - * A fingerprint used for optimistic concurrency. See - * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] - * for more details. - * - * Generated from protobuf field string etag = 10; - */ - protected $etag = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The resource name of the setting. Must be in one of the following forms: - * * `projects/{project_number}/settings/{setting_name}` - * * `folders/{folder_id}/settings/{setting_name}` - * * `organizations/{organization_id}/settings/{setting_name}` - * For example, "/projects/123/settings/gcp-enableMyFeature" - * @type \Google\Cloud\ResourceSettings\V1\SettingMetadata $metadata - * Output only. Metadata about a setting which is not editable by the end - * user. - * @type \Google\Cloud\ResourceSettings\V1\Value $local_value - * The configured value of the setting at the given parent resource (ignoring - * the resource hierarchy). The data type of - * [Value][google.cloud.resourcesettings.v1.Value] must always be consistent - * with the data type defined in - * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. - * @type \Google\Cloud\ResourceSettings\V1\Value $effective_value - * Output only. The computed effective value of the setting at the given - * parent resource (based on the resource hierarchy). - * The effective value evaluates to one of the following options in the given - * order (the next option is used if the previous one does not exist): - * 1. the local setting value on the given resource: - * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] - * 2. if one of the given resource's ancestors have a local setting value, - * the local value at the nearest such ancestor - * 3. the setting's default value: - * [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] - * 4. an empty value (defined as a `Value` with all fields unset) - * The data type of [Value][google.cloud.resourcesettings.v1.Value] must - * always be consistent with the data type defined in - * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. - * @type string $etag - * A fingerprint used for optimistic concurrency. See - * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] - * for more details. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); - parent::__construct($data); - } - - /** - * The resource name of the setting. Must be in one of the following forms: - * * `projects/{project_number}/settings/{setting_name}` - * * `folders/{folder_id}/settings/{setting_name}` - * * `organizations/{organization_id}/settings/{setting_name}` - * For example, "/projects/123/settings/gcp-enableMyFeature" - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The resource name of the setting. Must be in one of the following forms: - * * `projects/{project_number}/settings/{setting_name}` - * * `folders/{folder_id}/settings/{setting_name}` - * * `organizations/{organization_id}/settings/{setting_name}` - * For example, "/projects/123/settings/gcp-enableMyFeature" - * - * 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; - } - - /** - * Output only. Metadata about a setting which is not editable by the end - * user. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Cloud\ResourceSettings\V1\SettingMetadata|null - */ - public function getMetadata() - { - return $this->metadata; - } - - public function hasMetadata() - { - return isset($this->metadata); - } - - public function clearMetadata() - { - unset($this->metadata); - } - - /** - * Output only. Metadata about a setting which is not editable by the end - * user. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Cloud\ResourceSettings\V1\SettingMetadata $var - * @return $this - */ - public function setMetadata($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\SettingMetadata::class); - $this->metadata = $var; - - return $this; - } - - /** - * The configured value of the setting at the given parent resource (ignoring - * the resource hierarchy). The data type of - * [Value][google.cloud.resourcesettings.v1.Value] must always be consistent - * with the data type defined in - * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value local_value = 8; - * @return \Google\Cloud\ResourceSettings\V1\Value|null - */ - public function getLocalValue() - { - return $this->local_value; - } - - public function hasLocalValue() - { - return isset($this->local_value); - } - - public function clearLocalValue() - { - unset($this->local_value); - } - - /** - * The configured value of the setting at the given parent resource (ignoring - * the resource hierarchy). The data type of - * [Value][google.cloud.resourcesettings.v1.Value] must always be consistent - * with the data type defined in - * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value local_value = 8; - * @param \Google\Cloud\ResourceSettings\V1\Value $var - * @return $this - */ - public function setLocalValue($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\Value::class); - $this->local_value = $var; - - return $this; - } - - /** - * Output only. The computed effective value of the setting at the given - * parent resource (based on the resource hierarchy). - * The effective value evaluates to one of the following options in the given - * order (the next option is used if the previous one does not exist): - * 1. the local setting value on the given resource: - * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] - * 2. if one of the given resource's ancestors have a local setting value, - * the local value at the nearest such ancestor - * 3. the setting's default value: - * [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] - * 4. an empty value (defined as a `Value` with all fields unset) - * The data type of [Value][google.cloud.resourcesettings.v1.Value] must - * always be consistent with the data type defined in - * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value effective_value = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Cloud\ResourceSettings\V1\Value|null - */ - public function getEffectiveValue() - { - return $this->effective_value; - } - - public function hasEffectiveValue() - { - return isset($this->effective_value); - } - - public function clearEffectiveValue() - { - unset($this->effective_value); - } - - /** - * Output only. The computed effective value of the setting at the given - * parent resource (based on the resource hierarchy). - * The effective value evaluates to one of the following options in the given - * order (the next option is used if the previous one does not exist): - * 1. the local setting value on the given resource: - * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value] - * 2. if one of the given resource's ancestors have a local setting value, - * the local value at the nearest such ancestor - * 3. the setting's default value: - * [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value] - * 4. an empty value (defined as a `Value` with all fields unset) - * The data type of [Value][google.cloud.resourcesettings.v1.Value] must - * always be consistent with the data type defined in - * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata]. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value effective_value = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Cloud\ResourceSettings\V1\Value $var - * @return $this - */ - public function setEffectiveValue($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\Value::class); - $this->effective_value = $var; - - return $this; - } - - /** - * A fingerprint used for optimistic concurrency. See - * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] - * for more details. - * - * Generated from protobuf field string etag = 10; - * @return string - */ - public function getEtag() - { - return $this->etag; - } - - /** - * A fingerprint used for optimistic concurrency. See - * [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] - * for more details. - * - * Generated from protobuf field string etag = 10; - * @param string $var - * @return $this - */ - public function setEtag($var) - { - GPBUtil::checkString($var, True); - $this->etag = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata.php deleted file mode 100644 index 0c7450691b76..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata.php +++ /dev/null @@ -1,229 +0,0 @@ -google.cloud.resourcesettings.v1.SettingMetadata - */ -class SettingMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The human readable name for this setting. - * - * Generated from protobuf field string display_name = 1; - */ - protected $display_name = ''; - /** - * A detailed description of what this setting does. - * - * Generated from protobuf field string description = 2; - */ - protected $description = ''; - /** - * A flag indicating that values of this setting cannot be modified (see - * documentation of the specific setting for updates and reasons). - * - * Generated from protobuf field bool read_only = 3; - */ - protected $read_only = false; - /** - * The data type for this setting. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata.DataType data_type = 4; - */ - protected $data_type = 0; - /** - * The value provided by - * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] - * if no setting value is explicitly set. - * Note: not all settings have a default value. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value default_value = 5; - */ - protected $default_value = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $display_name - * The human readable name for this setting. - * @type string $description - * A detailed description of what this setting does. - * @type bool $read_only - * A flag indicating that values of this setting cannot be modified (see - * documentation of the specific setting for updates and reasons). - * @type int $data_type - * The data type for this setting. - * @type \Google\Cloud\ResourceSettings\V1\Value $default_value - * The value provided by - * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] - * if no setting value is explicitly set. - * Note: not all settings have a default value. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); - parent::__construct($data); - } - - /** - * The human readable name for this setting. - * - * Generated from protobuf field string display_name = 1; - * @return string - */ - public function getDisplayName() - { - return $this->display_name; - } - - /** - * The human readable name for this setting. - * - * 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; - } - - /** - * A detailed description of what this setting does. - * - * Generated from protobuf field string description = 2; - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * A detailed description of what this setting does. - * - * Generated from protobuf field string description = 2; - * @param string $var - * @return $this - */ - public function setDescription($var) - { - GPBUtil::checkString($var, True); - $this->description = $var; - - return $this; - } - - /** - * A flag indicating that values of this setting cannot be modified (see - * documentation of the specific setting for updates and reasons). - * - * Generated from protobuf field bool read_only = 3; - * @return bool - */ - public function getReadOnly() - { - return $this->read_only; - } - - /** - * A flag indicating that values of this setting cannot be modified (see - * documentation of the specific setting for updates and reasons). - * - * Generated from protobuf field bool read_only = 3; - * @param bool $var - * @return $this - */ - public function setReadOnly($var) - { - GPBUtil::checkBool($var); - $this->read_only = $var; - - return $this; - } - - /** - * The data type for this setting. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata.DataType data_type = 4; - * @return int - */ - public function getDataType() - { - return $this->data_type; - } - - /** - * The data type for this setting. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.SettingMetadata.DataType data_type = 4; - * @param int $var - * @return $this - */ - public function setDataType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\ResourceSettings\V1\SettingMetadata\DataType::class); - $this->data_type = $var; - - return $this; - } - - /** - * The value provided by - * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] - * if no setting value is explicitly set. - * Note: not all settings have a default value. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value default_value = 5; - * @return \Google\Cloud\ResourceSettings\V1\Value|null - */ - public function getDefaultValue() - { - return $this->default_value; - } - - public function hasDefaultValue() - { - return isset($this->default_value); - } - - public function clearDefaultValue() - { - unset($this->default_value); - } - - /** - * The value provided by - * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] - * if no setting value is explicitly set. - * Note: not all settings have a default value. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value default_value = 5; - * @param \Google\Cloud\ResourceSettings\V1\Value $var - * @return $this - */ - public function setDefaultValue($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\Value::class); - $this->default_value = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata/DataType.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata/DataType.php deleted file mode 100644 index 933bb281ab6a..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingMetadata/DataType.php +++ /dev/null @@ -1,80 +0,0 @@ -google.cloud.resourcesettings.v1.SettingMetadata.DataType - */ -class DataType -{ - /** - * Unspecified data type. - * - * Generated from protobuf enum DATA_TYPE_UNSPECIFIED = 0; - */ - const DATA_TYPE_UNSPECIFIED = 0; - /** - * A boolean setting. - * - * Generated from protobuf enum BOOLEAN = 1; - */ - const BOOLEAN = 1; - /** - * A string setting. - * - * Generated from protobuf enum STRING = 2; - */ - const STRING = 2; - /** - * A string set setting. - * - * Generated from protobuf enum STRING_SET = 3; - */ - const STRING_SET = 3; - /** - * A Enum setting - * - * Generated from protobuf enum ENUM_VALUE = 4; - */ - const ENUM_VALUE = 4; - - private static $valueToName = [ - self::DATA_TYPE_UNSPECIFIED => 'DATA_TYPE_UNSPECIFIED', - self::BOOLEAN => 'BOOLEAN', - self::STRING => 'STRING', - self::STRING_SET => 'STRING_SET', - self::ENUM_VALUE => 'ENUM_VALUE', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(DataType::class, \Google\Cloud\ResourceSettings\V1\SettingMetadata_DataType::class); - diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingView.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingView.php deleted file mode 100644 index 80dad94f8b5f..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/SettingView.php +++ /dev/null @@ -1,76 +0,0 @@ -google.cloud.resourcesettings.v1.SettingView - */ -class SettingView -{ - /** - * The default / unset value. - * The API will default to the SETTING_VIEW_BASIC view. - * - * Generated from protobuf enum SETTING_VIEW_UNSPECIFIED = 0; - */ - const SETTING_VIEW_UNSPECIFIED = 0; - /** - * Include - * [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata], but - * nothing else. This is the default value (for both ListSettings and - * GetSetting). - * - * Generated from protobuf enum SETTING_VIEW_BASIC = 1; - */ - const SETTING_VIEW_BASIC = 1; - /** - * Include - * [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value], - * but nothing else. - * - * Generated from protobuf enum SETTING_VIEW_EFFECTIVE_VALUE = 2; - */ - const SETTING_VIEW_EFFECTIVE_VALUE = 2; - /** - * Include - * [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value], - * but nothing else. - * - * Generated from protobuf enum SETTING_VIEW_LOCAL_VALUE = 3; - */ - const SETTING_VIEW_LOCAL_VALUE = 3; - - private static $valueToName = [ - self::SETTING_VIEW_UNSPECIFIED => 'SETTING_VIEW_UNSPECIFIED', - self::SETTING_VIEW_BASIC => 'SETTING_VIEW_BASIC', - self::SETTING_VIEW_EFFECTIVE_VALUE => 'SETTING_VIEW_EFFECTIVE_VALUE', - self::SETTING_VIEW_LOCAL_VALUE => 'SETTING_VIEW_LOCAL_VALUE', - ]; - - 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/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/UpdateSettingRequest.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/UpdateSettingRequest.php deleted file mode 100644 index 9f21c56b4550..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/UpdateSettingRequest.php +++ /dev/null @@ -1,81 +0,0 @@ -google.cloud.resourcesettings.v1.UpdateSettingRequest - */ -class UpdateSettingRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The setting to update. See - * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Setting setting = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $setting = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\ResourceSettings\V1\Setting $setting - * Required. The setting to update. See - * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); - parent::__construct($data); - } - - /** - * Required. The setting to update. See - * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Setting setting = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\ResourceSettings\V1\Setting|null - */ - public function getSetting() - { - return $this->setting; - } - - public function hasSetting() - { - return isset($this->setting); - } - - public function clearSetting() - { - unset($this->setting); - } - - /** - * Required. The setting to update. See - * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Setting setting = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\ResourceSettings\V1\Setting $var - * @return $this - */ - public function setSetting($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\Setting::class); - $this->setting = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value.php deleted file mode 100644 index e43966d7129a..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value.php +++ /dev/null @@ -1,174 +0,0 @@ -google.cloud.resourcesettings.v1.Value - */ -class Value extends \Google\Protobuf\Internal\Message -{ - protected $value; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type bool $boolean_value - * Defines this value as being a boolean value. - * @type string $string_value - * Defines this value as being a string value. - * @type \Google\Cloud\ResourceSettings\V1\Value\StringSet $string_set_value - * Defines this value as being a StringSet. - * @type \Google\Cloud\ResourceSettings\V1\Value\EnumValue $enum_value - * Defines this value as being a Enum. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); - parent::__construct($data); - } - - /** - * Defines this value as being a boolean value. - * - * Generated from protobuf field bool boolean_value = 1; - * @return bool - */ - public function getBooleanValue() - { - return $this->readOneof(1); - } - - public function hasBooleanValue() - { - return $this->hasOneof(1); - } - - /** - * Defines this value as being a boolean value. - * - * Generated from protobuf field bool boolean_value = 1; - * @param bool $var - * @return $this - */ - public function setBooleanValue($var) - { - GPBUtil::checkBool($var); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * Defines this value as being a string value. - * - * Generated from protobuf field string string_value = 2; - * @return string - */ - public function getStringValue() - { - return $this->readOneof(2); - } - - public function hasStringValue() - { - return $this->hasOneof(2); - } - - /** - * Defines this value as being a string value. - * - * Generated from protobuf field string string_value = 2; - * @param string $var - * @return $this - */ - public function setStringValue($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Defines this value as being a StringSet. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value.StringSet string_set_value = 3; - * @return \Google\Cloud\ResourceSettings\V1\Value\StringSet|null - */ - public function getStringSetValue() - { - return $this->readOneof(3); - } - - public function hasStringSetValue() - { - return $this->hasOneof(3); - } - - /** - * Defines this value as being a StringSet. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value.StringSet string_set_value = 3; - * @param \Google\Cloud\ResourceSettings\V1\Value\StringSet $var - * @return $this - */ - public function setStringSetValue($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\Value\StringSet::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Defines this value as being a Enum. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value.EnumValue enum_value = 4; - * @return \Google\Cloud\ResourceSettings\V1\Value\EnumValue|null - */ - public function getEnumValue() - { - return $this->readOneof(4); - } - - public function hasEnumValue() - { - return $this->hasOneof(4); - } - - /** - * Defines this value as being a Enum. - * - * Generated from protobuf field .google.cloud.resourcesettings.v1.Value.EnumValue enum_value = 4; - * @param \Google\Cloud\ResourceSettings\V1\Value\EnumValue $var - * @return $this - */ - public function setEnumValue($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\ResourceSettings\V1\Value\EnumValue::class); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * @return string - */ - public function getValue() - { - return $this->whichOneof("value"); - } - -} - diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/EnumValue.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/EnumValue.php deleted file mode 100644 index b1b28bd71728..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/EnumValue.php +++ /dev/null @@ -1,72 +0,0 @@ -google.cloud.resourcesettings.v1.Value.EnumValue - */ -class EnumValue extends \Google\Protobuf\Internal\Message -{ - /** - * The value of this enum - * - * Generated from protobuf field string value = 1; - */ - protected $value = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $value - * The value of this enum - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); - parent::__construct($data); - } - - /** - * The value of this enum - * - * Generated from protobuf field string value = 1; - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * The value of this enum - * - * Generated from protobuf field string value = 1; - * @param string $var - * @return $this - */ - public function setValue($var) - { - GPBUtil::checkString($var, True); - $this->value = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(EnumValue::class, \Google\Cloud\ResourceSettings\V1\Value_EnumValue::class); - diff --git a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/StringSet.php b/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/StringSet.php deleted file mode 100644 index 2639831851a8..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/proto/src/Google/Cloud/ResourceSettings/V1/Value/StringSet.php +++ /dev/null @@ -1,72 +0,0 @@ -google.cloud.resourcesettings.v1.Value.StringSet - */ -class StringSet extends \Google\Protobuf\Internal\Message -{ - /** - * The strings in the set - * - * Generated from protobuf field repeated string values = 1; - */ - private $values; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $values - * The strings in the set - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Resourcesettings\V1\ResourceSettings::initOnce(); - parent::__construct($data); - } - - /** - * The strings in the set - * - * Generated from protobuf field repeated string values = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getValues() - { - return $this->values; - } - - /** - * The strings in the set - * - * Generated from protobuf field repeated string values = 1; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setValues($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->values = $arr; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(StringSet::class, \Google\Cloud\ResourceSettings\V1\Value_StringSet::class); - diff --git a/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/get_setting.php b/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/get_setting.php deleted file mode 100644 index 9e69e9c6355b..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/get_setting.php +++ /dev/null @@ -1,76 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var Setting $response */ - $response = $resourceSettingsServiceClient->getSetting($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 = ResourceSettingsServiceClient::settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); - - get_setting_sample($formattedName); -} -// [END resourcesettings_v1_generated_ResourceSettingsService_GetSetting_sync] diff --git a/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/list_settings.php b/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/list_settings.php deleted file mode 100644 index eae0ab609c4b..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/list_settings.php +++ /dev/null @@ -1,81 +0,0 @@ -setParent($parent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $resourceSettingsServiceClient->listSettings($request); - - /** @var Setting $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 -{ - $parent = '[PARENT]'; - - list_settings_sample($parent); -} -// [END resourcesettings_v1_generated_ResourceSettingsService_ListSettings_sync] diff --git a/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/update_setting.php b/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/update_setting.php deleted file mode 100644 index 69c6244265cf..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/samples/V1/ResourceSettingsServiceClient/update_setting.php +++ /dev/null @@ -1,74 +0,0 @@ -setSetting($setting); - - // Call the API and handle any network failures. - try { - /** @var Setting $response */ - $response = $resourceSettingsServiceClient->updateSetting($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} -// [END resourcesettings_v1_generated_ResourceSettingsService_UpdateSetting_sync] diff --git a/owl-bot-staging/ResourceSettings/v1/src/V1/Client/ResourceSettingsServiceClient.php b/owl-bot-staging/ResourceSettings/v1/src/V1/Client/ResourceSettingsServiceClient.php deleted file mode 100644 index c59c18c08bb7..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/src/V1/Client/ResourceSettingsServiceClient.php +++ /dev/null @@ -1,383 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/resource_settings_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/resource_settings_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/resource_settings_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/resource_settings_service_rest_client_config.php', - ], - ], - ]; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * folder_setting_name resource. - * - * @param string $folder - * @param string $settingName - * - * @return string The formatted folder_setting_name resource. - */ - public static function folderSettingNameName(string $folder, string $settingName): string - { - return self::getPathTemplate('folderSettingName')->render([ - 'folder' => $folder, - 'setting_name' => $settingName, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * organization_setting_name resource. - * - * @param string $organization - * @param string $settingName - * - * @return string The formatted organization_setting_name resource. - */ - public static function organizationSettingNameName(string $organization, string $settingName): string - { - return self::getPathTemplate('organizationSettingName')->render([ - 'organization' => $organization, - 'setting_name' => $settingName, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_number_setting_name resource. - * - * @param string $projectNumber - * @param string $settingName - * - * @return string The formatted project_number_setting_name resource. - */ - public static function projectNumberSettingNameName(string $projectNumber, string $settingName): string - { - return self::getPathTemplate('projectNumberSettingName')->render([ - 'project_number' => $projectNumber, - 'setting_name' => $settingName, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a setting - * resource. - * - * @param string $projectNumber - * @param string $settingName - * - * @return string The formatted setting resource. - */ - public static function settingName(string $projectNumber, string $settingName): string - { - return self::getPathTemplate('setting')->render([ - 'project_number' => $projectNumber, - 'setting_name' => $settingName, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - folderSettingName: folders/{folder}/settings/{setting_name} - * - organizationSettingName: organizations/{organization}/settings/{setting_name} - * - projectNumberSettingName: projects/{project_number}/settings/{setting_name} - * - setting: projects/{project_number}/settings/{setting_name} - * - * 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 'resourcesettings.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 setting. - * - * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the - * setting does not exist. - * - * The async variant is {@see ResourceSettingsServiceClient::getSettingAsync()} . - * - * @example samples/V1/ResourceSettingsServiceClient/get_setting.php - * - * @param GetSettingRequest $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 Setting - * - * @throws ApiException Thrown if the API call fails. - */ - public function getSetting(GetSettingRequest $request, array $callOptions = []): Setting - { - return $this->startApiCall('GetSetting', $request, $callOptions)->wait(); - } - - /** - * Lists all the settings that are available on the Cloud resource `parent`. - * - * The async variant is {@see ResourceSettingsServiceClient::listSettingsAsync()} . - * - * @example samples/V1/ResourceSettingsServiceClient/list_settings.php - * - * @param ListSettingsRequest $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 listSettings(ListSettingsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListSettings', $request, $callOptions); - } - - /** - * Updates a setting. - * - * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the - * setting does not exist. - * Returns a `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if - * the setting is flagged as read only. - * Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag - * supplied in the request does not match the persisted etag of the setting - * value. - * - * On success, the response will contain only `name`, `local_value` and - * `etag`. The `metadata` and `effective_value` cannot be updated through - * this API. - * - * Note: the supplied setting will perform a full overwrite of the - * `local_value` field. - * - * The async variant is {@see ResourceSettingsServiceClient::updateSettingAsync()} - * . - * - * @example samples/V1/ResourceSettingsServiceClient/update_setting.php - * - * @param UpdateSettingRequest $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 Setting - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateSetting(UpdateSettingRequest $request, array $callOptions = []): Setting - { - return $this->startApiCall('UpdateSetting', $request, $callOptions)->wait(); - } -} diff --git a/owl-bot-staging/ResourceSettings/v1/src/V1/Gapic/ResourceSettingsServiceGapicClient.php b/owl-bot-staging/ResourceSettings/v1/src/V1/Gapic/ResourceSettingsServiceGapicClient.php deleted file mode 100644 index aa3d95bc24c1..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/src/V1/Gapic/ResourceSettingsServiceGapicClient.php +++ /dev/null @@ -1,545 +0,0 @@ -settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); - * $response = $resourceSettingsServiceClient->getSetting($formattedName); - * } finally { - * $resourceSettingsServiceClient->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. - * - * @deprecated Please use the new service client {@see \Google\Cloud\ResourceSettings\V1\Client\ResourceSettingsServiceClient}. - */ -class ResourceSettingsServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.resourcesettings.v1.ResourceSettingsService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'resourcesettings.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'resourcesettings.UNIVERSE_DOMAIN'; - - /** 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 $folderSettingNameNameTemplate; - - private static $organizationSettingNameNameTemplate; - - private static $projectNumberSettingNameNameTemplate; - - private static $settingNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/resource_settings_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/resource_settings_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/resource_settings_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/resource_settings_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getFolderSettingNameNameTemplate() - { - if (self::$folderSettingNameNameTemplate == null) { - self::$folderSettingNameNameTemplate = new PathTemplate('folders/{folder}/settings/{setting_name}'); - } - - return self::$folderSettingNameNameTemplate; - } - - private static function getOrganizationSettingNameNameTemplate() - { - if (self::$organizationSettingNameNameTemplate == null) { - self::$organizationSettingNameNameTemplate = new PathTemplate('organizations/{organization}/settings/{setting_name}'); - } - - return self::$organizationSettingNameNameTemplate; - } - - private static function getProjectNumberSettingNameNameTemplate() - { - if (self::$projectNumberSettingNameNameTemplate == null) { - self::$projectNumberSettingNameNameTemplate = new PathTemplate('projects/{project_number}/settings/{setting_name}'); - } - - return self::$projectNumberSettingNameNameTemplate; - } - - private static function getSettingNameTemplate() - { - if (self::$settingNameTemplate == null) { - self::$settingNameTemplate = new PathTemplate('projects/{project_number}/settings/{setting_name}'); - } - - return self::$settingNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'folderSettingName' => self::getFolderSettingNameNameTemplate(), - 'organizationSettingName' => self::getOrganizationSettingNameNameTemplate(), - 'projectNumberSettingName' => self::getProjectNumberSettingNameNameTemplate(), - 'setting' => self::getSettingNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * folder_setting_name resource. - * - * @param string $folder - * @param string $settingName - * - * @return string The formatted folder_setting_name resource. - */ - public static function folderSettingNameName($folder, $settingName) - { - return self::getFolderSettingNameNameTemplate()->render([ - 'folder' => $folder, - 'setting_name' => $settingName, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * organization_setting_name resource. - * - * @param string $organization - * @param string $settingName - * - * @return string The formatted organization_setting_name resource. - */ - public static function organizationSettingNameName($organization, $settingName) - { - return self::getOrganizationSettingNameNameTemplate()->render([ - 'organization' => $organization, - 'setting_name' => $settingName, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * project_number_setting_name resource. - * - * @param string $projectNumber - * @param string $settingName - * - * @return string The formatted project_number_setting_name resource. - */ - public static function projectNumberSettingNameName($projectNumber, $settingName) - { - return self::getProjectNumberSettingNameNameTemplate()->render([ - 'project_number' => $projectNumber, - 'setting_name' => $settingName, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a setting - * resource. - * - * @param string $projectNumber - * @param string $settingName - * - * @return string The formatted setting resource. - */ - public static function settingName($projectNumber, $settingName) - { - return self::getSettingNameTemplate()->render([ - 'project_number' => $projectNumber, - 'setting_name' => $settingName, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - folderSettingName: folders/{folder}/settings/{setting_name} - * - organizationSettingName: organizations/{organization}/settings/{setting_name} - * - projectNumberSettingName: projects/{project_number}/settings/{setting_name} - * - setting: projects/{project_number}/settings/{setting_name} - * - * 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 'resourcesettings.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 setting. - * - * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the - * setting does not exist. - * - * Sample code: - * ``` - * $resourceSettingsServiceClient = new ResourceSettingsServiceClient(); - * try { - * $formattedName = $resourceSettingsServiceClient->settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); - * $response = $resourceSettingsServiceClient->getSetting($formattedName); - * } finally { - * $resourceSettingsServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the setting to get. See - * [Setting][google.cloud.resourcesettings.v1.Setting] for naming - * requirements. - * @param array $optionalArgs { - * Optional. - * - * @type int $view - * The SettingView for this request. - * For allowed values, use constants defined on {@see \Google\Cloud\ResourceSettings\V1\SettingView} - * @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\ResourceSettings\V1\Setting - * - * @throws ApiException if the remote call fails - */ - public function getSetting($name, array $optionalArgs = []) - { - $request = new GetSettingRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['view'])) { - $request->setView($optionalArgs['view']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetSetting', Setting::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists all the settings that are available on the Cloud resource `parent`. - * - * Sample code: - * ``` - * $resourceSettingsServiceClient = new ResourceSettingsServiceClient(); - * try { - * $parent = 'parent'; - * // Iterate over pages of elements - * $pagedResponse = $resourceSettingsServiceClient->listSettings($parent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $resourceSettingsServiceClient->listSettings($parent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $resourceSettingsServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The Cloud resource that parents the setting. Must be in one of - * the following forms: - * - * * `projects/{project_number}` - * * `projects/{project_id}` - * * `folders/{folder_id}` - * * `organizations/{organization_id}` - * @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 - * The SettingView for this request. - * For allowed values, use constants defined on {@see \Google\Cloud\ResourceSettings\V1\SettingView} - * @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 listSettings($parent, array $optionalArgs = []) - { - $request = new ListSettingsRequest(); - $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']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListSettings', $optionalArgs, ListSettingsResponse::class, $request); - } - - /** - * Updates a setting. - * - * Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the - * setting does not exist. - * Returns a `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if - * the setting is flagged as read only. - * Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag - * supplied in the request does not match the persisted etag of the setting - * value. - * - * On success, the response will contain only `name`, `local_value` and - * `etag`. The `metadata` and `effective_value` cannot be updated through - * this API. - * - * Note: the supplied setting will perform a full overwrite of the - * `local_value` field. - * - * Sample code: - * ``` - * $resourceSettingsServiceClient = new ResourceSettingsServiceClient(); - * try { - * $setting = new Setting(); - * $response = $resourceSettingsServiceClient->updateSetting($setting); - * } finally { - * $resourceSettingsServiceClient->close(); - * } - * ``` - * - * @param Setting $setting Required. The setting to update. See - * [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements. - * @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\ResourceSettings\V1\Setting - * - * @throws ApiException if the remote call fails - */ - public function updateSetting($setting, array $optionalArgs = []) - { - $request = new UpdateSettingRequest(); - $requestParamHeaders = []; - $request->setSetting($setting); - $requestParamHeaders['setting.name'] = $setting->getName(); - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('UpdateSetting', Setting::class, $optionalArgs, $request)->wait(); - } -} diff --git a/owl-bot-staging/ResourceSettings/v1/src/V1/ResourceSettingsServiceClient.php b/owl-bot-staging/ResourceSettings/v1/src/V1/ResourceSettingsServiceClient.php deleted file mode 100644 index 83b4d8c98b05..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/src/V1/ResourceSettingsServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ - [ - 'google.cloud.resourcesettings.v1.ResourceSettingsService' => [ - 'GetSetting' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\ResourceSettings\V1\Setting', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'ListSettings' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getSettings', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\ResourceSettings\V1\ListSettingsResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'UpdateSetting' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\ResourceSettings\V1\Setting', - 'headerParams' => [ - [ - 'keyName' => 'setting.name', - 'fieldAccessors' => [ - 'getSetting', - 'getName', - ], - ], - ], - ], - 'templateMap' => [ - 'folderSettingName' => 'folders/{folder}/settings/{setting_name}', - 'organizationSettingName' => 'organizations/{organization}/settings/{setting_name}', - 'projectNumberSettingName' => 'projects/{project_number}/settings/{setting_name}', - 'setting' => 'projects/{project_number}/settings/{setting_name}', - ], - ], - ], -]; diff --git a/owl-bot-staging/ResourceSettings/v1/src/V1/resources/resource_settings_service_rest_client_config.php b/owl-bot-staging/ResourceSettings/v1/src/V1/resources/resource_settings_service_rest_client_config.php deleted file mode 100644 index af1aea760155..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/src/V1/resources/resource_settings_service_rest_client_config.php +++ /dev/null @@ -1,96 +0,0 @@ - [ - 'google.cloud.resourcesettings.v1.ResourceSettingsService' => [ - 'GetSetting' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=organizations/*/settings/*}', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=folders/*/settings/*}', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/settings/*}', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListSettings' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=organizations/*}/settings', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=folders/*}/settings', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*}/settings', - ], - ], - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'UpdateSetting' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{setting.name=organizations/*/settings/*}', - 'body' => 'setting', - 'additionalBindings' => [ - [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{setting.name=folders/*/settings/*}', - 'body' => 'setting', - ], - [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{setting.name=projects/*/settings/*}', - 'body' => 'setting', - ], - ], - 'placeholders' => [ - 'setting.name' => [ - 'getters' => [ - 'getSetting', - 'getName', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/Client/ResourceSettingsServiceClientTest.php b/owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/Client/ResourceSettingsServiceClientTest.php deleted file mode 100644 index 68b79b6962d1..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/Client/ResourceSettingsServiceClientTest.php +++ /dev/null @@ -1,300 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ResourceSettingsServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ResourceSettingsServiceClient($options); - } - - /** @test */ - public function getSettingTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $etag = 'etag3123477'; - $expectedResponse = new Setting(); - $expectedResponse->setName($name2); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); - $request = (new GetSettingRequest()) - ->setName($formattedName); - $response = $gapicClient->getSetting($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.resourcesettings.v1.ResourceSettingsService/GetSetting', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSettingExceptionTest() - { - $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->settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); - $request = (new GetSettingRequest()) - ->setName($formattedName); - try { - $gapicClient->getSetting($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 listSettingsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $settingsElement = new Setting(); - $settings = [ - $settingsElement, - ]; - $expectedResponse = new ListSettingsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSettings($settings); - $transport->addResponse($expectedResponse); - // Mock request - $parent = 'parent-995424086'; - $request = (new ListSettingsRequest()) - ->setParent($parent); - $response = $gapicClient->listSettings($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSettings()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.resourcesettings.v1.ResourceSettingsService/ListSettings', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($parent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSettingsExceptionTest() - { - $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 - $parent = 'parent-995424086'; - $request = (new ListSettingsRequest()) - ->setParent($parent); - try { - $gapicClient->listSettings($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 updateSettingTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $etag = 'etag3123477'; - $expectedResponse = new Setting(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $setting = new Setting(); - $request = (new UpdateSettingRequest()) - ->setSetting($setting); - $response = $gapicClient->updateSetting($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.resourcesettings.v1.ResourceSettingsService/UpdateSetting', $actualFuncCall); - $actualValue = $actualRequestObject->getSetting(); - $this->assertProtobufEquals($setting, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSettingExceptionTest() - { - $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 - $setting = new Setting(); - $request = (new UpdateSettingRequest()) - ->setSetting($setting); - try { - $gapicClient->updateSetting($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 getSettingAsyncTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $etag = 'etag3123477'; - $expectedResponse = new Setting(); - $expectedResponse->setName($name2); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); - $request = (new GetSettingRequest()) - ->setName($formattedName); - $response = $gapicClient->getSettingAsync($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.resourcesettings.v1.ResourceSettingsService/GetSetting', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/ResourceSettingsServiceClientTest.php b/owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/ResourceSettingsServiceClientTest.php deleted file mode 100644 index 5b92c7779a55..000000000000 --- a/owl-bot-staging/ResourceSettings/v1/tests/Unit/V1/ResourceSettingsServiceClientTest.php +++ /dev/null @@ -1,254 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ResourceSettingsServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ResourceSettingsServiceClient($options); - } - - /** @test */ - public function getSettingTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $etag = 'etag3123477'; - $expectedResponse = new Setting(); - $expectedResponse->setName($name2); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); - $response = $gapicClient->getSetting($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.resourcesettings.v1.ResourceSettingsService/GetSetting', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSettingExceptionTest() - { - $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->settingName('[PROJECT_NUMBER]', '[SETTING_NAME]'); - try { - $gapicClient->getSetting($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 listSettingsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $settingsElement = new Setting(); - $settings = [ - $settingsElement, - ]; - $expectedResponse = new ListSettingsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSettings($settings); - $transport->addResponse($expectedResponse); - // Mock request - $parent = 'parent-995424086'; - $response = $gapicClient->listSettings($parent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSettings()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.resourcesettings.v1.ResourceSettingsService/ListSettings', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($parent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSettingsExceptionTest() - { - $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 - $parent = 'parent-995424086'; - try { - $gapicClient->listSettings($parent); - // 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 updateSettingTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $etag = 'etag3123477'; - $expectedResponse = new Setting(); - $expectedResponse->setName($name); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $setting = new Setting(); - $response = $gapicClient->updateSetting($setting); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.resourcesettings.v1.ResourceSettingsService/UpdateSetting', $actualFuncCall); - $actualValue = $actualRequestObject->getSetting(); - $this->assertProtobufEquals($setting, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateSettingExceptionTest() - { - $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 - $setting = new Setting(); - try { - $gapicClient->updateSetting($setting); - // 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()); - } -}