From b311a1d2cb54c5aa98f1bbb878f082cad521747e Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 8 Dec 2017 14:54:27 -0800 Subject: [PATCH 1/6] Add container API --- composer.json | 7 +- docs/contents/cloud-container.json | 18 + docs/contents/google-cloud.json | 17 +- docs/manifest.json | 52 +- src/Container/CONTRIBUTING.md | 10 + src/Container/LICENSE | 202 ++ src/Container/README.md | 18 + src/Container/V1/ClusterManagerClient.php | 42 + .../V1/Gapic/ClusterManagerGapicClient.php | 2322 +++++++++++++++++ src/Container/V1/README.md | 18 + .../cluster_manager_client_config.json | 176 ++ src/Container/composer.json | 24 + 12 files changed, 2874 insertions(+), 32 deletions(-) create mode 100644 docs/contents/cloud-container.json create mode 100644 src/Container/CONTRIBUTING.md create mode 100644 src/Container/LICENSE create mode 100644 src/Container/README.md create mode 100644 src/Container/V1/ClusterManagerClient.php create mode 100644 src/Container/V1/Gapic/ClusterManagerGapicClient.php create mode 100644 src/Container/V1/README.md create mode 100644 src/Container/V1/resources/cluster_manager_client_config.json create mode 100644 src/Container/composer.json diff --git a/composer.json b/composer.json index 517513a46fee..3e4f44c4d392 100644 --- a/composer.json +++ b/composer.json @@ -66,13 +66,15 @@ "replace": { "google/cloud-bigtable": "0.1.0", "google/cloud-bigquery": "0.3.1", + "google/cloud-container": "master", "google/cloud-core": "1.14.0", "google/cloud-datastore": "1.1.0", + "google/cloud-dlp": "0.4.0", "google/cloud-error-reporting": "0.7.0", "google/cloud-firestore": "0.2.0", + "google/cloud-language": "0.10.0", "google/cloud-logging": "1.7.0", "google/cloud-monitoring": "0.7.0", - "google/cloud-language": "0.10.0", "google/cloud-pubsub": "0.10.0", "google/cloud-spanner": "0.10.0", "google/cloud-speech": "0.9.0", @@ -80,8 +82,7 @@ "google/cloud-trace": "0.3.3", "google/cloud-translate": "1.0.2", "google/cloud-videointelligence": "0.8.0", - "google/cloud-vision": "0.7.0", - "google/cloud-dlp": "0.4.0" + "google/cloud-vision": "0.7.0" }, "suggest": { "phpseclib/phpseclib": "May be used in place of OpenSSL for creating signed Cloud Storage URLs. Please require version ^2." diff --git a/docs/contents/cloud-container.json b/docs/contents/cloud-container.json new file mode 100644 index 000000000000..ba75d411f39c --- /dev/null +++ b/docs/contents/cloud-container.json @@ -0,0 +1,18 @@ +{ + "title": "Container", + "services": [ + { + "title": "Overview", + "type": "container\/readme" + }, + { + "title": "ClusterManagerClient", + "type": "container\/v1\/clustermanagerclient", + "nav": [], + "patterns": [ + "container\/v1\/\\w{1,}" + ] + } + ], + "pattern": "container\/\\w{1,}" +} diff --git a/docs/contents/google-cloud.json b/docs/contents/google-cloud.json index d44247d3a8cf..51964b599798 100644 --- a/docs/contents/google-cloud.json +++ b/docs/contents/google-cloud.json @@ -1,18 +1,22 @@ { "title": "Google Cloud PHP", - "services": [{ - "title": "ServiceBuilder", - "type": "servicebuilder" - }], + "services": [ + { + "title": "ServiceBuilder", + "type": "servicebuilder" + } + ], "includes": [ "cloud-bigquery", + "cloud-container", + "cloud-core", "cloud-datastore", "cloud-dlp", "cloud-error-reporting", "cloud-firestore", + "cloud-language", "cloud-logging", "cloud-monitoring", - "cloud-language", "cloud-pubsub", "cloud-spanner", "cloud-speech", @@ -20,7 +24,6 @@ "cloud-trace", "cloud-translate", "cloud-videointelligence", - "cloud-vision", - "cloud-core" + "cloud-vision" ] } diff --git a/docs/manifest.json b/docs/manifest.json index 9004367f541f..665643446195 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -98,6 +98,14 @@ "master" ] }, + { + "id": "cloud-container", + "name": "google/cloud-container", + "defaultService": "container/readme", + "versions": [ + "master" + ] + }, { "id": "cloud-core", "name": "google/cloud-core", @@ -190,6 +198,27 @@ "master" ] }, + { + "id": "cloud-language", + "name": "google/cloud-language", + "defaultService": "language/languageclient", + "versions": [ + "v0.10.0", + "v0.9.1", + "v0.9.0", + "v0.8.1", + "v0.8.0", + "v0.7.0", + "v0.6.0", + "v0.5.0", + "v0.4.1", + "v0.4.0", + "v0.3.0", + "v0.2.0", + "v0.1.0", + "master" + ] + }, { "id": "cloud-logging", "name": "google/cloud-logging", @@ -231,27 +260,6 @@ "master" ] }, - { - "id": "cloud-language", - "name": "google/cloud-language", - "defaultService": "language/languageclient", - "versions": [ - "v0.10.0", - "v0.9.1", - "v0.9.0", - "v0.8.1", - "v0.8.0", - "v0.7.0", - "v0.6.0", - "v0.5.0", - "v0.4.1", - "v0.4.0", - "v0.3.0", - "v0.2.0", - "v0.1.0", - "master" - ] - }, { "id": "cloud-pubsub", "name": "google/cloud-pubsub", @@ -409,4 +417,4 @@ "title": "Packagist", "href": "https://packagist.org/packages/google/cloud" } -} +} \ No newline at end of file diff --git a/src/Container/CONTRIBUTING.md b/src/Container/CONTRIBUTING.md new file mode 100644 index 000000000000..00c1af7ae310 --- /dev/null +++ b/src/Container/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/src/Container/LICENSE b/src/Container/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/src/Container/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/src/Container/README.md b/src/Container/README.md new file mode 100644 index 000000000000..334e0843a558 --- /dev/null +++ b/src/Container/README.md @@ -0,0 +1,18 @@ +# Google Cloud Container for PHP + +> Idiomatic PHP client for [Google Cloud Container](https://cloud.google.com/kubernetes-engine/). + +* [Homepage](http://googlecloudplatform.github.io/google-cloud-php) +* [API documentation](http://googlecloudplatform.github.io/google-cloud-php/#/docs/cloud-container/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. + +## Installation + +``` +$ composer require google/cloud-container +``` diff --git a/src/Container/V1/ClusterManagerClient.php b/src/Container/V1/ClusterManagerClient.php new file mode 100644 index 000000000000..8abbadcec568 --- /dev/null +++ b/src/Container/V1/ClusterManagerClient.php @@ -0,0 +1,42 @@ +listClusters($projectId, $zone); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @experimental + */ +class ClusterManagerGapicClient +{ + /** + * The default address of the service. + */ + const SERVICE_ADDRESS = 'container.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 $gapicVersion; + private static $gapicVersionLoaded = false; + + protected $grpcCredentialsHelper; + protected $clusterManagerStub; + private $scopes; + private $defaultCallSettings; + private $descriptors; + + private static function getGapicVersion() + { + if (!self::$gapicVersionLoaded) { + if (file_exists(__DIR__.'/../VERSION')) { + self::$gapicVersion = trim(file_get_contents(__DIR__.'/../VERSION')); + } elseif (class_exists(Version::class)) { + self::$gapicVersion = Version::VERSION; + } + self::$gapicVersionLoaded = true; + } + + return self::$gapicVersion; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $serviceAddress The domain name of the API remote host. + * Default 'container.googleapis.com'. + * @type mixed $port The port on which to connect to the remote host. Default 443. + * @type \Grpc\Channel $channel + * A `Channel` object to be used by gRPC. If not specified, a channel will be constructed. + * @type \Grpc\ChannelCredentials $sslCreds + * A `ChannelCredentials` object for use with an SSL-enabled channel. + * Default: a credentials object returned from + * \Grpc\ChannelCredentials::createSsl() + * NOTE: 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: if the $channel optional argument is specified, then this option is unused. + * @type \Google\Auth\CredentialsLoader $credentialsLoader + * A CredentialsLoader object created using the Google\Auth library. + * @type array $scopes A string array of scopes to use when acquiring credentials. + * Defaults to the scopes for the Google Container Engine 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. + * } + * @experimental + */ + public function __construct($options = []) + { + $defaultOptions = [ + 'serviceAddress' => self::SERVICE_ADDRESS, + 'port' => self::DEFAULT_SERVICE_PORT, + 'scopes' => [ + 'https://www.googleapis.com/auth/cloud-platform', + ], + 'retryingOverride' => null, + 'libName' => null, + 'libVersion' => null, + 'clientConfigPath' => __DIR__.'/../resources/cluster_manager_client_config.json', + ]; + $options = array_merge($defaultOptions, $options); + + $gapicVersion = $options['libVersion'] ?: self::getGapicVersion(); + + $headerDescriptor = new AgentHeaderDescriptor([ + 'libName' => $options['libName'], + 'libVersion' => $options['libVersion'], + 'gapicVersion' => $gapicVersion, + ]); + + $defaultDescriptors = ['headerDescriptor' => $headerDescriptor]; + $this->descriptors = [ + 'listClusters' => $defaultDescriptors, + 'getCluster' => $defaultDescriptors, + 'createCluster' => $defaultDescriptors, + 'updateCluster' => $defaultDescriptors, + 'updateNodePool' => $defaultDescriptors, + 'setNodePoolAutoscaling' => $defaultDescriptors, + 'setLoggingService' => $defaultDescriptors, + 'setMonitoringService' => $defaultDescriptors, + 'setAddonsConfig' => $defaultDescriptors, + 'setLocations' => $defaultDescriptors, + 'updateMaster' => $defaultDescriptors, + 'setMasterAuth' => $defaultDescriptors, + 'deleteCluster' => $defaultDescriptors, + 'listOperations' => $defaultDescriptors, + 'getOperation' => $defaultDescriptors, + 'cancelOperation' => $defaultDescriptors, + 'getServerConfig' => $defaultDescriptors, + 'listNodePools' => $defaultDescriptors, + 'getNodePool' => $defaultDescriptors, + 'createNodePool' => $defaultDescriptors, + 'deleteNodePool' => $defaultDescriptors, + 'rollbackNodePoolUpgrade' => $defaultDescriptors, + 'setNodePoolManagement' => $defaultDescriptors, + 'setLabels' => $defaultDescriptors, + 'setLegacyAbac' => $defaultDescriptors, + 'startIPRotation' => $defaultDescriptors, + 'completeIPRotation' => $defaultDescriptors, + 'setNodePoolSize' => $defaultDescriptors, + 'setNetworkPolicy' => $defaultDescriptors, + 'setMaintenancePolicy' => $defaultDescriptors, + ]; + + $clientConfigJsonString = file_get_contents($options['clientConfigPath']); + $clientConfig = json_decode($clientConfigJsonString, true); + $this->defaultCallSettings = + CallSettings::load( + 'google.container.v1.ClusterManager', + $clientConfig, + $options['retryingOverride'] + ); + + $this->scopes = $options['scopes']; + + $createStubOptions = []; + if (array_key_exists('sslCreds', $options)) { + $createStubOptions['sslCreds'] = $options['sslCreds']; + } + $this->grpcCredentialsHelper = new GrpcCredentialsHelper($options); + + $createClusterManagerStubFunction = function ($hostname, $opts, $channel) { + return new ClusterManagerGrpcClient($hostname, $opts, $channel); + }; + if (array_key_exists('createClusterManagerStubFunction', $options)) { + $createClusterManagerStubFunction = $options['createClusterManagerStubFunction']; + } + $this->clusterManagerStub = $this->grpcCredentialsHelper->createStub($createClusterManagerStubFunction); + } + + /** + * Lists all clusters owned by a project in either the specified zone or all + * zones. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $response = $clusterManagerClient->listClusters($projectId, $zone); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides, or "-" for all zones. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\ListClustersResponse + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function listClusters($projectId, $zone, $optionalArgs = []) + { + $request = new ListClustersRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + + $defaultCallSettings = $this->defaultCallSettings['listClusters']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'ListClusters', + $mergedSettings, + $this->descriptors['listClusters'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Gets the details of a specific cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $response = $clusterManagerClient->getCluster($projectId, $zone, $clusterId); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to retrieve. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Cluster + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function getCluster($projectId, $zone, $clusterId, $optionalArgs = []) + { + $request = new GetClusterRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + + $defaultCallSettings = $this->defaultCallSettings['getCluster']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'GetCluster', + $mergedSettings, + $this->descriptors['getCluster'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Creates a cluster, consisting of the specified number and type of Google + * Compute Engine instances. + * + * By default, the cluster is created in the project's + * [default network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). + * + * One firewall is added for the cluster. After cluster creation, + * the cluster creates routes for each node to allow the containers + * on that node to communicate with all other instances in the + * cluster. + * + * Finally, an entry is added to the project's global metadata indicating + * which CIDR range is being used by the cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $cluster = new Cluster(); + * $response = $clusterManagerClient->createCluster($projectId, $zone, $cluster); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param Cluster $cluster A [cluster + * resource](https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters) + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function createCluster($projectId, $zone, $cluster, $optionalArgs = []) + { + $request = new CreateClusterRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setCluster($cluster); + + $defaultCallSettings = $this->defaultCallSettings['createCluster']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'CreateCluster', + $mergedSettings, + $this->descriptors['createCluster'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Updates the settings of a specific cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $update = new ClusterUpdate(); + * $response = $clusterManagerClient->updateCluster($projectId, $zone, $clusterId, $update); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to upgrade. + * @param ClusterUpdate $update A description of the update. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function updateCluster($projectId, $zone, $clusterId, $update, $optionalArgs = []) + { + $request = new UpdateClusterRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setUpdate($update); + + $defaultCallSettings = $this->defaultCallSettings['updateCluster']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'UpdateCluster', + $mergedSettings, + $this->descriptors['updateCluster'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Updates the version and/or image type of a specific node pool. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $nodePoolId = ''; + * $nodeVersion = ''; + * $imageType = ''; + * $response = $clusterManagerClient->updateNodePool($projectId, $zone, $clusterId, $nodePoolId, $nodeVersion, $imageType); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to upgrade. + * @param string $nodePoolId The name of the node pool to upgrade. + * @param string $nodeVersion The Kubernetes version to change the nodes to (typically an + * upgrade). Use `-` to upgrade to the latest version supported by + * the server. + * @param string $imageType The desired image type for the node pool. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function updateNodePool($projectId, $zone, $clusterId, $nodePoolId, $nodeVersion, $imageType, $optionalArgs = []) + { + $request = new UpdateNodePoolRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setNodePoolId($nodePoolId); + $request->setNodeVersion($nodeVersion); + $request->setImageType($imageType); + + $defaultCallSettings = $this->defaultCallSettings['updateNodePool']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'UpdateNodePool', + $mergedSettings, + $this->descriptors['updateNodePool'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Sets the autoscaling settings of a specific node pool. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $nodePoolId = ''; + * $autoscaling = new NodePoolAutoscaling(); + * $response = $clusterManagerClient->setNodePoolAutoscaling($projectId, $zone, $clusterId, $nodePoolId, $autoscaling); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to upgrade. + * @param string $nodePoolId The name of the node pool to upgrade. + * @param NodePoolAutoscaling $autoscaling Autoscaling configuration for the node pool. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function setNodePoolAutoscaling($projectId, $zone, $clusterId, $nodePoolId, $autoscaling, $optionalArgs = []) + { + $request = new SetNodePoolAutoscalingRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setNodePoolId($nodePoolId); + $request->setAutoscaling($autoscaling); + + $defaultCallSettings = $this->defaultCallSettings['setNodePoolAutoscaling']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'SetNodePoolAutoscaling', + $mergedSettings, + $this->descriptors['setNodePoolAutoscaling'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Sets the logging service of a specific cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $loggingService = ''; + * $response = $clusterManagerClient->setLoggingService($projectId, $zone, $clusterId, $loggingService); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to upgrade. + * @param string $loggingService The logging service the cluster should use to write metrics. + * Currently available options: + * + * * "logging.googleapis.com" - the Google Cloud Logging service + * * "none" - no metrics will be exported from the cluster + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function setLoggingService($projectId, $zone, $clusterId, $loggingService, $optionalArgs = []) + { + $request = new SetLoggingServiceRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setLoggingService($loggingService); + + $defaultCallSettings = $this->defaultCallSettings['setLoggingService']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'SetLoggingService', + $mergedSettings, + $this->descriptors['setLoggingService'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Sets the monitoring service of a specific cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $monitoringService = ''; + * $response = $clusterManagerClient->setMonitoringService($projectId, $zone, $clusterId, $monitoringService); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to upgrade. + * @param string $monitoringService The monitoring service the cluster should use to write metrics. + * Currently available options: + * + * * "monitoring.googleapis.com" - the Google Cloud Monitoring service + * * "none" - no metrics will be exported from the cluster + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function setMonitoringService($projectId, $zone, $clusterId, $monitoringService, $optionalArgs = []) + { + $request = new SetMonitoringServiceRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setMonitoringService($monitoringService); + + $defaultCallSettings = $this->defaultCallSettings['setMonitoringService']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'SetMonitoringService', + $mergedSettings, + $this->descriptors['setMonitoringService'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Sets the addons of a specific cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $addonsConfig = new AddonsConfig(); + * $response = $clusterManagerClient->setAddonsConfig($projectId, $zone, $clusterId, $addonsConfig); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to upgrade. + * @param AddonsConfig $addonsConfig The desired configurations for the various addons available to run in the + * cluster. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function setAddonsConfig($projectId, $zone, $clusterId, $addonsConfig, $optionalArgs = []) + { + $request = new SetAddonsConfigRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setAddonsConfig($addonsConfig); + + $defaultCallSettings = $this->defaultCallSettings['setAddonsConfig']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'SetAddonsConfig', + $mergedSettings, + $this->descriptors['setAddonsConfig'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Sets the locations of a specific cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $locations = []; + * $response = $clusterManagerClient->setLocations($projectId, $zone, $clusterId, $locations); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to upgrade. + * @param string[] $locations The desired list of Google Compute Engine + * [locations](https://cloud.google.com/compute/docs/zones#available) in which the cluster's nodes + * should be located. Changing the locations a cluster is in will result + * in nodes being either created or removed from the cluster, depending on + * whether locations are being added or removed. + * + * This list must always include the cluster's primary zone. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function setLocations($projectId, $zone, $clusterId, $locations, $optionalArgs = []) + { + $request = new SetLocationsRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setLocations($locations); + + $defaultCallSettings = $this->defaultCallSettings['setLocations']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'SetLocations', + $mergedSettings, + $this->descriptors['setLocations'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Updates the master of a specific cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $masterVersion = ''; + * $response = $clusterManagerClient->updateMaster($projectId, $zone, $clusterId, $masterVersion); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to upgrade. + * @param string $masterVersion The Kubernetes version to change the master to. The only valid value is the + * latest supported version. Use "-" to have the server automatically select + * the latest version. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function updateMaster($projectId, $zone, $clusterId, $masterVersion, $optionalArgs = []) + { + $request = new UpdateMasterRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setMasterVersion($masterVersion); + + $defaultCallSettings = $this->defaultCallSettings['updateMaster']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'UpdateMaster', + $mergedSettings, + $this->descriptors['updateMaster'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Used to set master auth materials. Currently supports :- + * Changing the admin password of a specific cluster. + * This can be either via password generation or explicitly set the password. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $action = Action::UNKNOWN; + * $update = new MasterAuth(); + * $response = $clusterManagerClient->setMasterAuth($projectId, $zone, $clusterId, $action, $update); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to upgrade. + * @param int $action The exact form of action to be taken on the master auth. + * For allowed values, use constants defined on {@see \Google\Cloud\Container\V1\SetMasterAuthRequest_Action} + * @param MasterAuth $update A description of the update. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function setMasterAuth($projectId, $zone, $clusterId, $action, $update, $optionalArgs = []) + { + $request = new SetMasterAuthRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setAction($action); + $request->setUpdate($update); + + $defaultCallSettings = $this->defaultCallSettings['setMasterAuth']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'SetMasterAuth', + $mergedSettings, + $this->descriptors['setMasterAuth'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Deletes the cluster, including the Kubernetes endpoint and all worker + * nodes. + * + * Firewalls and routes that were configured during cluster creation + * are also deleted. + * + * Other Google Compute Engine resources that might be in use by the cluster + * (e.g. load balancer resources) will not be deleted if they weren't present + * at the initial create time. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $response = $clusterManagerClient->deleteCluster($projectId, $zone, $clusterId); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to delete. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function deleteCluster($projectId, $zone, $clusterId, $optionalArgs = []) + { + $request = new DeleteClusterRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + + $defaultCallSettings = $this->defaultCallSettings['deleteCluster']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'DeleteCluster', + $mergedSettings, + $this->descriptors['deleteCluster'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Lists all operations in a project in a specific zone or all zones. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $response = $clusterManagerClient->listOperations($projectId, $zone); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) + * to return operations for, or `-` for all zones. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\ListOperationsResponse + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function listOperations($projectId, $zone, $optionalArgs = []) + { + $request = new ListOperationsRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + + $defaultCallSettings = $this->defaultCallSettings['listOperations']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'ListOperations', + $mergedSettings, + $this->descriptors['listOperations'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Gets the specified operation. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $operationId = ''; + * $response = $clusterManagerClient->getOperation($projectId, $zone, $operationId); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $operationId The server-assigned `name` of the operation. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function getOperation($projectId, $zone, $operationId, $optionalArgs = []) + { + $request = new GetOperationRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setOperationId($operationId); + + $defaultCallSettings = $this->defaultCallSettings['getOperation']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'GetOperation', + $mergedSettings, + $this->descriptors['getOperation'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Cancels the specified operation. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $operationId = ''; + * $clusterManagerClient->cancelOperation($projectId, $zone, $operationId); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the operation resides. + * @param string $operationId The server-assigned `name` of the operation. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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 \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function cancelOperation($projectId, $zone, $operationId, $optionalArgs = []) + { + $request = new CancelOperationRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setOperationId($operationId); + + $defaultCallSettings = $this->defaultCallSettings['cancelOperation']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'CancelOperation', + $mergedSettings, + $this->descriptors['cancelOperation'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Returns configuration info about the Container Engine service. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $response = $clusterManagerClient->getServerConfig($projectId, $zone); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) + * to return operations for. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\ServerConfig + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function getServerConfig($projectId, $zone, $optionalArgs = []) + { + $request = new GetServerConfigRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + + $defaultCallSettings = $this->defaultCallSettings['getServerConfig']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'GetServerConfig', + $mergedSettings, + $this->descriptors['getServerConfig'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Lists the node pools for a cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $response = $clusterManagerClient->listNodePools($projectId, $zone, $clusterId); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://developers.google.com/console/help/new/#projectnumber). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\ListNodePoolsResponse + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function listNodePools($projectId, $zone, $clusterId, $optionalArgs = []) + { + $request = new ListNodePoolsRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + + $defaultCallSettings = $this->defaultCallSettings['listNodePools']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'ListNodePools', + $mergedSettings, + $this->descriptors['listNodePools'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Retrieves the node pool requested. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $nodePoolId = ''; + * $response = $clusterManagerClient->getNodePool($projectId, $zone, $clusterId, $nodePoolId); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://developers.google.com/console/help/new/#projectnumber). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster. + * @param string $nodePoolId The name of the node pool. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\NodePool + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function getNodePool($projectId, $zone, $clusterId, $nodePoolId, $optionalArgs = []) + { + $request = new GetNodePoolRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setNodePoolId($nodePoolId); + + $defaultCallSettings = $this->defaultCallSettings['getNodePool']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'GetNodePool', + $mergedSettings, + $this->descriptors['getNodePool'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Creates a node pool for a cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $nodePool = new NodePool(); + * $response = $clusterManagerClient->createNodePool($projectId, $zone, $clusterId, $nodePool); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://developers.google.com/console/help/new/#projectnumber). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster. + * @param NodePool $nodePool The node pool to create. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function createNodePool($projectId, $zone, $clusterId, $nodePool, $optionalArgs = []) + { + $request = new CreateNodePoolRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setNodePool($nodePool); + + $defaultCallSettings = $this->defaultCallSettings['createNodePool']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'CreateNodePool', + $mergedSettings, + $this->descriptors['createNodePool'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Deletes a node pool from a cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $nodePoolId = ''; + * $response = $clusterManagerClient->deleteNodePool($projectId, $zone, $clusterId, $nodePoolId); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://developers.google.com/console/help/new/#projectnumber). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster. + * @param string $nodePoolId The name of the node pool to delete. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function deleteNodePool($projectId, $zone, $clusterId, $nodePoolId, $optionalArgs = []) + { + $request = new DeleteNodePoolRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setNodePoolId($nodePoolId); + + $defaultCallSettings = $this->defaultCallSettings['deleteNodePool']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'DeleteNodePool', + $mergedSettings, + $this->descriptors['deleteNodePool'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Roll back the previously Aborted or Failed NodePool upgrade. + * This will be an no-op if the last upgrade successfully completed. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $nodePoolId = ''; + * $response = $clusterManagerClient->rollbackNodePoolUpgrade($projectId, $zone, $clusterId, $nodePoolId); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to rollback. + * @param string $nodePoolId The name of the node pool to rollback. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function rollbackNodePoolUpgrade($projectId, $zone, $clusterId, $nodePoolId, $optionalArgs = []) + { + $request = new RollbackNodePoolUpgradeRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setNodePoolId($nodePoolId); + + $defaultCallSettings = $this->defaultCallSettings['rollbackNodePoolUpgrade']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'RollbackNodePoolUpgrade', + $mergedSettings, + $this->descriptors['rollbackNodePoolUpgrade'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Sets the NodeManagement options for a node pool. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $nodePoolId = ''; + * $management = new NodeManagement(); + * $response = $clusterManagerClient->setNodePoolManagement($projectId, $zone, $clusterId, $nodePoolId, $management); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to update. + * @param string $nodePoolId The name of the node pool to update. + * @param NodeManagement $management NodeManagement configuration for the node pool. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function setNodePoolManagement($projectId, $zone, $clusterId, $nodePoolId, $management, $optionalArgs = []) + { + $request = new SetNodePoolManagementRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setNodePoolId($nodePoolId); + $request->setManagement($management); + + $defaultCallSettings = $this->defaultCallSettings['setNodePoolManagement']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'SetNodePoolManagement', + $mergedSettings, + $this->descriptors['setNodePoolManagement'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Sets labels on a cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $resourceLabels = []; + * $labelFingerprint = ''; + * $response = $clusterManagerClient->setLabels($projectId, $zone, $clusterId, $resourceLabels, $labelFingerprint); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://developers.google.com/console/help/new/#projectnumber). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster. + * @param array $resourceLabels The labels to set for that cluster. + * @param string $labelFingerprint The fingerprint of the previous set of labels for this resource, + * used to detect conflicts. The fingerprint is initially generated by + * Container Engine and changes after every request to modify or update + * labels. You must always provide an up-to-date fingerprint hash when + * updating or changing labels. Make a get() request to the + * resource to get the latest fingerprint. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function setLabels($projectId, $zone, $clusterId, $resourceLabels, $labelFingerprint, $optionalArgs = []) + { + $request = new SetLabelsRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setResourceLabels($resourceLabels); + $request->setLabelFingerprint($labelFingerprint); + + $defaultCallSettings = $this->defaultCallSettings['setLabels']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'SetLabels', + $mergedSettings, + $this->descriptors['setLabels'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Enables or disables the ABAC authorization mechanism on a cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $enabled = false; + * $response = $clusterManagerClient->setLegacyAbac($projectId, $zone, $clusterId, $enabled); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to update. + * @param bool $enabled Whether ABAC authorization will be enabled in the cluster. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function setLegacyAbac($projectId, $zone, $clusterId, $enabled, $optionalArgs = []) + { + $request = new SetLegacyAbacRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setEnabled($enabled); + + $defaultCallSettings = $this->defaultCallSettings['setLegacyAbac']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'SetLegacyAbac', + $mergedSettings, + $this->descriptors['setLegacyAbac'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Start master IP rotation. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $response = $clusterManagerClient->startIPRotation($projectId, $zone, $clusterId); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://developers.google.com/console/help/new/#projectnumber). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function startIPRotation($projectId, $zone, $clusterId, $optionalArgs = []) + { + $request = new StartIPRotationRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + + $defaultCallSettings = $this->defaultCallSettings['startIPRotation']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'StartIPRotation', + $mergedSettings, + $this->descriptors['startIPRotation'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Completes master IP rotation. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $response = $clusterManagerClient->completeIPRotation($projectId, $zone, $clusterId); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://developers.google.com/console/help/new/#projectnumber). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function completeIPRotation($projectId, $zone, $clusterId, $optionalArgs = []) + { + $request = new CompleteIPRotationRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + + $defaultCallSettings = $this->defaultCallSettings['completeIPRotation']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'CompleteIPRotation', + $mergedSettings, + $this->descriptors['completeIPRotation'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Sets the size of a specific node pool. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $nodePoolId = ''; + * $nodeCount = 0; + * $response = $clusterManagerClient->setNodePoolSize($projectId, $zone, $clusterId, $nodePoolId, $nodeCount); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to update. + * @param string $nodePoolId The name of the node pool to update. + * @param int $nodeCount The desired node count for the pool. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function setNodePoolSize($projectId, $zone, $clusterId, $nodePoolId, $nodeCount, $optionalArgs = []) + { + $request = new SetNodePoolSizeRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setNodePoolId($nodePoolId); + $request->setNodeCount($nodeCount); + + $defaultCallSettings = $this->defaultCallSettings['setNodePoolSize']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'SetNodePoolSize', + $mergedSettings, + $this->descriptors['setNodePoolSize'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Enables/Disables Network Policy for a cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $networkPolicy = new NetworkPolicy(); + * $response = $clusterManagerClient->setNetworkPolicy($projectId, $zone, $clusterId, $networkPolicy); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://developers.google.com/console/help/new/#projectnumber). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster. + * @param NetworkPolicy $networkPolicy Configuration options for the NetworkPolicy feature. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function setNetworkPolicy($projectId, $zone, $clusterId, $networkPolicy, $optionalArgs = []) + { + $request = new SetNetworkPolicyRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setNetworkPolicy($networkPolicy); + + $defaultCallSettings = $this->defaultCallSettings['setNetworkPolicy']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'SetNetworkPolicy', + $mergedSettings, + $this->descriptors['setNetworkPolicy'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Sets the maintenance policy for a cluster. + * + * Sample code: + * ``` + * try { + * $clusterManagerClient = new ClusterManagerClient(); + * $projectId = ''; + * $zone = ''; + * $clusterId = ''; + * $maintenancePolicy = new MaintenancePolicy(); + * $response = $clusterManagerClient->setMaintenancePolicy($projectId, $zone, $clusterId, $maintenancePolicy); + * } finally { + * $clusterManagerClient->close(); + * } + * ``` + * + * @param string $projectId The Google Developers Console [project ID or project + * number](https://support.google.com/cloud/answer/6158840). + * @param string $zone The name of the Google Compute Engine + * [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster + * resides. + * @param string $clusterId The name of the cluster to update. + * @param MaintenancePolicy $maintenancePolicy The maintenance policy to be set for the cluster. An empty field + * clears the existing maintenance policy. + * @param array $optionalArgs { + * Optional. + * + * @type \Google\ApiCore\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\Container\V1\Operation + * + * @throws \Google\ApiCore\ApiException if the remote call fails + * @experimental + */ + public function setMaintenancePolicy($projectId, $zone, $clusterId, $maintenancePolicy, $optionalArgs = []) + { + $request = new SetMaintenancePolicyRequest(); + $request->setProjectId($projectId); + $request->setZone($zone); + $request->setClusterId($clusterId); + $request->setMaintenancePolicy($maintenancePolicy); + + $defaultCallSettings = $this->defaultCallSettings['setMaintenancePolicy']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->clusterManagerStub, + 'SetMaintenancePolicy', + $mergedSettings, + $this->descriptors['setMaintenancePolicy'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Initiates an orderly shutdown in which preexisting calls continue but new + * calls are immediately cancelled. + * + * @experimental + */ + public function close() + { + $this->clusterManagerStub->close(); + } + + private function createCredentialsCallback() + { + return $this->grpcCredentialsHelper->createCallCredentialsCallback(); + } +} diff --git a/src/Container/V1/README.md b/src/Container/V1/README.md new file mode 100644 index 000000000000..334e0843a558 --- /dev/null +++ b/src/Container/V1/README.md @@ -0,0 +1,18 @@ +# Google Cloud Container for PHP + +> Idiomatic PHP client for [Google Cloud Container](https://cloud.google.com/kubernetes-engine/). + +* [Homepage](http://googlecloudplatform.github.io/google-cloud-php) +* [API documentation](http://googlecloudplatform.github.io/google-cloud-php/#/docs/cloud-container/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. + +## Installation + +``` +$ composer require google/cloud-container +``` diff --git a/src/Container/V1/resources/cluster_manager_client_config.json b/src/Container/V1/resources/cluster_manager_client_config.json new file mode 100644 index 000000000000..6e59f631f8da --- /dev/null +++ b/src/Container/V1/resources/cluster_manager_client_config.json @@ -0,0 +1,176 @@ +{ + "interfaces": { + "google.container.v1.ClusterManager": { + "retry_codes": { + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "non_idempotent": [] + }, + "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": 600000 + } + }, + "methods": { + "ListClusters": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetCluster": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetNodePoolAutoscaling": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetLoggingService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetMonitoringService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetAddonsConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetLocations": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateMaster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetMasterAuth": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteCluster": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListOperations": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetOperation": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CancelOperation": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetServerConfig": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListNodePools": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetNodePool": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateNodePool": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNodePool": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RollbackNodePoolUpgrade": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetNodePoolManagement": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetLabels": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetLegacyAbac": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartIPRotation": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CompleteIPRotation": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetNodePoolSize": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetNetworkPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetMaintenancePolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/Container/composer.json b/src/Container/composer.json new file mode 100644 index 000000000000..15a14f35c4d8 --- /dev/null +++ b/src/Container/composer.json @@ -0,0 +1,24 @@ +{ + "name": "google/cloud-container", + "description": "Google Cloud Container Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Cloud\\Container\\": "" + } + }, + "extra": { + "component": { + "id": "cloud-container", + "path": "/usr/local/google/home/michaelbausor/dev/veneer/google-cloud-php/src/Container", + "entry": null, + "target": "GoogleCloudPlatform/google-cloud-php-container.git" + } + }, + "require": { + "ext-grpc": "*", + "google/proto-client": "^0.27.0", + "google/gax": "^0.27.0" + } +} \ No newline at end of file From 3420d6b83624bc896cc2a04f9a5e27309b9d4c77 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Mon, 11 Dec 2017 16:26:51 -0800 Subject: [PATCH 2/6] Refresh with updated tool --- composer.json | 4 ++-- docs/manifest.json | 18 +++++++++--------- src/Container/composer.json | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 3e4f44c4d392..0c652a53637a 100644 --- a/composer.json +++ b/composer.json @@ -64,8 +64,8 @@ "phpseclib/phpseclib": "^2" }, "replace": { - "google/cloud-bigtable": "0.1.0", "google/cloud-bigquery": "0.3.1", + "google/cloud-bigtable": "0.1.0", "google/cloud-container": "master", "google/cloud-core": "1.14.0", "google/cloud-datastore": "1.1.0", @@ -124,4 +124,4 @@ ] } } -} \ No newline at end of file +} diff --git a/docs/manifest.json b/docs/manifest.json index 665643446195..814c8674c998 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -74,14 +74,6 @@ "master" ] }, - { - "id": "cloud-bigtable", - "name": "google/cloud-bigtable", - "defaultService": "bigtable/readme", - "versions": [ - "master" - ] - }, { "id": "cloud-bigquery", "name": "google/cloud-bigquery", @@ -98,6 +90,14 @@ "master" ] }, + { + "id": "cloud-bigtable", + "name": "google/cloud-bigtable", + "defaultService": "bigtable/readme", + "versions": [ + "master" + ] + }, { "id": "cloud-container", "name": "google/cloud-container", @@ -417,4 +417,4 @@ "title": "Packagist", "href": "https://packagist.org/packages/google/cloud" } -} \ No newline at end of file +} diff --git a/src/Container/composer.json b/src/Container/composer.json index 15a14f35c4d8..15a97b81d4fa 100644 --- a/src/Container/composer.json +++ b/src/Container/composer.json @@ -11,7 +11,7 @@ "extra": { "component": { "id": "cloud-container", - "path": "/usr/local/google/home/michaelbausor/dev/veneer/google-cloud-php/src/Container", + "path": "src/Container", "entry": null, "target": "GoogleCloudPlatform/google-cloud-php-container.git" } @@ -21,4 +21,4 @@ "google/proto-client": "^0.27.0", "google/gax": "^0.27.0" } -} \ No newline at end of file +} From d3e2c4c06d18dd91b912a036baae60177aed620d Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Mon, 11 Dec 2017 16:59:40 -0800 Subject: [PATCH 3/6] Add to README --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index bb19799aab92..425ab22bafe4 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ This client supports the following Google Cloud Platform services at a [Beta](#v * [Google DLP](#google-dlp-beta) (Beta) * [Google Stackdriver Error Reporting](#google-stackdriver-error-reporting-beta) (Beta) * [Google Stackdriver Monitoring](#google-stackdriver-monitoring-beta) (Beta) +* [Google Cloud Container](#google-cloud-container-beta) (Beta) This client supports the following Google Cloud Platform services at an [Alpha](#versioning) quality level: * [Google Cloud Speech](#google-cloud-speech-alpha) (Alpha) @@ -709,6 +710,44 @@ Google Stackdriver Monitoring can be installed separately by requiring the `goog $ composer require google/cloud-monitoring ``` +``` +## Google Cloud Container (Beta) + +- [API Documentation](http://googlecloudplatform.github.io/google-cloud-php/#/docs/latest/monitoring/readme) +- [Official Documentation](https://cloud.google.com/kubernetes-engine/docs) + +#### Preview + +```php +listClusters($projectId, $zone); + foreach ($clusters->getClusters() as $cluster) { + print('Cluster: ' . $cluster->getName() . PHP_EOL); + } +} finally { + $clusterManagerClient->close(); +} +``` + +#### google/cloud-container + +Google Cloud Container can be installed separately by requiring the `google/cloud-container` composer package: + +``` +$ composer require google/cloud-container +``` + ## Google Cloud Speech (Alpha) - [API Documentation](http://googlecloudplatform.github.io/google-cloud-php/#/docs/latest/speech/speechclient) From a27dc7c807eff31cb6e0d2016c731e97203916f2 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Mon, 11 Dec 2017 17:00:37 -0800 Subject: [PATCH 4/6] Fix README --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 425ab22bafe4..1ffd7079aae1 100644 --- a/README.md +++ b/README.md @@ -710,7 +710,6 @@ Google Stackdriver Monitoring can be installed separately by requiring the `goog $ composer require google/cloud-monitoring ``` -``` ## Google Cloud Container (Beta) - [API Documentation](http://googlecloudplatform.github.io/google-cloud-php/#/docs/latest/monitoring/readme) From c37067b801ad04e8ec7de4c6e0ecec2369fe4a98 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 20 Dec 2017 09:05:26 -0800 Subject: [PATCH 5/6] Update gax and proto client dependencies --- src/Bigtable/composer.json | 4 ++-- src/Container/composer.json | 4 ++-- src/Dlp/composer.json | 4 ++-- src/ErrorReporting/composer.json | 4 ++-- src/Firestore/composer.json | 4 ++-- src/Language/composer.json | 4 ++-- src/Logging/composer.json | 4 ++-- src/Monitoring/composer.json | 4 ++-- src/PubSub/composer.json | 4 ++-- src/Spanner/composer.json | 4 ++-- src/Speech/composer.json | 4 ++-- src/VideoIntelligence/composer.json | 4 ++-- src/Vision/composer.json | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Bigtable/composer.json b/src/Bigtable/composer.json index f7596614deb7..581782bdd2fb 100644 --- a/src/Bigtable/composer.json +++ b/src/Bigtable/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "ext-grpc": "*", - "google/proto-client": "^0.27", - "google/gax": "^0.27" + "google/proto-client": "^0.28", + "google/gax": "^0.28" }, "extra": { "component": { diff --git a/src/Container/composer.json b/src/Container/composer.json index 15a97b81d4fa..fb3a9467e970 100644 --- a/src/Container/composer.json +++ b/src/Container/composer.json @@ -18,7 +18,7 @@ }, "require": { "ext-grpc": "*", - "google/proto-client": "^0.27.0", - "google/gax": "^0.27.0" + "google/proto-client": "^0.28.0", + "google/gax": "^0.28.0" } } diff --git a/src/Dlp/composer.json b/src/Dlp/composer.json index b125c3258773..baca302e178d 100644 --- a/src/Dlp/composer.json +++ b/src/Dlp/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "ext-grpc": "*", - "google/proto-client": "^0.27", - "google/gax": "^0.27" + "google/proto-client": "^0.28", + "google/gax": "^0.28" }, "extra": { "component": { diff --git a/src/ErrorReporting/composer.json b/src/ErrorReporting/composer.json index 267063bdf796..da9ba571a6b4 100644 --- a/src/ErrorReporting/composer.json +++ b/src/ErrorReporting/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "google/cloud-logging": "^1.5.0", - "google/proto-client": "^0.27", - "google/gax": "^0.27" + "google/proto-client": "^0.28", + "google/gax": "^0.28" }, "suggest": { "ext-grpc": "the gRPC extension allows more granular control over Error Reporting" diff --git a/src/Firestore/composer.json b/src/Firestore/composer.json index fb7f09f3da49..fb97074be4eb 100644 --- a/src/Firestore/composer.json +++ b/src/Firestore/composer.json @@ -6,8 +6,8 @@ "require": { "ext-grpc": "*", "google/cloud-core": "^1.14", - "google/gax": "^0.27", - "google/proto-client": "^0.27", + "google/gax": "^0.28", + "google/proto-client": "^0.28", "ramsey/uuid": "~3" }, "extra": { diff --git a/src/Language/composer.json b/src/Language/composer.json index 1d44ac911631..e01c854432d1 100644 --- a/src/Language/composer.json +++ b/src/Language/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/proto-client": "^0.27", - "google/gax": "^0.27" + "google/proto-client": "^0.28", + "google/gax": "^0.28" }, "suggest": { "google/cloud-storage": "Analyze documents stored in Google Cloud Storage" diff --git a/src/Logging/composer.json b/src/Logging/composer.json index 9293976c87cc..42dd293011de 100644 --- a/src/Logging/composer.json +++ b/src/Logging/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/proto-client": "^0.27", - "google/gax": "^0.27" + "google/proto-client": "^0.28", + "google/gax": "^0.28" }, "extra": { "component": { diff --git a/src/Monitoring/composer.json b/src/Monitoring/composer.json index cb4f27b05a7b..47c947702a09 100644 --- a/src/Monitoring/composer.json +++ b/src/Monitoring/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "ext-grpc": "*", - "google/proto-client": "^0.27", - "google/gax": "^0.27" + "google/proto-client": "^0.28", + "google/gax": "^0.28" }, "extra": { "component": { diff --git a/src/PubSub/composer.json b/src/PubSub/composer.json index bbfb969e1762..de94543612ed 100644 --- a/src/PubSub/composer.json +++ b/src/PubSub/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/proto-client": "^0.27", - "google/gax": "^0.27" + "google/proto-client": "^0.28", + "google/gax": "^0.28" }, "extra": { "component": { diff --git a/src/Spanner/composer.json b/src/Spanner/composer.json index b3f4995c3cce..875ca8b39433 100644 --- a/src/Spanner/composer.json +++ b/src/Spanner/composer.json @@ -6,8 +6,8 @@ "require": { "ext-grpc": "*", "google/cloud-core": "^1.14", - "google/gax": "^0.27", - "google/proto-client": "^0.27" + "google/gax": "^0.28", + "google/proto-client": "^0.28" }, "extra": { "component": { diff --git a/src/Speech/composer.json b/src/Speech/composer.json index 8e83be68719a..b503142a90f7 100644 --- a/src/Speech/composer.json +++ b/src/Speech/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/proto-client": "^0.27", - "google/gax": "^0.27" + "google/proto-client": "^0.28", + "google/gax": "^0.28" }, "suggest": { "google/gax": "Required to support gRPC" diff --git a/src/VideoIntelligence/composer.json b/src/VideoIntelligence/composer.json index 7e749da06e48..9bdaaf6d2958 100644 --- a/src/VideoIntelligence/composer.json +++ b/src/VideoIntelligence/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "ext-grpc": "*", - "google/proto-client": "^0.27", - "google/gax": "^0.27" + "google/proto-client": "^0.28", + "google/gax": "^0.28" }, "extra": { "component": { diff --git a/src/Vision/composer.json b/src/Vision/composer.json index f36f760c46e6..7aef3d073d70 100644 --- a/src/Vision/composer.json +++ b/src/Vision/composer.json @@ -5,8 +5,8 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/proto-client": "^0.27", - "google/gax": "^0.27" + "google/proto-client": "^0.28", + "google/gax": "^0.28" }, "suggest": { "google/cloud-storage": "Annotate images stored in Google Cloud Storage" From 15196049bdbcd398311b8e9229571fb74c20f44a Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 20 Dec 2017 09:33:47 -0800 Subject: [PATCH 6/6] Update container readme --- src/Container/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Container/README.md b/src/Container/README.md index 334e0843a558..8e8b91bae192 100644 --- a/src/Container/README.md +++ b/src/Container/README.md @@ -11,6 +11,10 @@ support requests, bug reports, or development contributions should be directed t 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 ```