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