From 6f0b19da56b7cd280bcef3a7824f60d247ce63df Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 17 Dec 2024 21:33:00 +0000 Subject: [PATCH 1/2] chore!: promote BigQueryDataExchange to v2 --- .repo-metadata-full.json | 4 +- BigQueryDataExchange/.OwlBot.yaml | 4 +- BigQueryDataExchange/README.md | 5 +- .../metadata/Common/Common.php | 24 - BigQueryDataExchange/owlbot.py | 46 +- BigQueryDataExchange/src/Common/Category.php | 140 -- .../src/V1beta1/AnalyticsHubServiceClient.php | 36 - .../V1beta1/AnalyticsHubServiceGrpcClient.php | 271 --- .../Client/AnalyticsHubServiceClient.php | 30 +- .../src/V1beta1/CreateDataExchangeRequest.php | 6 +- .../src/V1beta1/CreateListingRequest.php | 6 +- .../src/V1beta1/DataExchange.php | 14 +- .../src/V1beta1/DataProvider.php | 4 +- .../src/V1beta1/DeleteDataExchangeRequest.php | 2 +- .../src/V1beta1/DeleteListingRequest.php | 2 +- .../src/V1beta1/DestinationDataset.php | 16 +- .../V1beta1/DestinationDatasetReference.php | 4 +- .../Gapic/AnalyticsHubServiceGapicClient.php | 1507 ----------------- .../src/V1beta1/GetDataExchangeRequest.php | 2 +- .../src/V1beta1/GetListingRequest.php | 2 +- .../src/V1beta1/ListDataExchangesRequest.php | 6 +- .../src/V1beta1/ListDataExchangesResponse.php | 2 +- .../src/V1beta1/ListListingsRequest.php | 6 +- .../src/V1beta1/ListListingsResponse.php | 2 +- .../V1beta1/ListOrgDataExchangesRequest.php | 6 +- .../V1beta1/ListOrgDataExchangesResponse.php | 2 +- BigQueryDataExchange/src/V1beta1/Listing.php | 20 +- .../V1beta1/Listing/BigQueryDatasetSource.php | 4 +- .../src/V1beta1/Listing/Category.php | 2 - .../src/V1beta1/Listing/State.php | 2 - .../src/V1beta1/Publisher.php | 4 +- .../src/V1beta1/SubscribeListingRequest.php | 2 +- .../src/V1beta1/UpdateDataExchangeRequest.php | 4 +- .../src/V1beta1/UpdateListingRequest.php | 4 +- .../V1beta1/AnalyticsHubServiceClientTest.php | 1239 -------------- .../Client/AnalyticsHubServiceClientTest.php | 443 ++--- 36 files changed, 343 insertions(+), 3530 deletions(-) delete mode 100644 BigQueryDataExchange/metadata/Common/Common.php delete mode 100644 BigQueryDataExchange/src/Common/Category.php delete mode 100644 BigQueryDataExchange/src/V1beta1/AnalyticsHubServiceClient.php delete mode 100644 BigQueryDataExchange/src/V1beta1/AnalyticsHubServiceGrpcClient.php delete mode 100644 BigQueryDataExchange/src/V1beta1/Gapic/AnalyticsHubServiceGapicClient.php delete mode 100644 BigQueryDataExchange/tests/Unit/V1beta1/AnalyticsHubServiceClientTest.php diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index 47293b0e4b2a..38dda9fecfa5 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -282,7 +282,7 @@ "BigQueryDataExchange": { "language": "php", "distribution_name": "google/cloud-bigquery-data-exchange", - "release_level": "preview", + "release_level": "stable", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-bigquery-data-exchange/latest", "library_type": "GAPIC_AUTO", "api_shortname": "analyticshub" @@ -1599,4 +1599,4 @@ "library_type": "GAPIC_AUTO", "api_shortname": "workflows" } -} +} \ No newline at end of file diff --git a/BigQueryDataExchange/.OwlBot.yaml b/BigQueryDataExchange/.OwlBot.yaml index 125aa715117d..9a42de300f44 100644 --- a/BigQueryDataExchange/.OwlBot.yaml +++ b/BigQueryDataExchange/.OwlBot.yaml @@ -1,4 +1,4 @@ deep-copy-regex: - - source: /google/cloud/bigquery/dataexchange/v1beta1/.*-php/(.*) - dest: /owl-bot-staging/BigQueryDataExchange/v1beta1/$1 + - source: /google/cloud/bigquery/dataexchange/(v1beta1)/.*-php/(.*) + dest: /owl-bot-staging/BigQueryDataExchange/$1/$2 api-name: BigQueryDataExchange diff --git a/BigQueryDataExchange/README.md b/BigQueryDataExchange/README.md index 4c4046ca278d..ed90ad866b70 100644 --- a/BigQueryDataExchange/README.md +++ b/BigQueryDataExchange/README.md @@ -35,9 +35,8 @@ for more information about the debugging tools. ### Version -This component is considered beta. As such, it should be expected to be mostly -stable and we're working towards a release candidate. We will address issues -and requests with a higher priority. +This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in +any minor or patch releases. We will address issues and requests with the highest priority. ### Next Steps diff --git a/BigQueryDataExchange/metadata/Common/Common.php b/BigQueryDataExchange/metadata/Common/Common.php deleted file mode 100644 index b8b2035e6b86..000000000000 --- a/BigQueryDataExchange/metadata/Common/Common.php +++ /dev/null @@ -1,24 +0,0 @@ -internalAddGeneratedFile(hex2bin( - "0abf070a36676f6f676c652f636c6f75642f62696771756572792f6461746165786368616e67652f636f6d6d6f6e2f636f6d6d6f6e2e70726f746f1229676f6f676c652e636c6f75642e62696771756572792e6461746165786368616e67652e636f6d6d6f6e2ab7040a0843617465676f727912180a1443415445474f52595f554e535045434946494544100012130a0f43415445474f52595f4f5448455253100112260a2243415445474f52595f4144564552544953494e475f414e445f4d41524b4554494e47100212150a1143415445474f52595f434f4d4d45524345100312240a2043415445474f52595f434c494d4154455f414e445f454e5649524f4e4d454e54100412190a1543415445474f52595f44454d4f4752415048494353100512160a1243415445474f52595f45434f4e4f4d494353100612160a1243415445474f52595f454455434154494f4e100712130a0f43415445474f52595f454e45524759100812160a1243415445474f52595f46494e414e4349414c100912130a0f43415445474f52595f47414d494e47100a12170a1343415445474f52595f47454f5350415449414c100b12280a2443415445474f52595f4845414c5448434152455f414e445f4c4946455f534349454e4345100c12120a0e43415445474f52595f4d45444941100d121a0a1643415445474f52595f5055424c49435f534543544f52100e12130a0f43415445474f52595f52455441494c100f12130a0f43415445474f52595f53504f525453101012210a1d43415445474f52595f534349454e43455f414e445f5245534541524348101112290a2543415445474f52595f5452414e53504f52544154494f4e5f414e445f4c4f474953544943531012121f0a1b43415445474f52595f54524156454c5f414e445f544f555249534d10134297020a2d636f6d2e676f6f676c652e636c6f75642e62696771756572792e6461746165786368616e67652e636f6d6d6f6e420b436f6d6d6f6e50726f746f50015a4f676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f636c6f75642f62696771756572792f6461746165786368616e67652f636f6d6d6f6e3b636f6d6d6f6eaa0229476f6f676c652e436c6f75642e42696751756572792e4461746145786368616e67652e436f6d6d6f6eca0229476f6f676c655c436c6f75645c42696751756572795c4461746145786368616e67655c436f6d6d6f6eea022d476f6f676c653a3a436c6f75643a3a42696771756572793a3a4461746145786368616e67653a3a436f6d6d6f6e620670726f746f33" - ), true); - - static::$is_initialized = true; - } -} - diff --git a/BigQueryDataExchange/owlbot.py b/BigQueryDataExchange/owlbot.py index b738591a3701..1b6a68b2fcdb 100644 --- a/BigQueryDataExchange/owlbot.py +++ b/BigQueryDataExchange/owlbot.py @@ -1,4 +1,4 @@ -# Copyright 2022 Google LLC +# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,40 +30,16 @@ # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) -php.owlbot_main( - src=src, - dest=dest, - copy_excludes=[ - src / "**/[A-Z]*_*.php" - ] -) +php.owlbot_main(src=src, dest=dest) - -### [START] protoc backwards compatibility fixes - -# roll back to private properties. -s.replace( - "src/**/V*/**/*.php", - r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$", - r"""Generated from protobuf field \1 - */ - private $""") - -# Replace "Unwrapped" with "Value" for method names. -s.replace( - "src/**/V*/**/*.php", - r"public function ([s|g]\w{3,})Unwrapped", - r"public function \1Value" -) - -### [END] protoc backwards compatibility fixes - -# fix relative cloud.google.com links +# remove class_alias code s.replace( - "src/**/V*/**/*.php", - r"(.{0,})\]\((/.{0,})\)", - r"\1](https://cloud.google.com\2)" -) + "src/V*/**/*.php", + r"^// Adding a class alias for backwards compatibility with the previous class name.$" + + "\n" + + r"^class_alias\(.*\);$" + + "\n", + '') # format generated clients subprocess.run([ @@ -73,8 +49,8 @@ '--package=@prettier/plugin-php@^0.16', '--', 'prettier', - '**/Gapic/*', + '**/Client/*', '--write', '--parser=php', '--single-quote', - '--print-width=80']) \ No newline at end of file + '--print-width=120']) diff --git a/BigQueryDataExchange/src/Common/Category.php b/BigQueryDataExchange/src/Common/Category.php deleted file mode 100644 index 210b6b1685c4..000000000000 --- a/BigQueryDataExchange/src/Common/Category.php +++ /dev/null @@ -1,140 +0,0 @@ -google.cloud.bigquery.dataexchange.common.Category - */ -class Category -{ - /** - * Generated from protobuf enum CATEGORY_UNSPECIFIED = 0; - */ - const CATEGORY_UNSPECIFIED = 0; - /** - * Generated from protobuf enum CATEGORY_OTHERS = 1; - */ - const CATEGORY_OTHERS = 1; - /** - * Generated from protobuf enum CATEGORY_ADVERTISING_AND_MARKETING = 2; - */ - const CATEGORY_ADVERTISING_AND_MARKETING = 2; - /** - * Generated from protobuf enum CATEGORY_COMMERCE = 3; - */ - const CATEGORY_COMMERCE = 3; - /** - * Generated from protobuf enum CATEGORY_CLIMATE_AND_ENVIRONMENT = 4; - */ - const CATEGORY_CLIMATE_AND_ENVIRONMENT = 4; - /** - * Generated from protobuf enum CATEGORY_DEMOGRAPHICS = 5; - */ - const CATEGORY_DEMOGRAPHICS = 5; - /** - * Generated from protobuf enum CATEGORY_ECONOMICS = 6; - */ - const CATEGORY_ECONOMICS = 6; - /** - * Generated from protobuf enum CATEGORY_EDUCATION = 7; - */ - const CATEGORY_EDUCATION = 7; - /** - * Generated from protobuf enum CATEGORY_ENERGY = 8; - */ - const CATEGORY_ENERGY = 8; - /** - * Generated from protobuf enum CATEGORY_FINANCIAL = 9; - */ - const CATEGORY_FINANCIAL = 9; - /** - * Generated from protobuf enum CATEGORY_GAMING = 10; - */ - const CATEGORY_GAMING = 10; - /** - * Generated from protobuf enum CATEGORY_GEOSPATIAL = 11; - */ - const CATEGORY_GEOSPATIAL = 11; - /** - * Generated from protobuf enum CATEGORY_HEALTHCARE_AND_LIFE_SCIENCE = 12; - */ - const CATEGORY_HEALTHCARE_AND_LIFE_SCIENCE = 12; - /** - * Generated from protobuf enum CATEGORY_MEDIA = 13; - */ - const CATEGORY_MEDIA = 13; - /** - * Generated from protobuf enum CATEGORY_PUBLIC_SECTOR = 14; - */ - const CATEGORY_PUBLIC_SECTOR = 14; - /** - * Generated from protobuf enum CATEGORY_RETAIL = 15; - */ - const CATEGORY_RETAIL = 15; - /** - * Generated from protobuf enum CATEGORY_SPORTS = 16; - */ - const CATEGORY_SPORTS = 16; - /** - * Generated from protobuf enum CATEGORY_SCIENCE_AND_RESEARCH = 17; - */ - const CATEGORY_SCIENCE_AND_RESEARCH = 17; - /** - * Generated from protobuf enum CATEGORY_TRANSPORTATION_AND_LOGISTICS = 18; - */ - const CATEGORY_TRANSPORTATION_AND_LOGISTICS = 18; - /** - * Generated from protobuf enum CATEGORY_TRAVEL_AND_TOURISM = 19; - */ - const CATEGORY_TRAVEL_AND_TOURISM = 19; - - private static $valueToName = [ - self::CATEGORY_UNSPECIFIED => 'CATEGORY_UNSPECIFIED', - self::CATEGORY_OTHERS => 'CATEGORY_OTHERS', - self::CATEGORY_ADVERTISING_AND_MARKETING => 'CATEGORY_ADVERTISING_AND_MARKETING', - self::CATEGORY_COMMERCE => 'CATEGORY_COMMERCE', - self::CATEGORY_CLIMATE_AND_ENVIRONMENT => 'CATEGORY_CLIMATE_AND_ENVIRONMENT', - self::CATEGORY_DEMOGRAPHICS => 'CATEGORY_DEMOGRAPHICS', - self::CATEGORY_ECONOMICS => 'CATEGORY_ECONOMICS', - self::CATEGORY_EDUCATION => 'CATEGORY_EDUCATION', - self::CATEGORY_ENERGY => 'CATEGORY_ENERGY', - self::CATEGORY_FINANCIAL => 'CATEGORY_FINANCIAL', - self::CATEGORY_GAMING => 'CATEGORY_GAMING', - self::CATEGORY_GEOSPATIAL => 'CATEGORY_GEOSPATIAL', - self::CATEGORY_HEALTHCARE_AND_LIFE_SCIENCE => 'CATEGORY_HEALTHCARE_AND_LIFE_SCIENCE', - self::CATEGORY_MEDIA => 'CATEGORY_MEDIA', - self::CATEGORY_PUBLIC_SECTOR => 'CATEGORY_PUBLIC_SECTOR', - self::CATEGORY_RETAIL => 'CATEGORY_RETAIL', - self::CATEGORY_SPORTS => 'CATEGORY_SPORTS', - self::CATEGORY_SCIENCE_AND_RESEARCH => 'CATEGORY_SCIENCE_AND_RESEARCH', - self::CATEGORY_TRANSPORTATION_AND_LOGISTICS => 'CATEGORY_TRANSPORTATION_AND_LOGISTICS', - self::CATEGORY_TRAVEL_AND_TOURISM => 'CATEGORY_TRAVEL_AND_TOURISM', - ]; - - 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/BigQueryDataExchange/src/V1beta1/AnalyticsHubServiceClient.php b/BigQueryDataExchange/src/V1beta1/AnalyticsHubServiceClient.php deleted file mode 100644 index ca06a848066e..000000000000 --- a/BigQueryDataExchange/src/V1beta1/AnalyticsHubServiceClient.php +++ /dev/null @@ -1,36 +0,0 @@ -_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListDataExchanges', - $argument, - ['\Google\Cloud\BigQuery\DataExchange\V1beta1\ListDataExchangesResponse', 'decode'], - $metadata, $options); - } - - /** - * Lists all data exchanges from projects in a given organization and - * location. - * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\ListOrgDataExchangesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListOrgDataExchanges(\Google\Cloud\BigQuery\DataExchange\V1beta1\ListOrgDataExchangesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListOrgDataExchanges', - $argument, - ['\Google\Cloud\BigQuery\DataExchange\V1beta1\ListOrgDataExchangesResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets the details of a data exchange. - * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\GetDataExchangeRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetDataExchange(\Google\Cloud\BigQuery\DataExchange\V1beta1\GetDataExchangeRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetDataExchange', - $argument, - ['\Google\Cloud\BigQuery\DataExchange\V1beta1\DataExchange', 'decode'], - $metadata, $options); - } - - /** - * Creates a new data exchange. - * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\CreateDataExchangeRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateDataExchange(\Google\Cloud\BigQuery\DataExchange\V1beta1\CreateDataExchangeRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/CreateDataExchange', - $argument, - ['\Google\Cloud\BigQuery\DataExchange\V1beta1\DataExchange', 'decode'], - $metadata, $options); - } - - /** - * Updates an existing data exchange. - * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\UpdateDataExchangeRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateDataExchange(\Google\Cloud\BigQuery\DataExchange\V1beta1\UpdateDataExchangeRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/UpdateDataExchange', - $argument, - ['\Google\Cloud\BigQuery\DataExchange\V1beta1\DataExchange', 'decode'], - $metadata, $options); - } - - /** - * Deletes an existing data exchange. - * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\DeleteDataExchangeRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteDataExchange(\Google\Cloud\BigQuery\DataExchange\V1beta1\DeleteDataExchangeRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/DeleteDataExchange', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Lists all listings in a given project and location. - * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\ListListingsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListListings(\Google\Cloud\BigQuery\DataExchange\V1beta1\ListListingsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListListings', - $argument, - ['\Google\Cloud\BigQuery\DataExchange\V1beta1\ListListingsResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets the details of a listing. - * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\GetListingRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetListing(\Google\Cloud\BigQuery\DataExchange\V1beta1\GetListingRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetListing', - $argument, - ['\Google\Cloud\BigQuery\DataExchange\V1beta1\Listing', 'decode'], - $metadata, $options); - } - - /** - * Creates a new listing. - * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\CreateListingRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateListing(\Google\Cloud\BigQuery\DataExchange\V1beta1\CreateListingRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/CreateListing', - $argument, - ['\Google\Cloud\BigQuery\DataExchange\V1beta1\Listing', 'decode'], - $metadata, $options); - } - - /** - * Updates an existing listing. - * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\UpdateListingRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateListing(\Google\Cloud\BigQuery\DataExchange\V1beta1\UpdateListingRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/UpdateListing', - $argument, - ['\Google\Cloud\BigQuery\DataExchange\V1beta1\Listing', 'decode'], - $metadata, $options); - } - - /** - * Deletes a listing. - * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\DeleteListingRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteListing(\Google\Cloud\BigQuery\DataExchange\V1beta1\DeleteListingRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/DeleteListing', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Subscribes to a listing. - * - * Currently, with Analytics Hub, you can create listings that - * reference only BigQuery datasets. - * Upon subscription to a listing for a BigQuery dataset, Analytics Hub - * creates a linked dataset in the subscriber's project. - * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\SubscribeListingRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function SubscribeListing(\Google\Cloud\BigQuery\DataExchange\V1beta1\SubscribeListingRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/SubscribeListing', - $argument, - ['\Google\Cloud\BigQuery\DataExchange\V1beta1\SubscribeListingResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets the IAM policy. - * @param \Google\Cloud\Iam\V1\GetIamPolicyRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetIamPolicy(\Google\Cloud\Iam\V1\GetIamPolicyRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetIamPolicy', - $argument, - ['\Google\Cloud\Iam\V1\Policy', 'decode'], - $metadata, $options); - } - - /** - * Sets the IAM policy. - * @param \Google\Cloud\Iam\V1\SetIamPolicyRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function SetIamPolicy(\Google\Cloud\Iam\V1\SetIamPolicyRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/SetIamPolicy', - $argument, - ['\Google\Cloud\Iam\V1\Policy', 'decode'], - $metadata, $options); - } - - /** - * Returns the permissions that a caller has. - * @param \Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function TestIamPermissions(\Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/TestIamPermissions', - $argument, - ['\Google\Cloud\Iam\V1\TestIamPermissionsResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/BigQueryDataExchange/src/V1beta1/Client/AnalyticsHubServiceClient.php b/BigQueryDataExchange/src/V1beta1/Client/AnalyticsHubServiceClient.php index d2b8d6621926..9fee5feed5ea 100644 --- a/BigQueryDataExchange/src/V1beta1/Client/AnalyticsHubServiceClient.php +++ b/BigQueryDataExchange/src/V1beta1/Client/AnalyticsHubServiceClient.php @@ -1,6 +1,6 @@ startApiCall('ListOrgDataExchanges', $request, $callOptions); } @@ -670,8 +668,10 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = * * @experimental */ - public function subscribeListing(SubscribeListingRequest $request, array $callOptions = []): SubscribeListingResponse - { + public function subscribeListing( + SubscribeListingRequest $request, + array $callOptions = [] + ): SubscribeListingResponse { return $this->startApiCall('SubscribeListing', $request, $callOptions)->wait(); } @@ -699,8 +699,10 @@ public function subscribeListing(SubscribeListingRequest $request, array $callOp * * @experimental */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRequest $request, + array $callOptions = [] + ): TestIamPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } diff --git a/BigQueryDataExchange/src/V1beta1/CreateDataExchangeRequest.php b/BigQueryDataExchange/src/V1beta1/CreateDataExchangeRequest.php index 6ac362075528..09056571a3e0 100644 --- a/BigQueryDataExchange/src/V1beta1/CreateDataExchangeRequest.php +++ b/BigQueryDataExchange/src/V1beta1/CreateDataExchangeRequest.php @@ -21,7 +21,7 @@ class CreateDataExchangeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The ID of the data exchange. * Must contain only Unicode letters, numbers (0-9), underscores (_). @@ -31,13 +31,13 @@ class CreateDataExchangeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string data_exchange_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $data_exchange_id = ''; + protected $data_exchange_id = ''; /** * Required. The data exchange to create. * * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.DataExchange data_exchange = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $data_exchange = null; + protected $data_exchange = null; /** * @param string $parent Required. The parent resource path of the data exchange. diff --git a/BigQueryDataExchange/src/V1beta1/CreateListingRequest.php b/BigQueryDataExchange/src/V1beta1/CreateListingRequest.php index 3c0c0101a785..185295f4c739 100644 --- a/BigQueryDataExchange/src/V1beta1/CreateListingRequest.php +++ b/BigQueryDataExchange/src/V1beta1/CreateListingRequest.php @@ -21,7 +21,7 @@ class CreateListingRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The ID of the listing to create. * Must contain only Unicode letters, numbers (0-9), underscores (_). @@ -31,13 +31,13 @@ class CreateListingRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string listing_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $listing_id = ''; + protected $listing_id = ''; /** * Required. The listing to create. * * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.Listing listing = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $listing = null; + protected $listing = null; /** * @param string $parent Required. The parent resource path of the listing. diff --git a/BigQueryDataExchange/src/V1beta1/DataExchange.php b/BigQueryDataExchange/src/V1beta1/DataExchange.php index a83f2f14d19e..6e9c67d93f21 100644 --- a/BigQueryDataExchange/src/V1beta1/DataExchange.php +++ b/BigQueryDataExchange/src/V1beta1/DataExchange.php @@ -23,7 +23,7 @@ class DataExchange extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. Human-readable display name of the data exchange. The display name must * contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), @@ -33,7 +33,7 @@ class DataExchange extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Optional. Description of the data exchange. The description must not contain Unicode * non-characters as well as C0 and C1 control codes except tabs (HT), @@ -43,26 +43,26 @@ class DataExchange extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string description = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; /** * Optional. Email or URL of the primary point of contact of the data exchange. * Max Length: 1000 bytes. * * Generated from protobuf field string primary_contact = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $primary_contact = ''; + protected $primary_contact = ''; /** * Optional. Documentation describing the data exchange. * * Generated from protobuf field string documentation = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $documentation = ''; + protected $documentation = ''; /** * Output only. Number of listings contained in the data exchange. * * Generated from protobuf field int32 listing_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $listing_count = 0; + protected $listing_count = 0; /** * Optional. Base64 encoded image representing the data exchange. Max Size: 3.0MiB * Expected image dimensions are 512x512 pixels, however the API only @@ -72,7 +72,7 @@ class DataExchange extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bytes icon = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $icon = ''; + protected $icon = ''; /** * Constructor. diff --git a/BigQueryDataExchange/src/V1beta1/DataProvider.php b/BigQueryDataExchange/src/V1beta1/DataProvider.php index a741188d9981..a84fe678974c 100644 --- a/BigQueryDataExchange/src/V1beta1/DataProvider.php +++ b/BigQueryDataExchange/src/V1beta1/DataProvider.php @@ -20,14 +20,14 @@ class DataProvider extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $name = ''; + protected $name = ''; /** * Optional. Email or URL of the data provider. * Max Length: 1000 bytes. * * Generated from protobuf field string primary_contact = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $primary_contact = ''; + protected $primary_contact = ''; /** * Constructor. diff --git a/BigQueryDataExchange/src/V1beta1/DeleteDataExchangeRequest.php b/BigQueryDataExchange/src/V1beta1/DeleteDataExchangeRequest.php index c00cf4a55c8b..a51e62da4faf 100644 --- a/BigQueryDataExchange/src/V1beta1/DeleteDataExchangeRequest.php +++ b/BigQueryDataExchange/src/V1beta1/DeleteDataExchangeRequest.php @@ -21,7 +21,7 @@ class DeleteDataExchangeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The full name of the data exchange resource that you want to delete. diff --git a/BigQueryDataExchange/src/V1beta1/DeleteListingRequest.php b/BigQueryDataExchange/src/V1beta1/DeleteListingRequest.php index c8456aa21f01..3a38544c15a9 100644 --- a/BigQueryDataExchange/src/V1beta1/DeleteListingRequest.php +++ b/BigQueryDataExchange/src/V1beta1/DeleteListingRequest.php @@ -21,7 +21,7 @@ class DeleteListingRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. Resource name of the listing to delete. diff --git a/BigQueryDataExchange/src/V1beta1/DestinationDataset.php b/BigQueryDataExchange/src/V1beta1/DestinationDataset.php index a0cc95dffe8c..5cdedbec98c6 100644 --- a/BigQueryDataExchange/src/V1beta1/DestinationDataset.php +++ b/BigQueryDataExchange/src/V1beta1/DestinationDataset.php @@ -20,19 +20,19 @@ class DestinationDataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.DestinationDatasetReference dataset_reference = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $dataset_reference = null; + protected $dataset_reference = null; /** * Optional. A descriptive name for the dataset. * * Generated from protobuf field .google.protobuf.StringValue friendly_name = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $friendly_name = null; + protected $friendly_name = null; /** * Optional. A user-friendly description of the dataset. * * Generated from protobuf field .google.protobuf.StringValue description = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = null; + protected $description = null; /** * Optional. The labels associated with this dataset. You can use these * to organize and group your datasets. @@ -50,7 +50,7 @@ class DestinationDataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string location = 5 [(.google.api.field_behavior) = REQUIRED]; */ - private $location = ''; + protected $location = ''; /** * Constructor. @@ -146,7 +146,7 @@ public function clearFriendlyName() * Generated from protobuf field .google.protobuf.StringValue friendly_name = 2 [(.google.api.field_behavior) = OPTIONAL]; * @return string|null */ - public function getFriendlyNameValue() + public function getFriendlyNameUnwrapped() { return $this->readWrapperValue("friendly_name"); } @@ -175,7 +175,7 @@ public function setFriendlyName($var) * @param string|null $var * @return $this */ - public function setFriendlyNameValue($var) + public function setFriendlyNameUnwrapped($var) { $this->writeWrapperValue("friendly_name", $var); return $this;} @@ -209,7 +209,7 @@ public function clearDescription() * Generated from protobuf field .google.protobuf.StringValue description = 3 [(.google.api.field_behavior) = OPTIONAL]; * @return string|null */ - public function getDescriptionValue() + public function getDescriptionUnwrapped() { return $this->readWrapperValue("description"); } @@ -238,7 +238,7 @@ public function setDescription($var) * @param string|null $var * @return $this */ - public function setDescriptionValue($var) + public function setDescriptionUnwrapped($var) { $this->writeWrapperValue("description", $var); return $this;} diff --git a/BigQueryDataExchange/src/V1beta1/DestinationDatasetReference.php b/BigQueryDataExchange/src/V1beta1/DestinationDatasetReference.php index ac224c6b7d1f..cdfc01fa84a4 100644 --- a/BigQueryDataExchange/src/V1beta1/DestinationDatasetReference.php +++ b/BigQueryDataExchange/src/V1beta1/DestinationDatasetReference.php @@ -22,13 +22,13 @@ class DestinationDatasetReference extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dataset_id = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $dataset_id = ''; + protected $dataset_id = ''; /** * Required. The ID of the project containing this dataset. * * Generated from protobuf field string project_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $project_id = ''; + protected $project_id = ''; /** * Constructor. diff --git a/BigQueryDataExchange/src/V1beta1/Gapic/AnalyticsHubServiceGapicClient.php b/BigQueryDataExchange/src/V1beta1/Gapic/AnalyticsHubServiceGapicClient.php deleted file mode 100644 index c464f0c48c4d..000000000000 --- a/BigQueryDataExchange/src/V1beta1/Gapic/AnalyticsHubServiceGapicClient.php +++ /dev/null @@ -1,1507 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $dataExchangeId = 'data_exchange_id'; - * $dataExchange = new DataExchange(); - * $response = $analyticsHubServiceClient->createDataExchange($formattedParent, $dataExchangeId, $dataExchange); - * } finally { - * $analyticsHubServiceClient->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. - * - * @experimental - * - * @deprecated Please use the new service client {@see \Google\Cloud\BigQuery\DataExchange\V1beta1\Client\AnalyticsHubServiceClient}. - */ -class AnalyticsHubServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'analyticshub.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'analyticshub.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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $dataExchangeNameTemplate; - - private static $datasetNameTemplate; - - private static $listingNameTemplate; - - private static $locationNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . - '/../resources/analytics_hub_service_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . - '/../resources/analytics_hub_service_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . - '/../resources/analytics_hub_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/analytics_hub_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getDataExchangeNameTemplate() - { - if (self::$dataExchangeNameTemplate == null) { - self::$dataExchangeNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/dataExchanges/{data_exchange}' - ); - } - - return self::$dataExchangeNameTemplate; - } - - private static function getDatasetNameTemplate() - { - if (self::$datasetNameTemplate == null) { - self::$datasetNameTemplate = new PathTemplate( - 'projects/{project}/datasets/{dataset}' - ); - } - - return self::$datasetNameTemplate; - } - - private static function getListingNameTemplate() - { - if (self::$listingNameTemplate == null) { - self::$listingNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}' - ); - } - - return self::$listingNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'dataExchange' => self::getDataExchangeNameTemplate(), - 'dataset' => self::getDatasetNameTemplate(), - 'listing' => self::getListingNameTemplate(), - 'location' => self::getLocationNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * data_exchange resource. - * - * @param string $project - * @param string $location - * @param string $dataExchange - * - * @return string The formatted data_exchange resource. - * - * @experimental - */ - public static function dataExchangeName($project, $location, $dataExchange) - { - return self::getDataExchangeNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'data_exchange' => $dataExchange, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a dataset - * resource. - * - * @param string $project - * @param string $dataset - * - * @return string The formatted dataset resource. - * - * @experimental - */ - public static function datasetName($project, $dataset) - { - return self::getDatasetNameTemplate()->render([ - 'project' => $project, - 'dataset' => $dataset, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a listing - * resource. - * - * @param string $project - * @param string $location - * @param string $dataExchange - * @param string $listing - * - * @return string The formatted listing resource. - * - * @experimental - */ - public static function listingName( - $project, - $location, - $dataExchange, - $listing - ) { - return self::getListingNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'data_exchange' => $dataExchange, - 'listing' => $listing, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - * - * @experimental - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - dataExchange: projects/{project}/locations/{location}/dataExchanges/{data_exchange} - * - dataset: projects/{project}/datasets/{dataset} - * - listing: projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing} - * - location: projects/{project}/locations/{location} - * - * 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. - * - * @experimental - */ - 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 'analyticshub.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 - * - * @experimental - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Creates a new data exchange. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $formattedParent = $analyticsHubServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * $dataExchangeId = 'data_exchange_id'; - * $dataExchange = new DataExchange(); - * $response = $analyticsHubServiceClient->createDataExchange($formattedParent, $dataExchangeId, $dataExchange); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent resource path of the data exchange. - * e.g. `projects/myproject/locations/US`. - * @param string $dataExchangeId Required. The ID of the data exchange. - * Must contain only Unicode letters, numbers (0-9), underscores (_). - * Should not use characters that require URL-escaping, or characters - * outside of ASCII, spaces. - * Max length: 100 bytes. - * @param DataExchange $dataExchange Required. The data exchange to create. - * @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\BigQuery\DataExchange\V1beta1\DataExchange - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function createDataExchange( - $parent, - $dataExchangeId, - $dataExchange, - array $optionalArgs = [] - ) { - $request = new CreateDataExchangeRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setDataExchangeId($dataExchangeId); - $request->setDataExchange($dataExchange); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateDataExchange', - DataExchange::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Creates a new listing. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $formattedParent = $analyticsHubServiceClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - * $listingId = 'listing_id'; - * $listing = new Listing(); - * $response = $analyticsHubServiceClient->createListing($formattedParent, $listingId, $listing); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent resource path of the listing. - * e.g. `projects/myproject/locations/US/dataExchanges/123`. - * @param string $listingId Required. The ID of the listing to create. - * Must contain only Unicode letters, numbers (0-9), underscores (_). - * Should not use characters that require URL-escaping, or characters - * outside of ASCII, spaces. - * Max length: 100 bytes. - * @param Listing $listing Required. The listing to create. - * @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\BigQuery\DataExchange\V1beta1\Listing - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function createListing( - $parent, - $listingId, - $listing, - array $optionalArgs = [] - ) { - $request = new CreateListingRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setListingId($listingId); - $request->setListing($listing); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'CreateListing', - Listing::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Deletes an existing data exchange. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $formattedName = $analyticsHubServiceClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - * $analyticsHubServiceClient->deleteDataExchange($formattedName); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The full name of the data exchange resource that you want to delete. - * For example, `projects/myproject/locations/US/dataExchanges/123`. - * @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. - * } - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function deleteDataExchange($name, array $optionalArgs = []) - { - $request = new DeleteDataExchangeRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'DeleteDataExchange', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Deletes a listing. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $formattedName = $analyticsHubServiceClient->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - * $analyticsHubServiceClient->deleteListing($formattedName); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Resource name of the listing to delete. - * e.g. `projects/myproject/locations/US/dataExchanges/123/listings/456`. - * @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. - * } - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function deleteListing($name, array $optionalArgs = []) - { - $request = new DeleteListingRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'DeleteListing', - GPBEmpty::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets the details of a data exchange. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $formattedName = $analyticsHubServiceClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - * $response = $analyticsHubServiceClient->getDataExchange($formattedName); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the data exchange. - * e.g. `projects/myproject/locations/US/dataExchanges/123`. - * @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\BigQuery\DataExchange\V1beta1\DataExchange - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getDataExchange($name, array $optionalArgs = []) - { - $request = new GetDataExchangeRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetDataExchange', - DataExchange::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets the IAM policy. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $resource = 'resource'; - * $response = $analyticsHubServiceClient->getIamPolicy($resource); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @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\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetIamPolicy', - Policy::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets the details of a listing. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $formattedName = $analyticsHubServiceClient->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - * $response = $analyticsHubServiceClient->getListing($formattedName); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The resource name of the listing. - * e.g. `projects/myproject/locations/US/dataExchanges/123/listings/456`. - * @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\BigQuery\DataExchange\V1beta1\Listing - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getListing($name, array $optionalArgs = []) - { - $request = new GetListingRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetListing', - Listing::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists all data exchanges in a given project and location. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $formattedParent = $analyticsHubServiceClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $analyticsHubServiceClient->listDataExchanges($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $analyticsHubServiceClient->listDataExchanges($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent resource path of the data exchanges. - * e.g. `projects/myproject/locations/US`. - * @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 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 - * - * @experimental - */ - public function listDataExchanges($parent, array $optionalArgs = []) - { - $request = new ListDataExchangesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListDataExchanges', - $optionalArgs, - ListDataExchangesResponse::class, - $request - ); - } - - /** - * Lists all listings in a given project and location. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $formattedParent = $analyticsHubServiceClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - * // Iterate over pages of elements - * $pagedResponse = $analyticsHubServiceClient->listListings($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $analyticsHubServiceClient->listListings($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent resource path of the listing. - * e.g. `projects/myproject/locations/US/dataExchanges/123`. - * @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 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 - * - * @experimental - */ - public function listListings($parent, array $optionalArgs = []) - { - $request = new ListListingsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListListings', - $optionalArgs, - ListListingsResponse::class, - $request - ); - } - - /** - * Lists all data exchanges from projects in a given organization and - * location. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $organization = 'organization'; - * // Iterate over pages of elements - * $pagedResponse = $analyticsHubServiceClient->listOrgDataExchanges($organization); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $analyticsHubServiceClient->listOrgDataExchanges($organization); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $organization Required. The organization resource path of the projects containing DataExchanges. - * e.g. `organizations/myorg/locations/US`. - * @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 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 - * - * @experimental - */ - public function listOrgDataExchanges( - $organization, - array $optionalArgs = [] - ) { - $request = new ListOrgDataExchangesRequest(); - $requestParamHeaders = []; - $request->setOrganization($organization); - $requestParamHeaders['organization'] = $organization; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListOrgDataExchanges', - $optionalArgs, - ListOrgDataExchangesResponse::class, - $request - ); - } - - /** - * Sets the IAM policy. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $analyticsHubServiceClient->setIamPolicy($resource, $policy); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @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\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SetIamPolicy', - Policy::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Subscribes to a listing. - * - * Currently, with Analytics Hub, you can create listings that - * reference only BigQuery datasets. - * Upon subscription to a listing for a BigQuery dataset, Analytics Hub - * creates a linked dataset in the subscriber's project. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $formattedName = $analyticsHubServiceClient->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - * $response = $analyticsHubServiceClient->subscribeListing($formattedName); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Resource name of the listing that you want to subscribe to. - * e.g. `projects/myproject/locations/US/dataExchanges/123/listings/456`. - * @param array $optionalArgs { - * Optional. - * - * @type DestinationDataset $destinationDataset - * BigQuery destination dataset to create for the subscriber. - * @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\BigQuery\DataExchange\V1beta1\SubscribeListingResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function subscribeListing($name, array $optionalArgs = []) - { - $request = new SubscribeListingRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['destinationDataset'])) { - $request->setDestinationDataset( - $optionalArgs['destinationDataset'] - ); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'SubscribeListing', - SubscribeListingResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Returns the permissions that a caller has. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $analyticsHubServiceClient->testIamPermissions($resource, $permissions); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @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\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function testIamPermissions( - $resource, - $permissions, - array $optionalArgs = [] - ) { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'TestIamPermissions', - TestIamPermissionsResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates an existing data exchange. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $updateMask = new FieldMask(); - * $dataExchange = new DataExchange(); - * $response = $analyticsHubServiceClient->updateDataExchange($updateMask, $dataExchange); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask specifies the fields to update in the data exchange - * resource. The fields specified in the - * `updateMask` are relative to the resource and are not a full request. - * @param DataExchange $dataExchange Required. The data exchange to update. - * @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\BigQuery\DataExchange\V1beta1\DataExchange - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function updateDataExchange( - $updateMask, - $dataExchange, - array $optionalArgs = [] - ) { - $request = new UpdateDataExchangeRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setDataExchange($dataExchange); - $requestParamHeaders['data_exchange.name'] = $dataExchange->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateDataExchange', - DataExchange::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Updates an existing listing. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $updateMask = new FieldMask(); - * $listing = new Listing(); - * $response = $analyticsHubServiceClient->updateListing($updateMask, $listing); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param FieldMask $updateMask Required. Field mask specifies the fields to update in the listing resource. The - * fields specified in the `updateMask` are relative to the resource and are - * not a full request. - * @param Listing $listing Required. The listing to update. - * @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\BigQuery\DataExchange\V1beta1\Listing - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function updateListing( - $updateMask, - $listing, - array $optionalArgs = [] - ) { - $request = new UpdateListingRequest(); - $requestParamHeaders = []; - $request->setUpdateMask($updateMask); - $request->setListing($listing); - $requestParamHeaders['listing.name'] = $listing->getName(); - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'UpdateListing', - Listing::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * $response = $analyticsHubServiceClient->getLocation(); - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @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\Location\Location - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $analyticsHubServiceClient = new AnalyticsHubServiceClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $analyticsHubServiceClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $analyticsHubServiceClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $analyticsHubServiceClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @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 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 - * - * @experimental - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } -} diff --git a/BigQueryDataExchange/src/V1beta1/GetDataExchangeRequest.php b/BigQueryDataExchange/src/V1beta1/GetDataExchangeRequest.php index 33f3dcbd526d..1589433adf0e 100644 --- a/BigQueryDataExchange/src/V1beta1/GetDataExchangeRequest.php +++ b/BigQueryDataExchange/src/V1beta1/GetDataExchangeRequest.php @@ -21,7 +21,7 @@ class GetDataExchangeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the data exchange. diff --git a/BigQueryDataExchange/src/V1beta1/GetListingRequest.php b/BigQueryDataExchange/src/V1beta1/GetListingRequest.php index f93cd882e7d8..4833f1fea1f0 100644 --- a/BigQueryDataExchange/src/V1beta1/GetListingRequest.php +++ b/BigQueryDataExchange/src/V1beta1/GetListingRequest.php @@ -21,7 +21,7 @@ class GetListingRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The resource name of the listing. diff --git a/BigQueryDataExchange/src/V1beta1/ListDataExchangesRequest.php b/BigQueryDataExchange/src/V1beta1/ListDataExchangesRequest.php index 1aa0115fd49c..0d3c1e996b60 100644 --- a/BigQueryDataExchange/src/V1beta1/ListDataExchangesRequest.php +++ b/BigQueryDataExchange/src/V1beta1/ListDataExchangesRequest.php @@ -21,21 +21,21 @@ class ListDataExchangesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The maximum number of results to return in a single response page. Leverage * the page tokens to iterate through the entire collection. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * Page token, returned by a previous call, to request the next page of * results. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The parent resource path of the data exchanges. diff --git a/BigQueryDataExchange/src/V1beta1/ListDataExchangesResponse.php b/BigQueryDataExchange/src/V1beta1/ListDataExchangesResponse.php index 79a719de0a53..e4bc976a6fda 100644 --- a/BigQueryDataExchange/src/V1beta1/ListDataExchangesResponse.php +++ b/BigQueryDataExchange/src/V1beta1/ListDataExchangesResponse.php @@ -26,7 +26,7 @@ class ListDataExchangesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/BigQueryDataExchange/src/V1beta1/ListListingsRequest.php b/BigQueryDataExchange/src/V1beta1/ListListingsRequest.php index 406f8b017c53..453823573a96 100644 --- a/BigQueryDataExchange/src/V1beta1/ListListingsRequest.php +++ b/BigQueryDataExchange/src/V1beta1/ListListingsRequest.php @@ -21,21 +21,21 @@ class ListListingsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * The maximum number of results to return in a single response page. Leverage * the page tokens to iterate through the entire collection. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * Page token, returned by a previous call, to request the next page of * results. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. The parent resource path of the listing. diff --git a/BigQueryDataExchange/src/V1beta1/ListListingsResponse.php b/BigQueryDataExchange/src/V1beta1/ListListingsResponse.php index 74bedf87a405..52139dd5acde 100644 --- a/BigQueryDataExchange/src/V1beta1/ListListingsResponse.php +++ b/BigQueryDataExchange/src/V1beta1/ListListingsResponse.php @@ -26,7 +26,7 @@ class ListListingsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/BigQueryDataExchange/src/V1beta1/ListOrgDataExchangesRequest.php b/BigQueryDataExchange/src/V1beta1/ListOrgDataExchangesRequest.php index b9388b42cd0f..f6b4ab045d71 100644 --- a/BigQueryDataExchange/src/V1beta1/ListOrgDataExchangesRequest.php +++ b/BigQueryDataExchange/src/V1beta1/ListOrgDataExchangesRequest.php @@ -22,21 +22,21 @@ class ListOrgDataExchangesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string organization = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $organization = ''; + protected $organization = ''; /** * The maximum number of results to return in a single response page. Leverage * the page tokens to iterate through the entire collection. * * Generated from protobuf field int32 page_size = 2; */ - private $page_size = 0; + protected $page_size = 0; /** * Page token, returned by a previous call, to request the next page of * results. * * Generated from protobuf field string page_token = 3; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $organization Required. The organization resource path of the projects containing DataExchanges. diff --git a/BigQueryDataExchange/src/V1beta1/ListOrgDataExchangesResponse.php b/BigQueryDataExchange/src/V1beta1/ListOrgDataExchangesResponse.php index db075efb3f2f..10b57cdff8e8 100644 --- a/BigQueryDataExchange/src/V1beta1/ListOrgDataExchangesResponse.php +++ b/BigQueryDataExchange/src/V1beta1/ListOrgDataExchangesResponse.php @@ -27,7 +27,7 @@ class ListOrgDataExchangesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/BigQueryDataExchange/src/V1beta1/Listing.php b/BigQueryDataExchange/src/V1beta1/Listing.php index 4991593309b1..97a1b7104982 100644 --- a/BigQueryDataExchange/src/V1beta1/Listing.php +++ b/BigQueryDataExchange/src/V1beta1/Listing.php @@ -24,7 +24,7 @@ class Listing extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Required. Human-readable display name of the listing. The display name must contain * only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces @@ -34,7 +34,7 @@ class Listing extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_name = ''; + protected $display_name = ''; /** * Optional. Short description of the listing. The description must not contain * Unicode non-characters and C0 and C1 control codes except tabs (HT), @@ -44,26 +44,26 @@ class Listing extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string description = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $description = ''; + protected $description = ''; /** * Optional. Email or URL of the primary point of contact of the listing. * Max Length: 1000 bytes. * * Generated from protobuf field string primary_contact = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $primary_contact = ''; + protected $primary_contact = ''; /** * Optional. Documentation describing the listing. * * Generated from protobuf field string documentation = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $documentation = ''; + protected $documentation = ''; /** * Output only. Current state of the listing. * * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.Listing.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Optional. Base64 encoded image representing the listing. Max Size: 3.0MiB * Expected image dimensions are 512x512 pixels, however the API only @@ -73,13 +73,13 @@ class Listing extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bytes icon = 8 [(.google.api.field_behavior) = OPTIONAL]; */ - private $icon = ''; + protected $icon = ''; /** * Optional. Details of the data provider who owns the source data. * * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.DataProvider data_provider = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - private $data_provider = null; + protected $data_provider = null; /** * Optional. Categories of the listing. Up to two categories are allowed. * @@ -92,7 +92,7 @@ class Listing extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.Publisher publisher = 11 [(.google.api.field_behavior) = OPTIONAL]; */ - private $publisher = null; + protected $publisher = null; /** * Optional. Email or URL of the request access of the listing. * Subscribers can use this reference to request access. @@ -100,7 +100,7 @@ class Listing extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_access = 12 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_access = ''; + protected $request_access = ''; protected $source; /** diff --git a/BigQueryDataExchange/src/V1beta1/Listing/BigQueryDatasetSource.php b/BigQueryDataExchange/src/V1beta1/Listing/BigQueryDatasetSource.php index 5d7b65c7fe2e..821fd14826cb 100644 --- a/BigQueryDataExchange/src/V1beta1/Listing/BigQueryDatasetSource.php +++ b/BigQueryDataExchange/src/V1beta1/Listing/BigQueryDatasetSource.php @@ -27,7 +27,7 @@ class BigQueryDatasetSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dataset = 1 [(.google.api.resource_reference) = { */ - private $dataset = ''; + protected $dataset = ''; /** * Constructor. @@ -75,6 +75,4 @@ public function setDataset($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(BigQueryDatasetSource::class, \Google\Cloud\BigQuery\DataExchange\V1beta1\Listing_BigQueryDatasetSource::class); diff --git a/BigQueryDataExchange/src/V1beta1/Listing/Category.php b/BigQueryDataExchange/src/V1beta1/Listing/Category.php index 49feae1ddd69..cb89b6c6df95 100644 --- a/BigQueryDataExchange/src/V1beta1/Listing/Category.php +++ b/BigQueryDataExchange/src/V1beta1/Listing/Category.php @@ -138,6 +138,4 @@ public static function value($name) } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Category::class, \Google\Cloud\BigQuery\DataExchange\V1beta1\Listing_Category::class); diff --git a/BigQueryDataExchange/src/V1beta1/Listing/State.php b/BigQueryDataExchange/src/V1beta1/Listing/State.php index b32889752911..3568a7e37b07 100644 --- a/BigQueryDataExchange/src/V1beta1/Listing/State.php +++ b/BigQueryDataExchange/src/V1beta1/Listing/State.php @@ -53,6 +53,4 @@ public static function value($name) } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\BigQuery\DataExchange\V1beta1\Listing_State::class); diff --git a/BigQueryDataExchange/src/V1beta1/Publisher.php b/BigQueryDataExchange/src/V1beta1/Publisher.php index 162bcc499bf5..df925cb8cd92 100644 --- a/BigQueryDataExchange/src/V1beta1/Publisher.php +++ b/BigQueryDataExchange/src/V1beta1/Publisher.php @@ -20,14 +20,14 @@ class Publisher extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $name = ''; + protected $name = ''; /** * Optional. Email or URL of the listing publisher. * Max Length: 1000 bytes. * * Generated from protobuf field string primary_contact = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $primary_contact = ''; + protected $primary_contact = ''; /** * Constructor. diff --git a/BigQueryDataExchange/src/V1beta1/SubscribeListingRequest.php b/BigQueryDataExchange/src/V1beta1/SubscribeListingRequest.php index 3735bf42a546..618a4dddf6d5 100644 --- a/BigQueryDataExchange/src/V1beta1/SubscribeListingRequest.php +++ b/BigQueryDataExchange/src/V1beta1/SubscribeListingRequest.php @@ -21,7 +21,7 @@ class SubscribeListingRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; protected $destination; /** diff --git a/BigQueryDataExchange/src/V1beta1/UpdateDataExchangeRequest.php b/BigQueryDataExchange/src/V1beta1/UpdateDataExchangeRequest.php index a9013098043d..9c8093ac7295 100644 --- a/BigQueryDataExchange/src/V1beta1/UpdateDataExchangeRequest.php +++ b/BigQueryDataExchange/src/V1beta1/UpdateDataExchangeRequest.php @@ -22,13 +22,13 @@ class UpdateDataExchangeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The data exchange to update. * * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.DataExchange data_exchange = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $data_exchange = null; + protected $data_exchange = null; /** * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\DataExchange $dataExchange Required. The data exchange to update. diff --git a/BigQueryDataExchange/src/V1beta1/UpdateListingRequest.php b/BigQueryDataExchange/src/V1beta1/UpdateListingRequest.php index 2c0e43ec44cc..65cdaa83e854 100644 --- a/BigQueryDataExchange/src/V1beta1/UpdateListingRequest.php +++ b/BigQueryDataExchange/src/V1beta1/UpdateListingRequest.php @@ -22,13 +22,13 @@ class UpdateListingRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The listing to update. * * Generated from protobuf field .google.cloud.bigquery.dataexchange.v1beta1.Listing listing = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $listing = null; + protected $listing = null; /** * @param \Google\Cloud\BigQuery\DataExchange\V1beta1\Listing $listing Required. The listing to update. diff --git a/BigQueryDataExchange/tests/Unit/V1beta1/AnalyticsHubServiceClientTest.php b/BigQueryDataExchange/tests/Unit/V1beta1/AnalyticsHubServiceClientTest.php deleted file mode 100644 index d20be8a46936..000000000000 --- a/BigQueryDataExchange/tests/Unit/V1beta1/AnalyticsHubServiceClientTest.php +++ /dev/null @@ -1,1239 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return AnalyticsHubServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new AnalyticsHubServiceClient($options); - } - - /** @test */ - public function createDataExchangeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $primaryContact = 'primaryContact203339491'; - $documentation = 'documentation1587405498'; - $listingCount = 1101038700; - $icon = '121'; - $expectedResponse = new DataExchange(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setPrimaryContact($primaryContact); - $expectedResponse->setDocumentation($documentation); - $expectedResponse->setListingCount($listingCount); - $expectedResponse->setIcon($icon); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $dataExchangeId = 'dataExchangeId1402219426'; - $dataExchange = new DataExchange(); - $dataExchangeDisplayName = 'dataExchangeDisplayName-1195270080'; - $dataExchange->setDisplayName($dataExchangeDisplayName); - $response = $gapicClient->createDataExchange($formattedParent, $dataExchangeId, $dataExchange); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/CreateDataExchange', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getDataExchangeId(); - $this->assertProtobufEquals($dataExchangeId, $actualValue); - $actualValue = $actualRequestObject->getDataExchange(); - $this->assertProtobufEquals($dataExchange, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createDataExchangeExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $dataExchangeId = 'dataExchangeId1402219426'; - $dataExchange = new DataExchange(); - $dataExchangeDisplayName = 'dataExchangeDisplayName-1195270080'; - $dataExchange->setDisplayName($dataExchangeDisplayName); - try { - $gapicClient->createDataExchange($formattedParent, $dataExchangeId, $dataExchange); - // 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 createListingTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $primaryContact = 'primaryContact203339491'; - $documentation = 'documentation1587405498'; - $icon = '121'; - $requestAccess = 'requestAccess2059178260'; - $expectedResponse = new Listing(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setPrimaryContact($primaryContact); - $expectedResponse->setDocumentation($documentation); - $expectedResponse->setIcon($icon); - $expectedResponse->setRequestAccess($requestAccess); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - $listingId = 'listingId988969142'; - $listing = new Listing(); - $listingDisplayName = 'listingDisplayName293456201'; - $listing->setDisplayName($listingDisplayName); - $listingBigqueryDataset = new BigQueryDatasetSource(); - $listing->setBigqueryDataset($listingBigqueryDataset); - $response = $gapicClient->createListing($formattedParent, $listingId, $listing); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/CreateListing', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getListingId(); - $this->assertProtobufEquals($listingId, $actualValue); - $actualValue = $actualRequestObject->getListing(); - $this->assertProtobufEquals($listing, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createListingExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - $listingId = 'listingId988969142'; - $listing = new Listing(); - $listingDisplayName = 'listingDisplayName293456201'; - $listing->setDisplayName($listingDisplayName); - $listingBigqueryDataset = new BigQueryDatasetSource(); - $listing->setBigqueryDataset($listingBigqueryDataset); - try { - $gapicClient->createListing($formattedParent, $listingId, $listing); - // 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 deleteDataExchangeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - $gapicClient->deleteDataExchange($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/DeleteDataExchange', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteDataExchangeExceptionTest() - { - $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->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - try { - $gapicClient->deleteDataExchange($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 deleteListingTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - $gapicClient->deleteListing($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/DeleteListing', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteListingExceptionTest() - { - $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->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - try { - $gapicClient->deleteListing($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 getDataExchangeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $primaryContact = 'primaryContact203339491'; - $documentation = 'documentation1587405498'; - $listingCount = 1101038700; - $icon = '121'; - $expectedResponse = new DataExchange(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setPrimaryContact($primaryContact); - $expectedResponse->setDocumentation($documentation); - $expectedResponse->setListingCount($listingCount); - $expectedResponse->setIcon($icon); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - $response = $gapicClient->getDataExchange($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.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetDataExchange', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDataExchangeExceptionTest() - { - $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->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - try { - $gapicClient->getDataExchange($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 getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $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 - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // 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 getListingTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $primaryContact = 'primaryContact203339491'; - $documentation = 'documentation1587405498'; - $icon = '121'; - $requestAccess = 'requestAccess2059178260'; - $expectedResponse = new Listing(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setPrimaryContact($primaryContact); - $expectedResponse->setDocumentation($documentation); - $expectedResponse->setIcon($icon); - $expectedResponse->setRequestAccess($requestAccess); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - $response = $gapicClient->getListing($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.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetListing', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getListingExceptionTest() - { - $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->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - try { - $gapicClient->getListing($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 listDataExchangesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $dataExchangesElement = new DataExchange(); - $dataExchanges = [ - $dataExchangesElement, - ]; - $expectedResponse = new ListDataExchangesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDataExchanges($dataExchanges); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listDataExchanges($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDataExchanges()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListDataExchanges', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDataExchangesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - try { - $gapicClient->listDataExchanges($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listListingsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $listingsElement = new Listing(); - $listings = [ - $listingsElement, - ]; - $expectedResponse = new ListListingsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setListings($listings); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - $response = $gapicClient->listListings($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getListings()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListListings', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listListingsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - try { - $gapicClient->listListings($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listOrgDataExchangesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $dataExchangesElement = new DataExchange(); - $dataExchanges = [ - $dataExchangesElement, - ]; - $expectedResponse = new ListOrgDataExchangesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDataExchanges($dataExchanges); - $transport->addResponse($expectedResponse); - // Mock request - $organization = 'organization1178922291'; - $response = $gapicClient->listOrgDataExchanges($organization); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDataExchanges()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListOrgDataExchanges', $actualFuncCall); - $actualValue = $actualRequestObject->getOrganization(); - $this->assertProtobufEquals($organization, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listOrgDataExchangesExceptionTest() - { - $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 - $organization = 'organization1178922291'; - try { - $gapicClient->listOrgDataExchanges($organization); - // 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 setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $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 - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // 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 subscribeListingTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new SubscribeListingResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - $response = $gapicClient->subscribeListing($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.bigquery.dataexchange.v1beta1.AnalyticsHubService/SubscribeListing', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function subscribeListingExceptionTest() - { - $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->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - try { - $gapicClient->subscribeListing($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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $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 - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // 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 updateDataExchangeTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $primaryContact = 'primaryContact203339491'; - $documentation = 'documentation1587405498'; - $listingCount = 1101038700; - $icon = '121'; - $expectedResponse = new DataExchange(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setPrimaryContact($primaryContact); - $expectedResponse->setDocumentation($documentation); - $expectedResponse->setListingCount($listingCount); - $expectedResponse->setIcon($icon); - $transport->addResponse($expectedResponse); - // Mock request - $updateMask = new FieldMask(); - $dataExchange = new DataExchange(); - $dataExchangeDisplayName = 'dataExchangeDisplayName-1195270080'; - $dataExchange->setDisplayName($dataExchangeDisplayName); - $response = $gapicClient->updateDataExchange($updateMask, $dataExchange); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/UpdateDataExchange', $actualFuncCall); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualRequestObject->getDataExchange(); - $this->assertProtobufEquals($dataExchange, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateDataExchangeExceptionTest() - { - $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 - $updateMask = new FieldMask(); - $dataExchange = new DataExchange(); - $dataExchangeDisplayName = 'dataExchangeDisplayName-1195270080'; - $dataExchange->setDisplayName($dataExchangeDisplayName); - try { - $gapicClient->updateDataExchange($updateMask, $dataExchange); - // 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 updateListingTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $primaryContact = 'primaryContact203339491'; - $documentation = 'documentation1587405498'; - $icon = '121'; - $requestAccess = 'requestAccess2059178260'; - $expectedResponse = new Listing(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setPrimaryContact($primaryContact); - $expectedResponse->setDocumentation($documentation); - $expectedResponse->setIcon($icon); - $expectedResponse->setRequestAccess($requestAccess); - $transport->addResponse($expectedResponse); - // Mock request - $updateMask = new FieldMask(); - $listing = new Listing(); - $listingDisplayName = 'listingDisplayName293456201'; - $listing->setDisplayName($listingDisplayName); - $listingBigqueryDataset = new BigQueryDatasetSource(); - $listing->setBigqueryDataset($listingBigqueryDataset); - $response = $gapicClient->updateListing($updateMask, $listing); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/UpdateListing', $actualFuncCall); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualRequestObject->getListing(); - $this->assertProtobufEquals($listing, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateListingExceptionTest() - { - $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 - $updateMask = new FieldMask(); - $listing = new Listing(); - $listingDisplayName = 'listingDisplayName293456201'; - $listing->setDisplayName($listingDisplayName); - $listingBigqueryDataset = new BigQueryDatasetSource(); - $listing->setBigqueryDataset($listingBigqueryDataset); - try { - $gapicClient->updateListing($updateMask, $listing); - // 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 getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $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); - try { - $gapicClient->getLocation(); - // 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 listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $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); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/BigQueryDataExchange/tests/Unit/V1beta1/Client/AnalyticsHubServiceClientTest.php b/BigQueryDataExchange/tests/Unit/V1beta1/Client/AnalyticsHubServiceClientTest.php index b6666bf35f72..a64fe11d9e47 100644 --- a/BigQueryDataExchange/tests/Unit/V1beta1/Client/AnalyticsHubServiceClientTest.php +++ b/BigQueryDataExchange/tests/Unit/V1beta1/Client/AnalyticsHubServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return AnalyticsHubServiceClient */ @@ -129,7 +131,10 @@ public function createDataExchangeTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/CreateDataExchange', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/CreateDataExchange', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualRequestObject->getDataExchangeId(); @@ -150,12 +155,15 @@ public function createDataExchangeExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -223,7 +231,10 @@ public function createListingTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/CreateListing', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/CreateListing', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualRequestObject->getListingId(); @@ -244,12 +255,15 @@ public function createListingExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); @@ -289,14 +303,16 @@ public function deleteDataExchangeTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - $request = (new DeleteDataExchangeRequest()) - ->setName($formattedName); + $request = (new DeleteDataExchangeRequest())->setName($formattedName); $gapicClient->deleteDataExchange($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/DeleteDataExchange', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/DeleteDataExchange', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -313,17 +329,19 @@ public function deleteDataExchangeExceptionTest() $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); + $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->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - $request = (new DeleteDataExchangeRequest()) - ->setName($formattedName); + $request = (new DeleteDataExchangeRequest())->setName($formattedName); try { $gapicClient->deleteDataExchange($request); // If the $gapicClient method call did not throw, fail the test @@ -350,14 +368,16 @@ public function deleteListingTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - $request = (new DeleteListingRequest()) - ->setName($formattedName); + $request = (new DeleteListingRequest())->setName($formattedName); $gapicClient->deleteListing($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/DeleteListing', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/DeleteListing', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -374,17 +394,19 @@ public function deleteListingExceptionTest() $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); + $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->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - $request = (new DeleteListingRequest()) - ->setName($formattedName); + $request = (new DeleteListingRequest())->setName($formattedName); try { $gapicClient->deleteListing($request); // If the $gapicClient method call did not throw, fail the test @@ -425,15 +447,17 @@ public function getDataExchangeTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - $request = (new GetDataExchangeRequest()) - ->setName($formattedName); + $request = (new GetDataExchangeRequest())->setName($formattedName); $response = $gapicClient->getDataExchange($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.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetDataExchange', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetDataExchange', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -450,17 +474,19 @@ public function getDataExchangeExceptionTest() $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); + $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->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - $request = (new GetDataExchangeRequest()) - ->setName($formattedName); + $request = (new GetDataExchangeRequest())->setName($formattedName); try { $gapicClient->getDataExchange($request); // If the $gapicClient method call did not throw, fail the test @@ -491,15 +517,17 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($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.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetIamPolicy', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetIamPolicy', + $actualFuncCall + ); $actualValue = $actualRequestObject->getResource(); $this->assertProtobufEquals($resource, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -516,17 +544,19 @@ public function getIamPolicyExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -567,15 +597,17 @@ public function getListingTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - $request = (new GetListingRequest()) - ->setName($formattedName); + $request = (new GetListingRequest())->setName($formattedName); $response = $gapicClient->getListing($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.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetListing', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetListing', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -592,17 +624,19 @@ public function getListingExceptionTest() $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); + $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->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - $request = (new GetListingRequest()) - ->setName($formattedName); + $request = (new GetListingRequest())->setName($formattedName); try { $gapicClient->getListing($request); // If the $gapicClient method call did not throw, fail the test @@ -627,17 +661,14 @@ public function listDataExchangesTest() // Mock response $nextPageToken = ''; $dataExchangesElement = new DataExchange(); - $dataExchanges = [ - $dataExchangesElement, - ]; + $dataExchanges = [$dataExchangesElement]; $expectedResponse = new ListDataExchangesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setDataExchanges($dataExchanges); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListDataExchangesRequest()) - ->setParent($formattedParent); + $request = (new ListDataExchangesRequest())->setParent($formattedParent); $response = $gapicClient->listDataExchanges($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -647,7 +678,10 @@ public function listDataExchangesTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListDataExchanges', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListDataExchanges', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -664,17 +698,19 @@ public function listDataExchangesExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListDataExchangesRequest()) - ->setParent($formattedParent); + $request = (new ListDataExchangesRequest())->setParent($formattedParent); try { $gapicClient->listDataExchanges($request); // If the $gapicClient method call did not throw, fail the test @@ -699,17 +735,14 @@ public function listListingsTest() // Mock response $nextPageToken = ''; $listingsElement = new Listing(); - $listings = [ - $listingsElement, - ]; + $listings = [$listingsElement]; $expectedResponse = new ListListingsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setListings($listings); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - $request = (new ListListingsRequest()) - ->setParent($formattedParent); + $request = (new ListListingsRequest())->setParent($formattedParent); $response = $gapicClient->listListings($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -719,7 +752,10 @@ public function listListingsTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListListings', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListListings', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -736,17 +772,19 @@ public function listListingsExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->dataExchangeName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]'); - $request = (new ListListingsRequest()) - ->setParent($formattedParent); + $request = (new ListListingsRequest())->setParent($formattedParent); try { $gapicClient->listListings($request); // If the $gapicClient method call did not throw, fail the test @@ -771,17 +809,14 @@ public function listOrgDataExchangesTest() // Mock response $nextPageToken = ''; $dataExchangesElement = new DataExchange(); - $dataExchanges = [ - $dataExchangesElement, - ]; + $dataExchanges = [$dataExchangesElement]; $expectedResponse = new ListOrgDataExchangesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setDataExchanges($dataExchanges); $transport->addResponse($expectedResponse); // Mock request $organization = 'organization1178922291'; - $request = (new ListOrgDataExchangesRequest()) - ->setOrganization($organization); + $request = (new ListOrgDataExchangesRequest())->setOrganization($organization); $response = $gapicClient->listOrgDataExchanges($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -791,7 +826,10 @@ public function listOrgDataExchangesTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListOrgDataExchanges', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListOrgDataExchanges', + $actualFuncCall + ); $actualValue = $actualRequestObject->getOrganization(); $this->assertProtobufEquals($organization, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -808,17 +846,19 @@ public function listOrgDataExchangesExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $organization = 'organization1178922291'; - $request = (new ListOrgDataExchangesRequest()) - ->setOrganization($organization); + $request = (new ListOrgDataExchangesRequest())->setOrganization($organization); try { $gapicClient->listOrgDataExchanges($request); // If the $gapicClient method call did not throw, fail the test @@ -850,16 +890,17 @@ public function setIamPolicyTest() // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); $response = $gapicClient->setIamPolicy($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.bigquery.dataexchange.v1beta1.AnalyticsHubService/SetIamPolicy', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/SetIamPolicy', + $actualFuncCall + ); $actualValue = $actualRequestObject->getResource(); $this->assertProtobufEquals($resource, $actualValue); $actualValue = $actualRequestObject->getPolicy(); @@ -878,19 +919,20 @@ public function setIamPolicyExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); + $request = (new SetIamPolicyRequest())->setResource($resource)->setPolicy($policy); try { $gapicClient->setIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -917,15 +959,17 @@ public function subscribeListingTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - $request = (new SubscribeListingRequest()) - ->setName($formattedName); + $request = (new SubscribeListingRequest())->setName($formattedName); $response = $gapicClient->subscribeListing($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.bigquery.dataexchange.v1beta1.AnalyticsHubService/SubscribeListing', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/SubscribeListing', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -942,17 +986,19 @@ public function subscribeListingExceptionTest() $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); + $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->listingName('[PROJECT]', '[LOCATION]', '[DATA_EXCHANGE]', '[LISTING]'); - $request = (new SubscribeListingRequest()) - ->setName($formattedName); + $request = (new SubscribeListingRequest())->setName($formattedName); try { $gapicClient->subscribeListing($request); // If the $gapicClient method call did not throw, fail the test @@ -980,16 +1026,17 @@ public function testIamPermissionsTest() // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); $response = $gapicClient->testIamPermissions($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.bigquery.dataexchange.v1beta1.AnalyticsHubService/TestIamPermissions', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/TestIamPermissions', + $actualFuncCall + ); $actualValue = $actualRequestObject->getResource(); $this->assertProtobufEquals($resource, $actualValue); $actualValue = $actualRequestObject->getPermissions(); @@ -1008,19 +1055,20 @@ public function testIamPermissionsExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $resource = 'resource-341064690'; $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); + $request = (new TestIamPermissionsRequest())->setResource($resource)->setPermissions($permissions); try { $gapicClient->testIamPermissions($request); // If the $gapicClient method call did not throw, fail the test @@ -1064,16 +1112,17 @@ public function updateDataExchangeTest() $dataExchange = new DataExchange(); $dataExchangeDisplayName = 'dataExchangeDisplayName-1195270080'; $dataExchange->setDisplayName($dataExchangeDisplayName); - $request = (new UpdateDataExchangeRequest()) - ->setUpdateMask($updateMask) - ->setDataExchange($dataExchange); + $request = (new UpdateDataExchangeRequest())->setUpdateMask($updateMask)->setDataExchange($dataExchange); $response = $gapicClient->updateDataExchange($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.bigquery.dataexchange.v1beta1.AnalyticsHubService/UpdateDataExchange', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/UpdateDataExchange', + $actualFuncCall + ); $actualValue = $actualRequestObject->getUpdateMask(); $this->assertProtobufEquals($updateMask, $actualValue); $actualValue = $actualRequestObject->getDataExchange(); @@ -1092,21 +1141,22 @@ public function updateDataExchangeExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $updateMask = new FieldMask(); $dataExchange = new DataExchange(); $dataExchangeDisplayName = 'dataExchangeDisplayName-1195270080'; $dataExchange->setDisplayName($dataExchangeDisplayName); - $request = (new UpdateDataExchangeRequest()) - ->setUpdateMask($updateMask) - ->setDataExchange($dataExchange); + $request = (new UpdateDataExchangeRequest())->setUpdateMask($updateMask)->setDataExchange($dataExchange); try { $gapicClient->updateDataExchange($request); // If the $gapicClient method call did not throw, fail the test @@ -1152,16 +1202,17 @@ public function updateListingTest() $listing->setDisplayName($listingDisplayName); $listingBigqueryDataset = new BigQueryDatasetSource(); $listing->setBigqueryDataset($listingBigqueryDataset); - $request = (new UpdateListingRequest()) - ->setUpdateMask($updateMask) - ->setListing($listing); + $request = (new UpdateListingRequest())->setUpdateMask($updateMask)->setListing($listing); $response = $gapicClient->updateListing($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.bigquery.dataexchange.v1beta1.AnalyticsHubService/UpdateListing', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/UpdateListing', + $actualFuncCall + ); $actualValue = $actualRequestObject->getUpdateMask(); $this->assertProtobufEquals($updateMask, $actualValue); $actualValue = $actualRequestObject->getListing(); @@ -1180,12 +1231,15 @@ public function updateListingExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $updateMask = new FieldMask(); @@ -1194,9 +1248,7 @@ public function updateListingExceptionTest() $listing->setDisplayName($listingDisplayName); $listingBigqueryDataset = new BigQueryDatasetSource(); $listing->setBigqueryDataset($listingBigqueryDataset); - $request = (new UpdateListingRequest()) - ->setUpdateMask($updateMask) - ->setListing($listing); + $request = (new UpdateListingRequest())->setUpdateMask($updateMask)->setListing($listing); try { $gapicClient->updateListing($request); // If the $gapicClient method call did not throw, fail the test @@ -1249,12 +1301,15 @@ public function getLocationExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -1281,9 +1336,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -1313,12 +1366,15 @@ public function listLocationsExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -1375,7 +1431,10 @@ public function createDataExchangeAsyncTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/CreateDataExchange', $actualFuncCall); + $this->assertSame( + '/google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/CreateDataExchange', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualRequestObject->getDataExchangeId(); From 450b6a8f2c0b8a7ae9c3ba5048e895e7af7fefa7 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Wed, 18 Dec 2024 00:21:06 +0000 Subject: [PATCH 2/2] revert to preview --- .repo-metadata-full.json | 4 ++-- BigQueryDataExchange/README.md | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index 38dda9fecfa5..47293b0e4b2a 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -282,7 +282,7 @@ "BigQueryDataExchange": { "language": "php", "distribution_name": "google/cloud-bigquery-data-exchange", - "release_level": "stable", + "release_level": "preview", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-bigquery-data-exchange/latest", "library_type": "GAPIC_AUTO", "api_shortname": "analyticshub" @@ -1599,4 +1599,4 @@ "library_type": "GAPIC_AUTO", "api_shortname": "workflows" } -} \ No newline at end of file +} diff --git a/BigQueryDataExchange/README.md b/BigQueryDataExchange/README.md index ed90ad866b70..4c4046ca278d 100644 --- a/BigQueryDataExchange/README.md +++ b/BigQueryDataExchange/README.md @@ -35,8 +35,9 @@ for more information about the debugging tools. ### Version -This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in -any minor or patch releases. We will address issues and requests with the highest priority. +This component is considered beta. As such, it should be expected to be mostly +stable and we're working towards a release candidate. We will address issues +and requests with a higher priority. ### Next Steps