From 793782873bd0bef8dd75f779b70d1e792e5930e8 Mon Sep 17 00:00:00 2001 From: michaelbausor Date: Fri, 30 Mar 2018 13:39:15 -0700 Subject: [PATCH] Add iot (#937) * Add iot generated client * Run component CLI * Update proto-client version * Add partial veneer to DeviceManagerClient to default to rest transport * Address PR comments * Fix phpcs errors * Update Iot to new structure * Add Iot to composer * Update composer and PR template * Update gax version * Pin Travis version to 7.0.25 * Revert travis php version to 7.0 --- BigQueryDataTransfer/composer.json | 2 +- Bigtable/composer.json | 4 +- Container/composer.json | 4 +- Core/composer.json | 2 +- Dataproc/composer.json | 4 +- Dlp/composer.json | 4 +- ErrorReporting/composer.json | 4 +- Firestore/composer.json | 4 +- Iot/.github/pull_request_template.md | 24 + Iot/CONTRIBUTING.md | 10 + Iot/LICENSE | 202 +++ Iot/README.md | 24 + Iot/VERSION | 1 + Iot/composer.json | 26 + Iot/phpunit-snippets.xml.dist | 19 + Iot/phpunit-system.xml.dist | 16 + Iot/phpunit.xml.dist | 16 + Iot/src/V1/DeviceManagerClient.php | 58 + Iot/src/V1/Gapic/DeviceManagerGapicClient.php | 1325 +++++++++++++++++ Iot/src/V1/README.md | 24 + .../device_manager_client_config.json | 120 ++ .../device_manager_descriptor_config.php | 28 + .../device_manager_rest_client_config.php | 194 +++ Language/composer.json | 4 +- Logging/composer.json | 4 +- Monitoring/composer.json | 4 +- OsLogin/composer.json | 4 +- PubSub/composer.json | 4 +- Spanner/composer.json | 4 +- Speech/composer.json | 4 +- Trace/composer.json | 4 +- VideoIntelligence/composer.json | 4 +- Vision/composer.json | 4 +- composer.json | 7 +- docs/contents/cloud-iot.json | 18 + docs/contents/google-cloud.json | 1 + docs/manifest.json | 8 + 37 files changed, 2153 insertions(+), 36 deletions(-) create mode 100644 Iot/.github/pull_request_template.md create mode 100644 Iot/CONTRIBUTING.md create mode 100644 Iot/LICENSE create mode 100644 Iot/README.md create mode 100644 Iot/VERSION create mode 100644 Iot/composer.json create mode 100644 Iot/phpunit-snippets.xml.dist create mode 100644 Iot/phpunit-system.xml.dist create mode 100644 Iot/phpunit.xml.dist create mode 100644 Iot/src/V1/DeviceManagerClient.php create mode 100644 Iot/src/V1/Gapic/DeviceManagerGapicClient.php create mode 100644 Iot/src/V1/README.md create mode 100644 Iot/src/V1/resources/device_manager_client_config.json create mode 100644 Iot/src/V1/resources/device_manager_descriptor_config.php create mode 100644 Iot/src/V1/resources/device_manager_rest_client_config.php create mode 100644 docs/contents/cloud-iot.json diff --git a/BigQueryDataTransfer/composer.json b/BigQueryDataTransfer/composer.json index 082c3ec48ff3..36ec25f22e87 100644 --- a/BigQueryDataTransfer/composer.json +++ b/BigQueryDataTransfer/composer.json @@ -18,7 +18,7 @@ }, "require": { "google/proto-client": "^0.35", - "google/gax": "^0.30" + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Bigtable/composer.json b/Bigtable/composer.json index 6f946108b453..28a0e73b7361 100644 --- a/Bigtable/composer.json +++ b/Bigtable/composer.json @@ -4,8 +4,8 @@ "license": "Apache-2.0", "minimum-stability": "stable", "require": { - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Container/composer.json b/Container/composer.json index 52e186ebf35a..b38c12c0a77a 100644 --- a/Container/composer.json +++ b/Container/composer.json @@ -17,8 +17,8 @@ } }, "require": { - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Core/composer.json b/Core/composer.json index e148e7b388ef..39941948766f 100644 --- a/Core/composer.json +++ b/Core/composer.json @@ -17,7 +17,7 @@ "squizlabs/php_codesniffer": "2.*", "phpdocumentor/reflection": "^3.0", "erusev/parsedown": "^1.6", - "google/gax": "^0.30", + "google/gax": "^0.31", "opis/closure": "^3" }, "suggest": { diff --git a/Dataproc/composer.json b/Dataproc/composer.json index 5272d4fc8c9a..7bdd093161f5 100644 --- a/Dataproc/composer.json +++ b/Dataproc/composer.json @@ -17,8 +17,8 @@ } }, "require": { - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Dlp/composer.json b/Dlp/composer.json index bb1f96efe45e..af49ecf54b96 100644 --- a/Dlp/composer.json +++ b/Dlp/composer.json @@ -4,8 +4,8 @@ "license": "Apache-2.0", "minimum-stability": "stable", "require": { - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/ErrorReporting/composer.json b/ErrorReporting/composer.json index 6f10e61240e8..21729c1a10a5 100644 --- a/ErrorReporting/composer.json +++ b/ErrorReporting/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "google/cloud-logging": "^1.5.0", - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Firestore/composer.json b/Firestore/composer.json index 132b91876c46..15cbb27eab0d 100644 --- a/Firestore/composer.json +++ b/Firestore/composer.json @@ -6,8 +6,8 @@ "require": { "ext-grpc": "*", "google/cloud-core": "^1.14", - "google/gax": "^0.30", - "google/proto-client": "^0.34", + "google/gax": "^0.31", + "google/proto-client": "^0.35", "ramsey/uuid": "~3" }, "require-dev": { diff --git a/Iot/.github/pull_request_template.md b/Iot/.github/pull_request_template.md new file mode 100644 index 000000000000..04093e64c745 --- /dev/null +++ b/Iot/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `Iot/src`, and tests in `Iot/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/GoogleCloudPlatform/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/Iot/CONTRIBUTING.md b/Iot/CONTRIBUTING.md new file mode 100644 index 000000000000..00c1af7ae310 --- /dev/null +++ b/Iot/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. We accept +and review pull requests against the main +[Google Cloud PHP](https://github.com/GoogleCloudPlatform/google-cloud-php) +repository, which contains all of our client libraries. You will also need to +sign a Contributor License Agreement. For more details about how to contribute, +see the +[CONTRIBUTING.md](https://github.com/GoogleCloudPlatform/google-cloud-php/blob/master/CONTRIBUTING.md) +file in the main Google Cloud PHP repository. diff --git a/Iot/LICENSE b/Iot/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/Iot/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/Iot/README.md b/Iot/README.md new file mode 100644 index 000000000000..f48a0058b841 --- /dev/null +++ b/Iot/README.md @@ -0,0 +1,24 @@ +# Google Cloud IoT Core for PHP + +> Idiomatic PHP client for [Google Cloud IoT Core](https://cloud.google.com/iot-core/). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-iot/v/stable)](https://packagist.org/packages/google/cloud-iot) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-iot.svg)](https://packagist.org/packages/google/cloud-iot) + +* [Homepage](http://googlecloudplatform.github.io/google-cloud-php) +* [API documentation](http://googlecloudplatform.github.io/google-cloud-php/#/docs/cloud-iot/latest/readme) + +**NOTE:** This repository a Read-Only subtree split of +[Google Cloud PHP](https://github.com/googlecloudplatform/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. Additional tests and build information can also be found at the +parent project. + +If it is not already installed, you will also require the gRPC extension. For installation instructions, [see here](https://cloud.google.com/php/grpc). + +NOTE: In addition to the gRPC extension, we recommend installing the protobuf extension for improved performance. For installation instructions, [see here](https://cloud.google.com/php/grpc#install_the_protobuf_runtime_library). + +## Installation + +``` +$ composer require google/cloud-iot +``` diff --git a/Iot/VERSION b/Iot/VERSION new file mode 100644 index 000000000000..6e8bf73aa550 --- /dev/null +++ b/Iot/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/Iot/composer.json b/Iot/composer.json new file mode 100644 index 000000000000..a5e75dc9873f --- /dev/null +++ b/Iot/composer.json @@ -0,0 +1,26 @@ +{ + "name": "google/cloud-iot", + "description": "Google Cloud IoT Core Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Cloud\\Iot\\": "" + } + }, + "extra": { + "component": { + "id": "cloud-iot", + "path": "Iot", + "entry": null, + "target": "GoogleCloudPlatform/google-cloud-php-iot.git" + } + }, + "require": { + "google/proto-client": "^0.35", + "google/gax": "^0.31" + }, + "suggest": { + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." + } +} diff --git a/Iot/phpunit-snippets.xml.dist b/Iot/phpunit-snippets.xml.dist new file mode 100644 index 000000000000..b92fd83e3c1b --- /dev/null +++ b/Iot/phpunit-snippets.xml.dist @@ -0,0 +1,19 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Iot/phpunit-system.xml.dist b/Iot/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Iot/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Iot/phpunit.xml.dist b/Iot/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Iot/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Iot/src/V1/DeviceManagerClient.php b/Iot/src/V1/DeviceManagerClient.php new file mode 100644 index 000000000000..b499010b0df0 --- /dev/null +++ b/Iot/src/V1/DeviceManagerClient.php @@ -0,0 +1,58 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $deviceRegistry = new DeviceRegistry(); + * $response = $deviceManagerClient->createDeviceRegistry($formattedParent, $deviceRegistry); + * } finally { + * $deviceManagerClient->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 + */ +class DeviceManagerGapicClient +{ + use GapicClientTrait; + + /** + * The name of the service. + */ + const SERVICE_NAME = 'google.cloud.iot.v1.DeviceManager'; + + /** + * The default address of the service. + */ + const SERVICE_ADDRESS = 'cloudiot.googleapis.com'; + + /** + * The default port of the service. + */ + const DEFAULT_SERVICE_PORT = 443; + + /** + * The name of the code generator, to be included in the agent header. + */ + const CODEGEN_NAME = 'gapic'; + + /** + * The code generator version, to be included in the agent header. + */ + const CODEGEN_VERSION = '0.0.5'; + + private static $locationNameTemplate; + private static $registryNameTemplate; + private static $deviceNameTemplate; + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'serviceAddress' => self::SERVICE_ADDRESS, + 'port' => self::DEFAULT_SERVICE_PORT, + 'scopes' => [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloudiot', + ], + 'clientConfigPath' => __DIR__.'/../resources/device_manager_client_config.json', + 'restClientConfigPath' => __DIR__.'/../resources/device_manager_rest_client_config.php', + 'descriptorsConfigPath' => __DIR__.'/../resources/device_manager_descriptor_config.php', + 'versionFile' => __DIR__.'/../../VERSION', + ]; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getRegistryNameTemplate() + { + if (self::$registryNameTemplate == null) { + self::$registryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/registries/{registry}'); + } + + return self::$registryNameTemplate; + } + + private static function getDeviceNameTemplate() + { + if (self::$deviceNameTemplate == null) { + self::$deviceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/registries/{registry}/devices/{device}'); + } + + return self::$deviceNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'location' => self::getLocationNameTemplate(), + 'registry' => self::getRegistryNameTemplate(), + 'device' => self::getDeviceNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * 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, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a registry resource. + * + * @param string $project + * @param string $location + * @param string $registry + * + * @return string The formatted registry resource. + * @experimental + */ + public static function registryName($project, $location, $registry) + { + return self::getRegistryNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'registry' => $registry, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a device resource. + * + * @param string $project + * @param string $location + * @param string $registry + * @param string $device + * + * @return string The formatted device resource. + * @experimental + */ + public static function deviceName($project, $location, $registry, $device) + { + return self::getDeviceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'registry' => $registry, + 'device' => $device, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - location: projects/{project}/locations/{location} + * - registry: projects/{project}/locations/{location}/registries/{registry} + * - device: projects/{project}/locations/{location}/registries/{registry}/devices/{device}. + * + * 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 $serviceAddress The domain name of the API remote host. + * Default 'cloudiot.googleapis.com'. + * @type mixed $port The port on which to connect to the remote host. Default 443. + * @type Channel $channel + * A `Channel` object. If not specified, a channel will be constructed. + * NOTE: This option is only valid when utilizing the gRPC transport. + * @type ChannelCredentials $sslCreds + * A `ChannelCredentials` object for use with an SSL-enabled channel. + * Default: a credentials object returned from + * \Grpc\ChannelCredentials::createSsl(). + * NOTE: This option is only valid when utilizing the gRPC transport. Also, if the $channel + * optional argument is specified, then this argument is unused. + * @type bool $forceNewChannel + * If true, this forces gRPC to create a new channel instead of using a persistent channel. + * Defaults to false. + * NOTE: This option is only valid when utilizing the gRPC transport. Also, if the $channel + * optional argument is specified, then this option is unused. + * @type CredentialsLoader $credentialsLoader + * A CredentialsLoader object created using the Google\Auth library. + * @type string[] $scopes A string array of scopes to use when acquiring credentials. + * Defaults to the scopes for the Google Cloud IoT API. + * @type string $clientConfigPath + * Path to a JSON file containing client method configuration, including retry settings. + * Specify this setting to specify the retry behavior of all methods on the client. + * By default this settings points to the default client config file, which is provided + * in the resources folder. The retry settings provided in this option can be overridden + * by settings in $retryingOverride + * @type array $retryingOverride + * An associative array in which the keys are method names (e.g. 'createFoo'), and + * the values are retry settings to use for that method. The retry settings for each + * method can be a {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on {@see Google\ApiCore\RetrySettings} + * for example usage. Passing a value of null is equivalent to a value of + * ['retriesEnabled' => false]. Retry settings provided in this setting override the + * settings in $clientConfigPath. + * @type callable $authHttpHandler A handler used to deliver PSR-7 requests specifically + * for authentication. Should match a signature of + * `function (RequestInterface $request, array $options) : ResponseInterface`. + * @type callable $httpHandler A handler used to deliver PSR-7 requests. Should match a + * signature of `function (RequestInterface $request, array $options) : PromiseInterface`. + * NOTE: This option is only valid when utilizing the REST transport. + * @type string|TransportInterface $transport The transport used for executing network + * requests. May be either the string `rest` or `grpc`. Additionally, it is possible + * to pass in an already instantiated transport. Defaults to `grpc` if gRPC support is + * detected on the system. + * } + * @experimental + */ + public function __construct($options = []) + { + $this->setClientOptions($options + self::getClientDefaults()); + } + + /** + * Creates a device registry that contains devices. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedParent = $deviceManagerClient->locationName('[PROJECT]', '[LOCATION]'); + * $deviceRegistry = new DeviceRegistry(); + * $response = $deviceManagerClient->createDeviceRegistry($formattedParent, $deviceRegistry); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $parent The project and cloud region where this device registry must be created. + * For example, `projects/example-project/locations/us-central1`. + * @param DeviceRegistry $deviceRegistry The device registry. The field `name` must be empty. The server will + * generate that field from the device registry `id` provided and the + * `parent` field. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iot\V1\DeviceRegistry + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function createDeviceRegistry($parent, $deviceRegistry, $optionalArgs = []) + { + $request = new CreateDeviceRegistryRequest(); + $request->setParent($parent); + $request->setDeviceRegistry($deviceRegistry); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'CreateDeviceRegistry', + DeviceRegistry::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets a device registry configuration. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedName = $deviceManagerClient->registryName('[PROJECT]', '[LOCATION]', '[REGISTRY]'); + * $response = $deviceManagerClient->getDeviceRegistry($formattedName); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $name The name of the device registry. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iot\V1\DeviceRegistry + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function getDeviceRegistry($name, $optionalArgs = []) + { + $request = new GetDeviceRegistryRequest(); + $request->setName($name); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'GetDeviceRegistry', + DeviceRegistry::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Updates a device registry configuration. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $deviceRegistry = new DeviceRegistry(); + * $updateMask = new FieldMask(); + * $response = $deviceManagerClient->updateDeviceRegistry($deviceRegistry, $updateMask); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param DeviceRegistry $deviceRegistry The new values for the device registry. The `id` field must be empty, and + * the `name` field must indicate the path of the resource. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + * @param FieldMask $updateMask Only updates the `device_registry` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * Mutable top-level fields: `event_notification_config`, `http_config`, + * `mqtt_config`, and `state_notification_config`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iot\V1\DeviceRegistry + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function updateDeviceRegistry($deviceRegistry, $updateMask, $optionalArgs = []) + { + $request = new UpdateDeviceRegistryRequest(); + $request->setDeviceRegistry($deviceRegistry); + $request->setUpdateMask($updateMask); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'device_registry.name' => $request->getDeviceRegistry()->getName(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'UpdateDeviceRegistry', + DeviceRegistry::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Deletes a device registry configuration. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedName = $deviceManagerClient->registryName('[PROJECT]', '[LOCATION]', '[REGISTRY]'); + * $deviceManagerClient->deleteDeviceRegistry($formattedName); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $name The name of the device registry. For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function deleteDeviceRegistry($name, $optionalArgs = []) + { + $request = new DeleteDeviceRegistryRequest(); + $request->setName($name); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'DeleteDeviceRegistry', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Lists device registries. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedParent = $deviceManagerClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate through all elements + * $pagedResponse = $deviceManagerClient->listDeviceRegistries($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * + * // OR iterate over pages of elements + * $pagedResponse = $deviceManagerClient->listDeviceRegistries($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $parent The project and cloud region path. For example, + * `projects/example-project/locations/us-central1`. + * @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 Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listDeviceRegistries($parent, $optionalArgs = []) + { + $request = new ListDeviceRegistriesRequest(); + $request->setParent($parent); + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->getPagedListResponse( + 'ListDeviceRegistries', + $optionalArgs, + ListDeviceRegistriesResponse::class, + $request + ); + } + + /** + * Creates a device in a device registry. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedParent = $deviceManagerClient->registryName('[PROJECT]', '[LOCATION]', '[REGISTRY]'); + * $device = new Device(); + * $response = $deviceManagerClient->createDevice($formattedParent, $device); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $parent The name of the device registry where this device should be created. + * For example, + * `projects/example-project/locations/us-central1/registries/my-registry`. + * @param Device $device The device registration details. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iot\V1\Device + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function createDevice($parent, $device, $optionalArgs = []) + { + $request = new CreateDeviceRequest(); + $request->setParent($parent); + $request->setDevice($device); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'CreateDevice', + Device::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets details about a device. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedName = $deviceManagerClient->deviceName('[PROJECT]', '[LOCATION]', '[REGISTRY]', '[DEVICE]'); + * $response = $deviceManagerClient->getDevice($formattedName); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $name The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $fieldMask + * The fields of the `Device` resource to be returned in the response. If the + * field mask is unset or empty, all fields are returned. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iot\V1\Device + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function getDevice($name, $optionalArgs = []) + { + $request = new GetDeviceRequest(); + $request->setName($name); + if (isset($optionalArgs['fieldMask'])) { + $request->setFieldMask($optionalArgs['fieldMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'GetDevice', + Device::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Updates a device. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $device = new Device(); + * $updateMask = new FieldMask(); + * $response = $deviceManagerClient->updateDevice($device, $updateMask); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param Device $device The new values for the device registry. The `id` and `num_id` fields must + * be empty, and the field `name` must specify the name path. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + * @param FieldMask $updateMask Only updates the `device` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * Mutable top-level fields: `credentials`, `enabled_state`, and `metadata` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iot\V1\Device + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function updateDevice($device, $updateMask, $optionalArgs = []) + { + $request = new UpdateDeviceRequest(); + $request->setDevice($device); + $request->setUpdateMask($updateMask); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'device.name' => $request->getDevice()->getName(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'UpdateDevice', + Device::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Deletes a device. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedName = $deviceManagerClient->deviceName('[PROJECT]', '[LOCATION]', '[REGISTRY]', '[DEVICE]'); + * $deviceManagerClient->deleteDevice($formattedName); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $name The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function deleteDevice($name, $optionalArgs = []) + { + $request = new DeleteDeviceRequest(); + $request->setName($name); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'DeleteDevice', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * List devices in a device registry. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedParent = $deviceManagerClient->registryName('[PROJECT]', '[LOCATION]', '[REGISTRY]'); + * // Iterate through all elements + * $pagedResponse = $deviceManagerClient->listDevices($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * + * // OR iterate over pages of elements + * $pagedResponse = $deviceManagerClient->listDevices($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $parent The device registry path. Required. For example, + * `projects/my-project/locations/us-central1/registries/my-registry`. + * @param array $optionalArgs { + * Optional. + * + * @type int[] $deviceNumIds + * A list of device numerical ids. If empty, it will ignore this field. This + * field cannot hold more than 10,000 entries. + * @type string[] $deviceIds + * A list of device string identifiers. If empty, it will ignore this field. + * For example, `['device0', 'device12']`. This field cannot hold more than + * 10,000 entries. + * @type FieldMask $fieldMask + * The fields of the `Device` resource to be returned in the response. The + * fields `id`, and `num_id` are always returned by default, along with any + * other fields specified. + * @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 Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listDevices($parent, $optionalArgs = []) + { + $request = new ListDevicesRequest(); + $request->setParent($parent); + if (isset($optionalArgs['deviceNumIds'])) { + $request->setDeviceNumIds($optionalArgs['deviceNumIds']); + } + if (isset($optionalArgs['deviceIds'])) { + $request->setDeviceIds($optionalArgs['deviceIds']); + } + if (isset($optionalArgs['fieldMask'])) { + $request->setFieldMask($optionalArgs['fieldMask']); + } + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->getPagedListResponse( + 'ListDevices', + $optionalArgs, + ListDevicesResponse::class, + $request + ); + } + + /** + * Modifies the configuration for the device, which is eventually sent from + * the Cloud IoT Core servers. Returns the modified configuration version and + * its metadata. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedName = $deviceManagerClient->deviceName('[PROJECT]', '[LOCATION]', '[REGISTRY]', '[DEVICE]'); + * $binaryData = ''; + * $response = $deviceManagerClient->modifyCloudToDeviceConfig($formattedName, $binaryData); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $name The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + * @param string $binaryData The configuration data for the device. + * @param array $optionalArgs { + * Optional. + * + * @type int $versionToUpdate + * The version number to update. If this value is zero, it will not check the + * version number of the server and will always update the current version; + * otherwise, this update will fail if the version number found on the server + * does not match this version number. This is used to support multiple + * simultaneous updates without losing data. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iot\V1\DeviceConfig + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function modifyCloudToDeviceConfig($name, $binaryData, $optionalArgs = []) + { + $request = new ModifyCloudToDeviceConfigRequest(); + $request->setName($name); + $request->setBinaryData($binaryData); + if (isset($optionalArgs['versionToUpdate'])) { + $request->setVersionToUpdate($optionalArgs['versionToUpdate']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'ModifyCloudToDeviceConfig', + DeviceConfig::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Lists the last few versions of the device configuration in descending + * order (i.e.: newest first). + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedName = $deviceManagerClient->deviceName('[PROJECT]', '[LOCATION]', '[REGISTRY]', '[DEVICE]'); + * $response = $deviceManagerClient->listDeviceConfigVersions($formattedName); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $name The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $numVersions + * The number of versions to list. Versions are listed in decreasing order of + * the version number. The maximum number of versions retained is 10. If this + * value is zero, it will return all the versions available. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iot\V1\ListDeviceConfigVersionsResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listDeviceConfigVersions($name, $optionalArgs = []) + { + $request = new ListDeviceConfigVersionsRequest(); + $request->setName($name); + if (isset($optionalArgs['numVersions'])) { + $request->setNumVersions($optionalArgs['numVersions']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'ListDeviceConfigVersions', + ListDeviceConfigVersionsResponse::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Lists the last few versions of the device state in descending order (i.e.: + * newest first). + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedName = $deviceManagerClient->deviceName('[PROJECT]', '[LOCATION]', '[REGISTRY]', '[DEVICE]'); + * $response = $deviceManagerClient->listDeviceStates($formattedName); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $name The name of the device. For example, + * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or + * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $numStates + * The number of states to list. States are listed in descending order of + * update time. The maximum number of states retained is 10. If this + * value is zero, it will return all the states available. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iot\V1\ListDeviceStatesResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listDeviceStates($name, $optionalArgs = []) + { + $request = new ListDeviceStatesRequest(); + $request->setName($name); + if (isset($optionalArgs['numStates'])) { + $request->setNumStates($optionalArgs['numStates']); + } + + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'ListDeviceStates', + ListDeviceStatesResponse::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces any + * existing policy. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedResource = $deviceManagerClient->registryName('[PROJECT]', '[LOCATION]', '[REGISTRY]'); + * $policy = new Policy(); + * $response = $deviceManagerClient->setIamPolicy($formattedResource, $policy); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * `resource` is usually specified as a path. For example, a Project + * resource is specified as `projects/{project}`. + * @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 RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function setIamPolicy($resource, $policy, $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $request->setResource($resource); + $request->setPolicy($policy); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'resource' => $request->getResource(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'SetIamPolicy', + Policy::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets the access control policy for a resource. + * Returns an empty policy if the resource exists and does not have a policy + * set. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedResource = $deviceManagerClient->registryName('[PROJECT]', '[LOCATION]', '[REGISTRY]'); + * $response = $deviceManagerClient->getIamPolicy($formattedResource); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * `resource` is usually specified as a path. For example, a Project + * resource is specified as `projects/{project}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function getIamPolicy($resource, $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $request->setResource($resource); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'resource' => $request->getResource(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'GetIamPolicy', + Policy::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. + * If the resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Sample code: + * ``` + * $deviceManagerClient = new DeviceManagerClient(); + * try { + * $formattedResource = $deviceManagerClient->registryName('[PROJECT]', '[LOCATION]', '[REGISTRY]'); + * $permissions = []; + * $response = $deviceManagerClient->testIamPermissions($formattedResource, $permissions); + * } finally { + * $deviceManagerClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * `resource` is usually specified as a path. For example, a Project + * resource is specified as `projects/{project}`. + * @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 Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function testIamPermissions($resource, $permissions, $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $request->setResource($resource); + $request->setPermissions($permissions); + + $requestParams = new RequestParamsHeaderDescriptor([ + 'resource' => $request->getResource(), + ]); + $optionalArgs['userHeaders'] = isset($optionalArgs['userHeaders']) + ? array_merge($requestParams->getHeader(), $optionalArgs['userHeaders']) + : $requestParams->getHeader(); + + return $this->startCall( + 'TestIamPermissions', + TestIamPermissionsResponse::class, + $optionalArgs, + $request + )->wait(); + } +} diff --git a/Iot/src/V1/README.md b/Iot/src/V1/README.md new file mode 100644 index 000000000000..f48a0058b841 --- /dev/null +++ b/Iot/src/V1/README.md @@ -0,0 +1,24 @@ +# Google Cloud IoT Core for PHP + +> Idiomatic PHP client for [Google Cloud IoT Core](https://cloud.google.com/iot-core/). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-iot/v/stable)](https://packagist.org/packages/google/cloud-iot) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-iot.svg)](https://packagist.org/packages/google/cloud-iot) + +* [Homepage](http://googlecloudplatform.github.io/google-cloud-php) +* [API documentation](http://googlecloudplatform.github.io/google-cloud-php/#/docs/cloud-iot/latest/readme) + +**NOTE:** This repository a Read-Only subtree split of +[Google Cloud PHP](https://github.com/googlecloudplatform/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. Additional tests and build information can also be found at the +parent project. + +If it is not already installed, you will also require the gRPC extension. For installation instructions, [see here](https://cloud.google.com/php/grpc). + +NOTE: In addition to the gRPC extension, we recommend installing the protobuf extension for improved performance. For installation instructions, [see here](https://cloud.google.com/php/grpc#install_the_protobuf_runtime_library). + +## Installation + +``` +$ composer require google/cloud-iot +``` diff --git a/Iot/src/V1/resources/device_manager_client_config.json b/Iot/src/V1/resources/device_manager_client_config.json new file mode 100644 index 000000000000..028934968df3 --- /dev/null +++ b/Iot/src/V1/resources/device_manager_client_config.json @@ -0,0 +1,120 @@ +{ + "interfaces": { + "google.cloud.iot.v1.DeviceManager": { + "retry_codes": { + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "non_idempotent": [], + "rate_limited_aware": [ + "DEADLINE_EXCEEDED", + "RESOURCE_EXHAUSTED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 20000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 20000, + "total_timeout_millis": 120000 + }, + "rate_limited_aware": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 20000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 20000, + "total_timeout_millis": 120000 + } + }, + "methods": { + "CreateDeviceRegistry": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDeviceRegistry": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateDeviceRegistry": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteDeviceRegistry": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListDeviceRegistries": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateDevice": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDevice": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateDevice": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteDevice": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListDevices": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ModifyCloudToDeviceConfig": { + "timeout_millis": 60000, + "retry_codes_name": "rate_limited_aware", + "retry_params_name": "rate_limited_aware" + }, + "ListDeviceConfigVersions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListDeviceStates": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/Iot/src/V1/resources/device_manager_descriptor_config.php b/Iot/src/V1/resources/device_manager_descriptor_config.php new file mode 100644 index 000000000000..af9ad00a9bc3 --- /dev/null +++ b/Iot/src/V1/resources/device_manager_descriptor_config.php @@ -0,0 +1,28 @@ + [ + 'google.cloud.iot.v1.DeviceManager' => [ + 'ListDeviceRegistries' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getDeviceRegistries', + ], + ], + 'ListDevices' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getDevices', + ], + ], + ], + ], +]; diff --git a/Iot/src/V1/resources/device_manager_rest_client_config.php b/Iot/src/V1/resources/device_manager_rest_client_config.php new file mode 100644 index 000000000000..3ff5d71c2b90 --- /dev/null +++ b/Iot/src/V1/resources/device_manager_rest_client_config.php @@ -0,0 +1,194 @@ + [ + 'google.cloud.iot.v1.DeviceManager' => [ + 'CreateDeviceRegistry' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/registries', + 'body' => 'device_registry', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetDeviceRegistry' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/registries/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateDeviceRegistry' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{device_registry.name=projects/*/locations/*/registries/*}', + 'body' => 'device_registry', + 'placeholders' => [ + 'device_registry.name' => [ + 'getters' => [ + 'getDeviceRegistry', + 'getName', + ], + ], + ], + ], + 'DeleteDeviceRegistry' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/registries/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListDeviceRegistries' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/registries', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateDevice' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/registries/*}/devices', + 'body' => 'device', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetDevice' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/registries/*/devices/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateDevice' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{device.name=projects/*/locations/*/registries/*/devices/*}', + 'body' => 'device', + 'placeholders' => [ + 'device.name' => [ + 'getters' => [ + 'getDevice', + 'getName', + ], + ], + ], + ], + 'DeleteDevice' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/registries/*/devices/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListDevices' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/registries/*}/devices', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ModifyCloudToDeviceConfig' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/registries/*/devices/*}:modifyCloudToDeviceConfig', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListDeviceConfigVersions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/registries/*/devices/*}/configVersions', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListDeviceStates' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/registries/*/devices/*}/states', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/registries/*}:setIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'GetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/registries/*}:getIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/registries/*}:testIamPermissions', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + ], +]; diff --git a/Language/composer.json b/Language/composer.json index bfd07c09a76b..41abc78ce841 100644 --- a/Language/composer.json +++ b/Language/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Logging/composer.json b/Logging/composer.json index f0b0127f736c..e97ac4e976dc 100644 --- a/Logging/composer.json +++ b/Logging/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Monitoring/composer.json b/Monitoring/composer.json index 38557e7ecd25..3fde59d77ffc 100644 --- a/Monitoring/composer.json +++ b/Monitoring/composer.json @@ -4,8 +4,8 @@ "license": "Apache-2.0", "minimum-stability": "stable", "require": { - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/OsLogin/composer.json b/OsLogin/composer.json index 1380be731918..44ec9a61607c 100644 --- a/OsLogin/composer.json +++ b/OsLogin/composer.json @@ -17,8 +17,8 @@ } }, "require": { - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/PubSub/composer.json b/PubSub/composer.json index 4a4cbc44e72c..daac912c875d 100644 --- a/PubSub/composer.json +++ b/PubSub/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Spanner/composer.json b/Spanner/composer.json index ce249a8e1f19..3f4b004f1829 100644 --- a/Spanner/composer.json +++ b/Spanner/composer.json @@ -6,8 +6,8 @@ "require": { "ext-grpc": "*", "google/cloud-core": "^1.14", - "google/gax": "^0.30", - "google/proto-client": "^0.34" + "google/gax": "^0.31", + "google/proto-client": "^0.35" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Speech/composer.json b/Speech/composer.json index c56ba2a256c4..de18814dcdab 100644 --- a/Speech/composer.json +++ b/Speech/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Trace/composer.json b/Trace/composer.json index bbcda2dd4dfc..4ddd277727b6 100644 --- a/Trace/composer.json +++ b/Trace/composer.json @@ -6,8 +6,8 @@ "require": { "google/cloud-core": "^1.14", "ramsey/uuid": "~3", - "google/gax": "^0.30", - "google/proto-client": "^0.34" + "google/gax": "^0.31", + "google/proto-client": "^0.35" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/VideoIntelligence/composer.json b/VideoIntelligence/composer.json index 3c849132f655..6a7e3f2040db 100644 --- a/VideoIntelligence/composer.json +++ b/VideoIntelligence/composer.json @@ -4,8 +4,8 @@ "license": "Apache-2.0", "minimum-stability": "stable", "require": { - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Vision/composer.json b/Vision/composer.json index 29a9d54f6252..16b87e122374 100644 --- a/Vision/composer.json +++ b/Vision/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/proto-client": "^0.34", - "google/gax": "^0.30" + "google/proto-client": "^0.35", + "google/gax": "^0.31" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/composer.json b/composer.json index cbb5b3dc992c..88f6ea42bf28 100644 --- a/composer.json +++ b/composer.json @@ -48,8 +48,8 @@ "monolog/monolog": "~1", "psr/http-message": "1.0.*", "ramsey/uuid": "~3", - "google/gax": "^0.30", - "google/proto-client": "^0.34" + "google/gax": "^0.31", + "google/proto-client": "^0.35" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", @@ -75,6 +75,7 @@ "google/cloud-dlp": "0.7.0", "google/cloud-error-reporting": "0.9.1", "google/cloud-firestore": "0.6.0", + "google/cloud-iot": "master", "google/cloud-language": "0.13.0", "google/cloud-logging": "1.10.0", "google/cloud-monitoring": "0.9.0", @@ -108,6 +109,7 @@ "Google\\Cloud\\Dlp\\": "Dlp/src", "Google\\Cloud\\ErrorReporting\\": "ErrorReporting/src", "Google\\Cloud\\Firestore\\": "Firestore/src", + "Google\\Cloud\\Iot\\": "Iot/src", "Google\\Cloud\\Language\\": "Language/src", "Google\\Cloud\\Logging\\": "Logging/src", "Google\\Cloud\\Monitoring\\": "Monitoring/src", @@ -137,6 +139,7 @@ "Google\\Cloud\\Dlp\\Tests\\": "Dlp/tests", "Google\\Cloud\\ErrorReporting\\Tests\\": "ErrorReporting/tests", "Google\\Cloud\\Firestore\\Tests\\": "Firestore/tests", + "Google\\Cloud\\Iot\\Tests\\": "Iot/tests", "Google\\Cloud\\Language\\Tests\\": "Language/tests", "Google\\Cloud\\Logging\\Tests\\": "Logging/tests", "Google\\Cloud\\Monitoring\\Tests\\": "Monitoring/tests", diff --git a/docs/contents/cloud-iot.json b/docs/contents/cloud-iot.json new file mode 100644 index 000000000000..3a1a08cf0d0d --- /dev/null +++ b/docs/contents/cloud-iot.json @@ -0,0 +1,18 @@ +{ + "title": "Iot", + "services": [ + { + "title": "Overview", + "type": "iot\/readme" + }, + { + "title": "DeviceManagerClient", + "type": "iot\/v1\/devicemanagerclient", + "nav": [], + "patterns": [ + "iot\/v1\/\\w{1,}" + ] + } + ], + "pattern": "iot\/\\w{1,}" +} diff --git a/docs/contents/google-cloud.json b/docs/contents/google-cloud.json index d7a70eee8b00..c60fbbdd5d76 100644 --- a/docs/contents/google-cloud.json +++ b/docs/contents/google-cloud.json @@ -18,6 +18,7 @@ "cloud-dlp", "cloud-error-reporting", "cloud-firestore", + "cloud-iot", "cloud-language", "cloud-logging", "cloud-monitoring", diff --git a/docs/manifest.json b/docs/manifest.json index 645698801f06..26362323a31d 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -322,6 +322,14 @@ "master" ] }, + { + "id": "cloud-iot", + "name": "google/cloud-iot", + "defaultService": "iot/readme", + "versions": [ + "master" + ] + }, { "id": "cloud-language", "name": "google/cloud-language",