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\Cluster;
21use Google\Service\Container\CompleteIPRotationRequest;
22use Google\Service\Container\CreateClusterRequest;
23use Google\Service\Container\ListClustersResponse;
24use Google\Service\Container\Operation;
25use Google\Service\Container\SetAddonsConfigRequest;
26use Google\Service\Container\SetLabelsRequest;
27use Google\Service\Container\SetLegacyAbacRequest;
28use Google\Service\Container\SetLocationsRequest;
29use Google\Service\Container\SetLoggingServiceRequest;
30use Google\Service\Container\SetMaintenancePolicyRequest;
31use Google\Service\Container\SetMasterAuthRequest;
32use Google\Service\Container\SetMonitoringServiceRequest;
33use Google\Service\Container\SetNetworkPolicyRequest;
34use Google\Service\Container\StartIPRotationRequest;
35use Google\Service\Container\UpdateClusterRequest;
36use Google\Service\Container\UpdateMasterRequest;
37
38/**
39 * The "clusters" collection of methods.
40 * Typical usage is:
41 *  <code>
42 *   $containerService = new Google\Service\Container(...);
43 *   $clusters = $containerService->clusters;
44 *  </code>
45 */
46class ProjectsZonesClusters extends \Google\Service\Resource
47{
48  /**
49   * Sets the addons for a specific cluster. (clusters.addons)
50   *
51   * @param string $projectId Deprecated. The Google Developers Console [project
52   * ID or project number](https://support.google.com/cloud/answer/6158840). This
53   * field has been deprecated and replaced by the name field.
54   * @param string $zone Deprecated. The name of the Google Compute Engine
55   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
56   * cluster resides. This field has been deprecated and replaced by the name
57   * field.
58   * @param string $clusterId Deprecated. The name of the cluster to upgrade. This
59   * field has been deprecated and replaced by the name field.
60   * @param SetAddonsConfigRequest $postBody
61   * @param array $optParams Optional parameters.
62   * @return Operation
63   */
64  public function addons($projectId, $zone, $clusterId, SetAddonsConfigRequest $postBody, $optParams = [])
65  {
66    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
67    $params = array_merge($params, $optParams);
68    return $this->call('addons', [$params], Operation::class);
69  }
70  /**
71   * Completes master IP rotation. (clusters.completeIpRotation)
72   *
73   * @param string $projectId Deprecated. The Google Developers Console [project
74   * ID or project
75   * number](https://developers.google.com/console/help/new/#projectnumber). This
76   * field has been deprecated and replaced by the name field.
77   * @param string $zone Deprecated. The name of the Google Compute Engine
78   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
79   * cluster resides. This field has been deprecated and replaced by the name
80   * field.
81   * @param string $clusterId Deprecated. The name of the cluster. This field has
82   * been deprecated and replaced by the name field.
83   * @param CompleteIPRotationRequest $postBody
84   * @param array $optParams Optional parameters.
85   * @return Operation
86   */
87  public function completeIpRotation($projectId, $zone, $clusterId, CompleteIPRotationRequest $postBody, $optParams = [])
88  {
89    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
90    $params = array_merge($params, $optParams);
91    return $this->call('completeIpRotation', [$params], Operation::class);
92  }
93  /**
94   * Creates a cluster, consisting of the specified number and type of Google
95   * Compute Engine instances. By default, the cluster is created in the project's
96   * [default network](https://cloud.google.com/compute/docs/networks-and-
97   * firewalls#networks). One firewall is added for the cluster. After cluster
98   * creation, the Kubelet creates routes for each node to allow the containers on
99   * that node to communicate with all other instances in the cluster. Finally, an
100   * entry is added to the project's global metadata indicating which CIDR range
101   * the cluster is using. (clusters.create)
102   *
103   * @param string $projectId Deprecated. The Google Developers Console [project
104   * ID or project number](https://support.google.com/cloud/answer/6158840). This
105   * field has been deprecated and replaced by the parent field.
106   * @param string $zone Deprecated. The name of the Google Compute Engine
107   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
108   * cluster resides. This field has been deprecated and replaced by the parent
109   * field.
110   * @param CreateClusterRequest $postBody
111   * @param array $optParams Optional parameters.
112   * @return Operation
113   */
114  public function create($projectId, $zone, CreateClusterRequest $postBody, $optParams = [])
115  {
116    $params = ['projectId' => $projectId, 'zone' => $zone, 'postBody' => $postBody];
117    $params = array_merge($params, $optParams);
118    return $this->call('create', [$params], Operation::class);
119  }
120  /**
121   * Deletes the cluster, including the Kubernetes endpoint and all worker nodes.
122   * Firewalls and routes that were configured during cluster creation are also
123   * deleted. Other Google Compute Engine resources that might be in use by the
124   * cluster, such as load balancer resources, are not deleted if they weren't
125   * present when the cluster was initially created. (clusters.delete)
126   *
127   * @param string $projectId Deprecated. The Google Developers Console [project
128   * ID or project number](https://support.google.com/cloud/answer/6158840). This
129   * field has been deprecated and replaced by the name field.
130   * @param string $zone Deprecated. The name of the Google Compute Engine
131   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
132   * cluster resides. This field has been deprecated and replaced by the name
133   * field.
134   * @param string $clusterId Deprecated. The name of the cluster to delete. This
135   * field has been deprecated and replaced by the name field.
136   * @param array $optParams Optional parameters.
137   *
138   * @opt_param string name The name (project, location, cluster) of the cluster
139   * to delete. Specified in the format `projects/locations/clusters`.
140   * @return Operation
141   */
142  public function delete($projectId, $zone, $clusterId, $optParams = [])
143  {
144    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId];
145    $params = array_merge($params, $optParams);
146    return $this->call('delete', [$params], Operation::class);
147  }
148  /**
149   * Gets the details of a specific cluster. (clusters.get)
150   *
151   * @param string $projectId Deprecated. The Google Developers Console [project
152   * ID or project number](https://support.google.com/cloud/answer/6158840). This
153   * field has been deprecated and replaced by the name field.
154   * @param string $zone Deprecated. The name of the Google Compute Engine
155   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
156   * cluster resides. This field has been deprecated and replaced by the name
157   * field.
158   * @param string $clusterId Deprecated. The name of the cluster to retrieve.
159   * This field has been deprecated and replaced by the name field.
160   * @param array $optParams Optional parameters.
161   *
162   * @opt_param string name The name (project, location, cluster) of the cluster
163   * to retrieve. Specified in the format `projects/locations/clusters`.
164   * @return Cluster
165   */
166  public function get($projectId, $zone, $clusterId, $optParams = [])
167  {
168    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId];
169    $params = array_merge($params, $optParams);
170    return $this->call('get', [$params], Cluster::class);
171  }
172  /**
173   * Enables or disables the ABAC authorization mechanism on a cluster.
174   * (clusters.legacyAbac)
175   *
176   * @param string $projectId Deprecated. The Google Developers Console [project
177   * ID or project number](https://support.google.com/cloud/answer/6158840). This
178   * field has been deprecated and replaced by the name field.
179   * @param string $zone Deprecated. The name of the Google Compute Engine
180   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
181   * cluster resides. This field has been deprecated and replaced by the name
182   * field.
183   * @param string $clusterId Deprecated. The name of the cluster to update. This
184   * field has been deprecated and replaced by the name field.
185   * @param SetLegacyAbacRequest $postBody
186   * @param array $optParams Optional parameters.
187   * @return Operation
188   */
189  public function legacyAbac($projectId, $zone, $clusterId, SetLegacyAbacRequest $postBody, $optParams = [])
190  {
191    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
192    $params = array_merge($params, $optParams);
193    return $this->call('legacyAbac', [$params], Operation::class);
194  }
195  /**
196   * Lists all clusters owned by a project in either the specified zone or all
197   * zones. (clusters.listProjectsZonesClusters)
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 parent 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, or "-" for all zones. This field has been deprecated and
205   * replaced by the parent field.
206   * @param array $optParams Optional parameters.
207   *
208   * @opt_param string parent The parent (project and location) where the clusters
209   * will be listed. Specified in the format `projects/locations`. Location "-"
210   * matches all zones and all regions.
211   * @return ListClustersResponse
212   */
213  public function listProjectsZonesClusters($projectId, $zone, $optParams = [])
214  {
215    $params = ['projectId' => $projectId, 'zone' => $zone];
216    $params = array_merge($params, $optParams);
217    return $this->call('list', [$params], ListClustersResponse::class);
218  }
219  /**
220   * Sets the locations for a specific cluster. Deprecated. Use
221   * [projects.locations.clusters.update](https://cloud.google.com/kubernetes-
222   * engine/docs/reference/rest/v1/projects.locations.clusters/update) instead.
223   * (clusters.locations)
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 upgrade. This
233   * field has been deprecated and replaced by the name field.
234   * @param SetLocationsRequest $postBody
235   * @param array $optParams Optional parameters.
236   * @return Operation
237   */
238  public function locations($projectId, $zone, $clusterId, SetLocationsRequest $postBody, $optParams = [])
239  {
240    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
241    $params = array_merge($params, $optParams);
242    return $this->call('locations', [$params], Operation::class);
243  }
244  /**
245   * Sets the logging service for a specific cluster. (clusters.logging)
246   *
247   * @param string $projectId Deprecated. The Google Developers Console [project
248   * ID or project number](https://support.google.com/cloud/answer/6158840). This
249   * field has been deprecated and replaced by the name field.
250   * @param string $zone Deprecated. The name of the Google Compute Engine
251   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
252   * cluster resides. This field has been deprecated and replaced by the name
253   * field.
254   * @param string $clusterId Deprecated. The name of the cluster to upgrade. This
255   * field has been deprecated and replaced by the name field.
256   * @param SetLoggingServiceRequest $postBody
257   * @param array $optParams Optional parameters.
258   * @return Operation
259   */
260  public function logging($projectId, $zone, $clusterId, SetLoggingServiceRequest $postBody, $optParams = [])
261  {
262    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
263    $params = array_merge($params, $optParams);
264    return $this->call('logging', [$params], Operation::class);
265  }
266  /**
267   * Updates the master for a specific cluster. (clusters.master)
268   *
269   * @param string $projectId Deprecated. The Google Developers Console [project
270   * ID or project number](https://support.google.com/cloud/answer/6158840). This
271   * field has been deprecated and replaced by the name field.
272   * @param string $zone Deprecated. The name of the Google Compute Engine
273   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
274   * cluster resides. This field has been deprecated and replaced by the name
275   * field.
276   * @param string $clusterId Deprecated. The name of the cluster to upgrade. This
277   * field has been deprecated and replaced by the name field.
278   * @param UpdateMasterRequest $postBody
279   * @param array $optParams Optional parameters.
280   * @return Operation
281   */
282  public function master($projectId, $zone, $clusterId, UpdateMasterRequest $postBody, $optParams = [])
283  {
284    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
285    $params = array_merge($params, $optParams);
286    return $this->call('master', [$params], Operation::class);
287  }
288  /**
289   * Sets the monitoring service for a specific cluster. (clusters.monitoring)
290   *
291   * @param string $projectId Deprecated. The Google Developers Console [project
292   * ID or project number](https://support.google.com/cloud/answer/6158840). This
293   * field has been deprecated and replaced by the name field.
294   * @param string $zone Deprecated. The name of the Google Compute Engine
295   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
296   * cluster resides. This field has been deprecated and replaced by the name
297   * field.
298   * @param string $clusterId Deprecated. The name of the cluster to upgrade. This
299   * field has been deprecated and replaced by the name field.
300   * @param SetMonitoringServiceRequest $postBody
301   * @param array $optParams Optional parameters.
302   * @return Operation
303   */
304  public function monitoring($projectId, $zone, $clusterId, SetMonitoringServiceRequest $postBody, $optParams = [])
305  {
306    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
307    $params = array_merge($params, $optParams);
308    return $this->call('monitoring', [$params], Operation::class);
309  }
310  /**
311   * Sets labels on a cluster. (clusters.resourceLabels)
312   *
313   * @param string $projectId Deprecated. The Google Developers Console [project
314   * ID or project
315   * number](https://developers.google.com/console/help/new/#projectnumber). This
316   * field has been deprecated and replaced by the name field.
317   * @param string $zone Deprecated. The name of the Google Compute Engine
318   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
319   * cluster resides. This field has been deprecated and replaced by the name
320   * field.
321   * @param string $clusterId Deprecated. The name of the cluster. This field has
322   * been deprecated and replaced by the name field.
323   * @param SetLabelsRequest $postBody
324   * @param array $optParams Optional parameters.
325   * @return Operation
326   */
327  public function resourceLabels($projectId, $zone, $clusterId, SetLabelsRequest $postBody, $optParams = [])
328  {
329    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
330    $params = array_merge($params, $optParams);
331    return $this->call('resourceLabels', [$params], Operation::class);
332  }
333  /**
334   * Sets the maintenance policy for a cluster. (clusters.setMaintenancePolicy)
335   *
336   * @param string $projectId Required. The Google Developers Console [project ID
337   * or project number](https://support.google.com/cloud/answer/6158840).
338   * @param string $zone Required. The name of the Google Compute Engine
339   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
340   * cluster resides.
341   * @param string $clusterId Required. The name of the cluster to update.
342   * @param SetMaintenancePolicyRequest $postBody
343   * @param array $optParams Optional parameters.
344   * @return Operation
345   */
346  public function setMaintenancePolicy($projectId, $zone, $clusterId, SetMaintenancePolicyRequest $postBody, $optParams = [])
347  {
348    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
349    $params = array_merge($params, $optParams);
350    return $this->call('setMaintenancePolicy', [$params], Operation::class);
351  }
352  /**
353   * Sets master auth materials. Currently supports changing the admin password or
354   * a specific cluster, either via password generation or explicitly setting the
355   * password. (clusters.setMasterAuth)
356   *
357   * @param string $projectId Deprecated. The Google Developers Console [project
358   * ID or project number](https://support.google.com/cloud/answer/6158840). This
359   * field has been deprecated and replaced by the name field.
360   * @param string $zone Deprecated. The name of the Google Compute Engine
361   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
362   * cluster resides. This field has been deprecated and replaced by the name
363   * field.
364   * @param string $clusterId Deprecated. The name of the cluster to upgrade. This
365   * field has been deprecated and replaced by the name field.
366   * @param SetMasterAuthRequest $postBody
367   * @param array $optParams Optional parameters.
368   * @return Operation
369   */
370  public function setMasterAuth($projectId, $zone, $clusterId, SetMasterAuthRequest $postBody, $optParams = [])
371  {
372    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
373    $params = array_merge($params, $optParams);
374    return $this->call('setMasterAuth', [$params], Operation::class);
375  }
376  /**
377   * Enables or disables Network Policy for a cluster. (clusters.setNetworkPolicy)
378   *
379   * @param string $projectId Deprecated. The Google Developers Console [project
380   * ID or project
381   * number](https://developers.google.com/console/help/new/#projectnumber). This
382   * field has been deprecated and replaced by the name field.
383   * @param string $zone Deprecated. The name of the Google Compute Engine
384   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
385   * cluster resides. This field has been deprecated and replaced by the name
386   * field.
387   * @param string $clusterId Deprecated. The name of the cluster. This field has
388   * been deprecated and replaced by the name field.
389   * @param SetNetworkPolicyRequest $postBody
390   * @param array $optParams Optional parameters.
391   * @return Operation
392   */
393  public function setNetworkPolicy($projectId, $zone, $clusterId, SetNetworkPolicyRequest $postBody, $optParams = [])
394  {
395    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
396    $params = array_merge($params, $optParams);
397    return $this->call('setNetworkPolicy', [$params], Operation::class);
398  }
399  /**
400   * Starts master IP rotation. (clusters.startIpRotation)
401   *
402   * @param string $projectId Deprecated. The Google Developers Console [project
403   * ID or project
404   * number](https://developers.google.com/console/help/new/#projectnumber). This
405   * field has been deprecated and replaced by the name field.
406   * @param string $zone Deprecated. The name of the Google Compute Engine
407   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
408   * cluster resides. This field has been deprecated and replaced by the name
409   * field.
410   * @param string $clusterId Deprecated. The name of the cluster. This field has
411   * been deprecated and replaced by the name field.
412   * @param StartIPRotationRequest $postBody
413   * @param array $optParams Optional parameters.
414   * @return Operation
415   */
416  public function startIpRotation($projectId, $zone, $clusterId, StartIPRotationRequest $postBody, $optParams = [])
417  {
418    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
419    $params = array_merge($params, $optParams);
420    return $this->call('startIpRotation', [$params], Operation::class);
421  }
422  /**
423   * Updates the settings of a specific cluster. (clusters.update)
424   *
425   * @param string $projectId Deprecated. The Google Developers Console [project
426   * ID or project number](https://support.google.com/cloud/answer/6158840). This
427   * field has been deprecated and replaced by the name field.
428   * @param string $zone Deprecated. The name of the Google Compute Engine
429   * [zone](https://cloud.google.com/compute/docs/zones#available) in which the
430   * cluster resides. This field has been deprecated and replaced by the name
431   * field.
432   * @param string $clusterId Deprecated. The name of the cluster to upgrade. This
433   * field has been deprecated and replaced by the name field.
434   * @param UpdateClusterRequest $postBody
435   * @param array $optParams Optional parameters.
436   * @return Operation
437   */
438  public function update($projectId, $zone, $clusterId, UpdateClusterRequest $postBody, $optParams = [])
439  {
440    $params = ['projectId' => $projectId, 'zone' => $zone, 'clusterId' => $clusterId, 'postBody' => $postBody];
441    $params = array_merge($params, $optParams);
442    return $this->call('update', [$params], Operation::class);
443  }
444}
445
446// Adding a class alias for backwards compatibility with the previous class name.
447class_alias(ProjectsZonesClusters::class, 'Google_Service_Container_Resource_ProjectsZonesClusters');
448