1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\Container\Resource;
19
20use Google\Service\Container\CreateNodePoolRequest;
21use Google\Service\Container\ListNodePoolsResponse;
22use Google\Service\Container\NodePool;
23use Google\Service\Container\Operation;
24use Google\Service\Container\RollbackNodePoolUpgradeRequest;
25use Google\Service\Container\SetNodePoolAutoscalingRequest;
26use Google\Service\Container\SetNodePoolManagementRequest;
27use Google\Service\Container\SetNodePoolSizeRequest;
28use Google\Service\Container\UpdateNodePoolRequest;
29
30/**
31 * The "nodePools" collection of methods.
32 * Typical usage is:
33 *  <code>
34 *   $containerService = new Google\Service\Container(...);
35 *   $nodePools = $containerService->nodePools;
36 *  </code>
37 */
38class ProjectsZonesClustersNodePools extends \Google\Service\Resource
39{
40  /**
41   * Sets the autoscaling settings for the specified node pool.
42   * (nodePools.autoscaling)
43   *
44   * @param string $projectId Deprecated. The Google Developers Console [project
45   * ID or project number](https://support.google.com/cloud/answer/6158840). This
46   * field has been deprecated and replaced by the name field.
47   * @param string $zone Deprecated. The name of the Google Compute Engine
48   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
49   * cluster resides. This field has been deprecated and replaced by the name
50   * field.
51   * @param string $clusterId Deprecated. The name of the cluster to upgrade. This
52   * field has been deprecated and replaced by the name field.
53   * @param string $nodePoolId Deprecated. The name of the node pool to upgrade.
54   * This field has been deprecated and replaced by the name field.
55   * @param SetNodePoolAutoscalingRequest $postBody
56   * @param array $optParams Optional parameters.
57   * @return Operation
58   */
59  public function autoscaling($projectId, $zone, $clusterId, $nodePoolId, SetNodePoolAutoscalingRequest $postBody, $optParams = [])
60  {
61    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'nodePoolId' => $nodePoolId, 'postBody' => $postBody];
62    $params = array_merge($params, $optParams);
63    return $this->call('autoscaling', [$params], Operation::class);
64  }
65  /**
66   * Creates a node pool for a cluster. (nodePools.create)
67   *
68   * @param string $projectId Deprecated. The Google Developers Console [project
69   * ID or project
70   * number](https://developers.google.com/console/help/new/#projectnumber). This
71   * field has been deprecated and replaced by the parent field.
72   * @param string $zone Deprecated. The name of the Google Compute Engine
73   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
74   * cluster resides. This field has been deprecated and replaced by the parent
75   * field.
76   * @param string $clusterId Deprecated. The name of the cluster. This field has
77   * been deprecated and replaced by the parent field.
78   * @param CreateNodePoolRequest $postBody
79   * @param array $optParams Optional parameters.
80   * @return Operation
81   */
82  public function create($projectId, $zone, $clusterId, CreateNodePoolRequest $postBody, $optParams = [])
83  {
84    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
85    $params = array_merge($params, $optParams);
86    return $this->call('create', [$params], Operation::class);
87  }
88  /**
89   * Deletes a node pool from a cluster. (nodePools.delete)
90   *
91   * @param string $projectId Deprecated. The Google Developers Console [project
92   * ID or project
93   * number](https://developers.google.com/console/help/new/#projectnumber). This
94   * field has been deprecated and replaced by the name field.
95   * @param string $zone Deprecated. The name of the Google Compute Engine
96   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
97   * cluster resides. This field has been deprecated and replaced by the name
98   * field.
99   * @param string $clusterId Deprecated. The name of the cluster. This field has
100   * been deprecated and replaced by the name field.
101   * @param string $nodePoolId Deprecated. The name of the node pool to delete.
102   * This field has been deprecated and replaced by the name field.
103   * @param array $optParams Optional parameters.
104   *
105   * @opt_param string name The name (project, location, cluster, node pool id) of
106   * the node pool to delete. Specified in the format
107   * `projects/locations/clusters/nodePools`.
108   * @return Operation
109   */
110  public function delete($projectId, $zone, $clusterId, $nodePoolId, $optParams = [])
111  {
112    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'nodePoolId' => $nodePoolId];
113    $params = array_merge($params, $optParams);
114    return $this->call('delete', [$params], Operation::class);
115  }
116  /**
117   * Retrieves the requested node pool. (nodePools.get)
118   *
119   * @param string $projectId Deprecated. The Google Developers Console [project
120   * ID or project
121   * number](https://developers.google.com/console/help/new/#projectnumber). This
122   * field has been deprecated and replaced by the name field.
123   * @param string $zone Deprecated. The name of the Google Compute Engine
124   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
125   * cluster resides. This field has been deprecated and replaced by the name
126   * field.
127   * @param string $clusterId Deprecated. The name of the cluster. This field has
128   * been deprecated and replaced by the name field.
129   * @param string $nodePoolId Deprecated. The name of the node pool. This field
130   * has been deprecated and replaced by the name field.
131   * @param array $optParams Optional parameters.
132   *
133   * @opt_param string name The name (project, location, cluster, node pool id) of
134   * the node pool to get. Specified in the format
135   * `projects/locations/clusters/nodePools`.
136   * @return NodePool
137   */
138  public function get($projectId, $zone, $clusterId, $nodePoolId, $optParams = [])
139  {
140    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'nodePoolId' => $nodePoolId];
141    $params = array_merge($params, $optParams);
142    return $this->call('get', [$params], NodePool::class);
143  }
144  /**
145   * Lists the node pools for a cluster.
146   * (nodePools.listProjectsZonesClustersNodePools)
147   *
148   * @param string $projectId Deprecated. The Google Developers Console [project
149   * ID or project
150   * number](https://developers.google.com/console/help/new/#projectnumber). This
151   * field has been deprecated and replaced by the parent field.
152   * @param string $zone Deprecated. The name of the Google Compute Engine
153   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
154   * cluster resides. This field has been deprecated and replaced by the parent
155   * field.
156   * @param string $clusterId Deprecated. The name of the cluster. This field has
157   * been deprecated and replaced by the parent field.
158   * @param array $optParams Optional parameters.
159   *
160   * @opt_param string parent The parent (project, location, cluster name) where
161   * the node pools will be listed. Specified in the format
162   * `projects/locations/clusters`.
163   * @return ListNodePoolsResponse
164   */
165  public function listProjectsZonesClustersNodePools($projectId, $zone, $clusterId, $optParams = [])
166  {
167    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId];
168    $params = array_merge($params, $optParams);
169    return $this->call('list', [$params], ListNodePoolsResponse::class);
170  }
171  /**
172   * Rolls back a previously Aborted or Failed NodePool upgrade. This makes no
173   * changes if the last upgrade successfully completed. (nodePools.rollback)
174   *
175   * @param string $projectId Deprecated. The Google Developers Console [project
176   * ID or project number](https://support.google.com/cloud/answer/6158840). This
177   * field has been deprecated and replaced by the name field.
178   * @param string $zone Deprecated. The name of the Google Compute Engine
179   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
180   * cluster resides. This field has been deprecated and replaced by the name
181   * field.
182   * @param string $clusterId Deprecated. The name of the cluster to rollback.
183   * This field has been deprecated and replaced by the name field.
184   * @param string $nodePoolId Deprecated. The name of the node pool to rollback.
185   * This field has been deprecated and replaced by the name field.
186   * @param RollbackNodePoolUpgradeRequest $postBody
187   * @param array $optParams Optional parameters.
188   * @return Operation
189   */
190  public function rollback($projectId, $zone, $clusterId, $nodePoolId, RollbackNodePoolUpgradeRequest $postBody, $optParams = [])
191  {
192    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'nodePoolId' => $nodePoolId, 'postBody' => $postBody];
193    $params = array_merge($params, $optParams);
194    return $this->call('rollback', [$params], Operation::class);
195  }
196  /**
197   * Sets the NodeManagement options for a node pool. (nodePools.setManagement)
198   *
199   * @param string $projectId Deprecated. The Google Developers Console [project
200   * ID or project number](https://support.google.com/cloud/answer/6158840). This
201   * field has been deprecated and replaced by the name field.
202   * @param string $zone Deprecated. The name of the Google Compute Engine
203   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
204   * cluster resides. This field has been deprecated and replaced by the name
205   * field.
206   * @param string $clusterId Deprecated. The name of the cluster to update. This
207   * field has been deprecated and replaced by the name field.
208   * @param string $nodePoolId Deprecated. The name of the node pool to update.
209   * This field has been deprecated and replaced by the name field.
210   * @param SetNodePoolManagementRequest $postBody
211   * @param array $optParams Optional parameters.
212   * @return Operation
213   */
214  public function setManagement($projectId, $zone, $clusterId, $nodePoolId, SetNodePoolManagementRequest $postBody, $optParams = [])
215  {
216    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'nodePoolId' => $nodePoolId, 'postBody' => $postBody];
217    $params = array_merge($params, $optParams);
218    return $this->call('setManagement', [$params], Operation::class);
219  }
220  /**
221   * Sets the size for a specific node pool. The new size will be used for all
222   * replicas, including future replicas created by modifying NodePool.locations.
223   * (nodePools.setSize)
224   *
225   * @param string $projectId Deprecated. The Google Developers Console [project
226   * ID or project number](https://support.google.com/cloud/answer/6158840). This
227   * field has been deprecated and replaced by the name field.
228   * @param string $zone Deprecated. The name of the Google Compute Engine
229   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
230   * cluster resides. This field has been deprecated and replaced by the name
231   * field.
232   * @param string $clusterId Deprecated. The name of the cluster to update. This
233   * field has been deprecated and replaced by the name field.
234   * @param string $nodePoolId Deprecated. The name of the node pool to update.
235   * This field has been deprecated and replaced by the name field.
236   * @param SetNodePoolSizeRequest $postBody
237   * @param array $optParams Optional parameters.
238   * @return Operation
239   */
240  public function setSize($projectId, $zone, $clusterId, $nodePoolId, SetNodePoolSizeRequest $postBody, $optParams = [])
241  {
242    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'nodePoolId' => $nodePoolId, 'postBody' => $postBody];
243    $params = array_merge($params, $optParams);
244    return $this->call('setSize', [$params], Operation::class);
245  }
246  /**
247   * Updates the version and/or image type for the specified node pool.
248   * (nodePools.update)
249   *
250   * @param string $projectId Deprecated. The Google Developers Console [project
251   * ID or project number](https://support.google.com/cloud/answer/6158840). This
252   * field has been deprecated and replaced by the name field.
253   * @param string $zone Deprecated. The name of the Google Compute Engine
254   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
255   * cluster resides. This field has been deprecated and replaced by the name
256   * field.
257   * @param string $clusterId Deprecated. The name of the cluster to upgrade. This
258   * field has been deprecated and replaced by the name field.
259   * @param string $nodePoolId Deprecated. The name of the node pool to upgrade.
260   * This field has been deprecated and replaced by the name field.
261   * @param UpdateNodePoolRequest $postBody
262   * @param array $optParams Optional parameters.
263   * @return Operation
264   */
265  public function update($projectId, $zone, $clusterId, $nodePoolId, UpdateNodePoolRequest $postBody, $optParams = [])
266  {
267    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'nodePoolId' => $nodePoolId, 'postBody' => $postBody];
268    $params = array_merge($params, $optParams);
269    return $this->call('update', [$params], Operation::class);
270  }
271}
272
273// Adding a class alias for backwards compatibility with the previous class name.
274class_alias(ProjectsZonesClustersNodePools::class, 'Google_Service_Container_Resource_ProjectsZonesClustersNodePools');
275