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 ProjectsLocationsClustersNodePools extends \Google\Service\Resource
39{
40  /**
41   * Creates a node pool for a cluster. (nodePools.create)
42   *
43   * @param string $parent The parent (project, location, cluster name) where the
44   * node pool will be created. Specified in the format
45   * `projects/locations/clusters`.
46   * @param CreateNodePoolRequest $postBody
47   * @param array $optParams Optional parameters.
48   * @return Operation
49   */
50  public function create($parent, CreateNodePoolRequest $postBody, $optParams = [])
51  {
52    $params = ['parent' => $parent, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('create', [$params], Operation::class);
55  }
56  /**
57   * Deletes a node pool from a cluster. (nodePools.delete)
58   *
59   * @param string $name The name (project, location, cluster, node pool id) of
60   * the node pool to delete. Specified in the format
61   * `projects/locations/clusters/nodePools`.
62   * @param array $optParams Optional parameters.
63   *
64   * @opt_param string clusterId Deprecated. The name of the cluster. This field
65   * has been deprecated and replaced by the name field.
66   * @opt_param string nodePoolId Deprecated. The name of the node pool to delete.
67   * This field has been deprecated and replaced by the name field.
68   * @opt_param string projectId Deprecated. The Google Developers Console
69   * [project ID or project
70   * number](https://developers.google.com/console/help/new/#projectnumber). This
71   * field has been deprecated and replaced by the name field.
72   * @opt_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 name
75   * field.
76   * @return Operation
77   */
78  public function delete($name, $optParams = [])
79  {
80    $params = ['name' => $name];
81    $params = array_merge($params, $optParams);
82    return $this->call('delete', [$params], Operation::class);
83  }
84  /**
85   * Retrieves the requested node pool. (nodePools.get)
86   *
87   * @param string $name The name (project, location, cluster, node pool id) of
88   * the node pool to get. Specified in the format
89   * `projects/locations/clusters/nodePools`.
90   * @param array $optParams Optional parameters.
91   *
92   * @opt_param string clusterId Deprecated. The name of the cluster. This field
93   * has been deprecated and replaced by the name field.
94   * @opt_param string nodePoolId Deprecated. The name of the node pool. This
95   * field has been deprecated and replaced by the name field.
96   * @opt_param string projectId Deprecated. The Google Developers Console
97   * [project ID or project
98   * number](https://developers.google.com/console/help/new/#projectnumber). This
99   * field has been deprecated and replaced by the name field.
100   * @opt_param string zone Deprecated. The name of the Google Compute Engine
101   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
102   * cluster resides. This field has been deprecated and replaced by the name
103   * field.
104   * @return NodePool
105   */
106  public function get($name, $optParams = [])
107  {
108    $params = ['name' => $name];
109    $params = array_merge($params, $optParams);
110    return $this->call('get', [$params], NodePool::class);
111  }
112  /**
113   * Lists the node pools for a cluster.
114   * (nodePools.listProjectsLocationsClustersNodePools)
115   *
116   * @param string $parent The parent (project, location, cluster name) where the
117   * node pools will be listed. Specified in the format
118   * `projects/locations/clusters`.
119   * @param array $optParams Optional parameters.
120   *
121   * @opt_param string clusterId Deprecated. The name of the cluster. This field
122   * has been deprecated and replaced by the parent field.
123   * @opt_param string projectId Deprecated. The Google Developers Console
124   * [project ID or project
125   * number](https://developers.google.com/console/help/new/#projectnumber). This
126   * field has been deprecated and replaced by the parent field.
127   * @opt_param string zone Deprecated. The name of the Google Compute Engine
128   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
129   * cluster resides. This field has been deprecated and replaced by the parent
130   * field.
131   * @return ListNodePoolsResponse
132   */
133  public function listProjectsLocationsClustersNodePools($parent, $optParams = [])
134  {
135    $params = ['parent' => $parent];
136    $params = array_merge($params, $optParams);
137    return $this->call('list', [$params], ListNodePoolsResponse::class);
138  }
139  /**
140   * Rolls back a previously Aborted or Failed NodePool upgrade. This makes no
141   * changes if the last upgrade successfully completed. (nodePools.rollback)
142   *
143   * @param string $name The name (project, location, cluster, node pool id) of
144   * the node poll to rollback upgrade. Specified in the format
145   * `projects/locations/clusters/nodePools`.
146   * @param RollbackNodePoolUpgradeRequest $postBody
147   * @param array $optParams Optional parameters.
148   * @return Operation
149   */
150  public function rollback($name, RollbackNodePoolUpgradeRequest $postBody, $optParams = [])
151  {
152    $params = ['name' => $name, 'postBody' => $postBody];
153    $params = array_merge($params, $optParams);
154    return $this->call('rollback', [$params], Operation::class);
155  }
156  /**
157   * Sets the autoscaling settings for the specified node pool.
158   * (nodePools.setAutoscaling)
159   *
160   * @param string $name The name (project, location, cluster, node pool) of the
161   * node pool to set autoscaler settings. Specified in the format
162   * `projects/locations/clusters/nodePools`.
163   * @param SetNodePoolAutoscalingRequest $postBody
164   * @param array $optParams Optional parameters.
165   * @return Operation
166   */
167  public function setAutoscaling($name, SetNodePoolAutoscalingRequest $postBody, $optParams = [])
168  {
169    $params = ['name' => $name, 'postBody' => $postBody];
170    $params = array_merge($params, $optParams);
171    return $this->call('setAutoscaling', [$params], Operation::class);
172  }
173  /**
174   * Sets the NodeManagement options for a node pool. (nodePools.setManagement)
175   *
176   * @param string $name The name (project, location, cluster, node pool id) of
177   * the node pool to set management properties. Specified in the format
178   * `projects/locations/clusters/nodePools`.
179   * @param SetNodePoolManagementRequest $postBody
180   * @param array $optParams Optional parameters.
181   * @return Operation
182   */
183  public function setManagement($name, SetNodePoolManagementRequest $postBody, $optParams = [])
184  {
185    $params = ['name' => $name, 'postBody' => $postBody];
186    $params = array_merge($params, $optParams);
187    return $this->call('setManagement', [$params], Operation::class);
188  }
189  /**
190   * Sets the size for a specific node pool. The new size will be used for all
191   * replicas, including future replicas created by modifying NodePool.locations.
192   * (nodePools.setSize)
193   *
194   * @param string $name The name (project, location, cluster, node pool id) of
195   * the node pool to set size. Specified in the format
196   * `projects/locations/clusters/nodePools`.
197   * @param SetNodePoolSizeRequest $postBody
198   * @param array $optParams Optional parameters.
199   * @return Operation
200   */
201  public function setSize($name, SetNodePoolSizeRequest $postBody, $optParams = [])
202  {
203    $params = ['name' => $name, 'postBody' => $postBody];
204    $params = array_merge($params, $optParams);
205    return $this->call('setSize', [$params], Operation::class);
206  }
207  /**
208   * Updates the version and/or image type for the specified node pool.
209   * (nodePools.update)
210   *
211   * @param string $name The name (project, location, cluster, node pool) of the
212   * node pool to update. Specified in the format
213   * `projects/locations/clusters/nodePools`.
214   * @param UpdateNodePoolRequest $postBody
215   * @param array $optParams Optional parameters.
216   * @return Operation
217   */
218  public function update($name, UpdateNodePoolRequest $postBody, $optParams = [])
219  {
220    $params = ['name' => $name, 'postBody' => $postBody];
221    $params = array_merge($params, $optParams);
222    return $this->call('update', [$params], Operation::class);
223  }
224}
225
226// Adding a class alias for backwards compatibility with the previous class name.
227class_alias(ProjectsLocationsClustersNodePools::class, 'Google_Service_Container_Resource_ProjectsLocationsClustersNodePools');
228