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\Compute\Resource; 19 20use Google\Service\Compute\NodeGroup; 21use Google\Service\Compute\NodeGroupAggregatedList; 22use Google\Service\Compute\NodeGroupList; 23use Google\Service\Compute\NodeGroupsAddNodesRequest; 24use Google\Service\Compute\NodeGroupsDeleteNodesRequest; 25use Google\Service\Compute\NodeGroupsListNodes; 26use Google\Service\Compute\NodeGroupsSetNodeTemplateRequest; 27use Google\Service\Compute\Operation; 28use Google\Service\Compute\Policy; 29use Google\Service\Compute\TestPermissionsRequest; 30use Google\Service\Compute\TestPermissionsResponse; 31use Google\Service\Compute\ZoneSetPolicyRequest; 32 33/** 34 * The "nodeGroups" collection of methods. 35 * Typical usage is: 36 * <code> 37 * $computeService = new Google\Service\Compute(...); 38 * $nodeGroups = $computeService->nodeGroups; 39 * </code> 40 */ 41class NodeGroups extends \Google\Service\Resource 42{ 43 /** 44 * Adds specified number of nodes to the node group. (nodeGroups.addNodes) 45 * 46 * @param string $project Project ID for this request. 47 * @param string $zone The name of the zone for this request. 48 * @param string $nodeGroup Name of the NodeGroup resource. 49 * @param NodeGroupsAddNodesRequest $postBody 50 * @param array $optParams Optional parameters. 51 * 52 * @opt_param string requestId An optional request ID to identify requests. 53 * Specify a unique request ID so that if you must retry your request, the 54 * server will know to ignore the request if it has already been completed. For 55 * example, consider a situation where you make an initial request and the 56 * request times out. If you make the request again with the same request ID, 57 * the server can check if original operation with the same request ID was 58 * received, and if so, will ignore the second request. This prevents clients 59 * from accidentally creating duplicate commitments. The request ID must be a 60 * valid UUID with the exception that zero UUID is not supported ( 61 * 00000000-0000-0000-0000-000000000000). 62 * @return Operation 63 */ 64 public function addNodes($project, $zone, $nodeGroup, NodeGroupsAddNodesRequest $postBody, $optParams = []) 65 { 66 $params = ['project' => $project, 'zone' => $zone, 'nodeGroup' => $nodeGroup, 'postBody' => $postBody]; 67 $params = array_merge($params, $optParams); 68 return $this->call('addNodes', [$params], Operation::class); 69 } 70 /** 71 * Retrieves an aggregated list of node groups. Note: use nodeGroups.listNodes 72 * for more details about each group. (nodeGroups.aggregatedList) 73 * 74 * @param string $project Project ID for this request. 75 * @param array $optParams Optional parameters. 76 * 77 * @opt_param string filter A filter expression that filters resources listed in 78 * the response. The expression must specify the field name, an operator, and 79 * the value that you want to use for filtering. The value must be a string, a 80 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 81 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 82 * can exclude instances named `example-instance` by specifying `name != 83 * example-instance`. The `:` operator can be used with string fields to match 84 * substrings. For non-string fields it is equivalent to the `=` operator. The 85 * `:*` comparison can be used to test whether a key has been defined. For 86 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 87 * You can also filter nested fields. For example, you could specify 88 * `scheduling.automaticRestart = false` to include instances only if they are 89 * not scheduled for automatic restarts. You can use filtering on nested fields 90 * to filter based on resource labels. To filter on multiple expressions, 91 * provide each separate expression within parentheses. For example: ``` 92 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 93 * default, each expression is an `AND` expression. However, you can include 94 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 95 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 96 * (scheduling.automaticRestart = true) ``` 97 * @opt_param bool includeAllScopes Indicates whether every visible scope for 98 * each scope type (zone, region, global) should be included in the response. 99 * For new resource types added after this field, the flag has no effect as new 100 * resource types will always include every visible scope for each scope type in 101 * response. For resource types which predate this field, if this flag is 102 * omitted or false, only scopes of the scope types where the resource type is 103 * expected to be found will be included. 104 * @opt_param string maxResults The maximum number of results per page that 105 * should be returned. If the number of available results is larger than 106 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 107 * get the next page of results in subsequent list requests. Acceptable values 108 * are `0` to `500`, inclusive. (Default: `500`) 109 * @opt_param string orderBy Sorts list results by a certain order. By default, 110 * results are returned in alphanumerical order based on the resource name. You 111 * can also sort results in descending order based on the creation timestamp 112 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 113 * `creationTimestamp` field in reverse chronological order (newest result 114 * first). Use this to sort resources like operations so that the newest 115 * operation is returned first. Currently, only sorting by `name` or 116 * `creationTimestamp desc` is supported. 117 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 118 * the `nextPageToken` returned by a previous list request to get the next page 119 * of results. 120 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 121 * which provides partial results in case of failure. The default value is 122 * false. 123 * @return NodeGroupAggregatedList 124 */ 125 public function aggregatedList($project, $optParams = []) 126 { 127 $params = ['project' => $project]; 128 $params = array_merge($params, $optParams); 129 return $this->call('aggregatedList', [$params], NodeGroupAggregatedList::class); 130 } 131 /** 132 * Deletes the specified NodeGroup resource. (nodeGroups.delete) 133 * 134 * @param string $project Project ID for this request. 135 * @param string $zone The name of the zone for this request. 136 * @param string $nodeGroup Name of the NodeGroup resource to delete. 137 * @param array $optParams Optional parameters. 138 * 139 * @opt_param string requestId An optional request ID to identify requests. 140 * Specify a unique request ID so that if you must retry your request, the 141 * server will know to ignore the request if it has already been completed. For 142 * example, consider a situation where you make an initial request and the 143 * request times out. If you make the request again with the same request ID, 144 * the server can check if original operation with the same request ID was 145 * received, and if so, will ignore the second request. This prevents clients 146 * from accidentally creating duplicate commitments. The request ID must be a 147 * valid UUID with the exception that zero UUID is not supported ( 148 * 00000000-0000-0000-0000-000000000000). 149 * @return Operation 150 */ 151 public function delete($project, $zone, $nodeGroup, $optParams = []) 152 { 153 $params = ['project' => $project, 'zone' => $zone, 'nodeGroup' => $nodeGroup]; 154 $params = array_merge($params, $optParams); 155 return $this->call('delete', [$params], Operation::class); 156 } 157 /** 158 * Deletes specified nodes from the node group. (nodeGroups.deleteNodes) 159 * 160 * @param string $project Project ID for this request. 161 * @param string $zone The name of the zone for this request. 162 * @param string $nodeGroup Name of the NodeGroup resource whose nodes will be 163 * deleted. 164 * @param NodeGroupsDeleteNodesRequest $postBody 165 * @param array $optParams Optional parameters. 166 * 167 * @opt_param string requestId An optional request ID to identify requests. 168 * Specify a unique request ID so that if you must retry your request, the 169 * server will know to ignore the request if it has already been completed. For 170 * example, consider a situation where you make an initial request and the 171 * request times out. If you make the request again with the same request ID, 172 * the server can check if original operation with the same request ID was 173 * received, and if so, will ignore the second request. This prevents clients 174 * from accidentally creating duplicate commitments. The request ID must be a 175 * valid UUID with the exception that zero UUID is not supported ( 176 * 00000000-0000-0000-0000-000000000000). 177 * @return Operation 178 */ 179 public function deleteNodes($project, $zone, $nodeGroup, NodeGroupsDeleteNodesRequest $postBody, $optParams = []) 180 { 181 $params = ['project' => $project, 'zone' => $zone, 'nodeGroup' => $nodeGroup, 'postBody' => $postBody]; 182 $params = array_merge($params, $optParams); 183 return $this->call('deleteNodes', [$params], Operation::class); 184 } 185 /** 186 * Returns the specified NodeGroup. Get a list of available NodeGroups by making 187 * a list() request. Note: the "nodes" field should not be used. Use 188 * nodeGroups.listNodes instead. (nodeGroups.get) 189 * 190 * @param string $project Project ID for this request. 191 * @param string $zone The name of the zone for this request. 192 * @param string $nodeGroup Name of the node group to return. 193 * @param array $optParams Optional parameters. 194 * @return NodeGroup 195 */ 196 public function get($project, $zone, $nodeGroup, $optParams = []) 197 { 198 $params = ['project' => $project, 'zone' => $zone, 'nodeGroup' => $nodeGroup]; 199 $params = array_merge($params, $optParams); 200 return $this->call('get', [$params], NodeGroup::class); 201 } 202 /** 203 * Gets the access control policy for a resource. May be empty if no such policy 204 * or resource exists. (nodeGroups.getIamPolicy) 205 * 206 * @param string $project Project ID for this request. 207 * @param string $zone The name of the zone for this request. 208 * @param string $resource Name or id of the resource for this request. 209 * @param array $optParams Optional parameters. 210 * 211 * @opt_param int optionsRequestedPolicyVersion Requested IAM Policy version. 212 * @return Policy 213 */ 214 public function getIamPolicy($project, $zone, $resource, $optParams = []) 215 { 216 $params = ['project' => $project, 'zone' => $zone, 'resource' => $resource]; 217 $params = array_merge($params, $optParams); 218 return $this->call('getIamPolicy', [$params], Policy::class); 219 } 220 /** 221 * Creates a NodeGroup resource in the specified project using the data included 222 * in the request. (nodeGroups.insert) 223 * 224 * @param string $project Project ID for this request. 225 * @param string $zone The name of the zone for this request. 226 * @param int $initialNodeCount Initial count of nodes in the node group. 227 * @param NodeGroup $postBody 228 * @param array $optParams Optional parameters. 229 * 230 * @opt_param string requestId An optional request ID to identify requests. 231 * Specify a unique request ID so that if you must retry your request, the 232 * server will know to ignore the request if it has already been completed. For 233 * example, consider a situation where you make an initial request and the 234 * request times out. If you make the request again with the same request ID, 235 * the server can check if original operation with the same request ID was 236 * received, and if so, will ignore the second request. This prevents clients 237 * from accidentally creating duplicate commitments. The request ID must be a 238 * valid UUID with the exception that zero UUID is not supported ( 239 * 00000000-0000-0000-0000-000000000000). 240 * @return Operation 241 */ 242 public function insert($project, $zone, $initialNodeCount, NodeGroup $postBody, $optParams = []) 243 { 244 $params = ['project' => $project, 'zone' => $zone, 'initialNodeCount' => $initialNodeCount, 'postBody' => $postBody]; 245 $params = array_merge($params, $optParams); 246 return $this->call('insert', [$params], Operation::class); 247 } 248 /** 249 * Retrieves a list of node groups available to the specified project. Note: use 250 * nodeGroups.listNodes for more details about each group. 251 * (nodeGroups.listNodeGroups) 252 * 253 * @param string $project Project ID for this request. 254 * @param string $zone The name of the zone for this request. 255 * @param array $optParams Optional parameters. 256 * 257 * @opt_param string filter A filter expression that filters resources listed in 258 * the response. The expression must specify the field name, an operator, and 259 * the value that you want to use for filtering. The value must be a string, a 260 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 261 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 262 * can exclude instances named `example-instance` by specifying `name != 263 * example-instance`. The `:` operator can be used with string fields to match 264 * substrings. For non-string fields it is equivalent to the `=` operator. The 265 * `:*` comparison can be used to test whether a key has been defined. For 266 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 267 * You can also filter nested fields. For example, you could specify 268 * `scheduling.automaticRestart = false` to include instances only if they are 269 * not scheduled for automatic restarts. You can use filtering on nested fields 270 * to filter based on resource labels. To filter on multiple expressions, 271 * provide each separate expression within parentheses. For example: ``` 272 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 273 * default, each expression is an `AND` expression. However, you can include 274 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 275 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 276 * (scheduling.automaticRestart = true) ``` 277 * @opt_param string maxResults The maximum number of results per page that 278 * should be returned. If the number of available results is larger than 279 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 280 * get the next page of results in subsequent list requests. Acceptable values 281 * are `0` to `500`, inclusive. (Default: `500`) 282 * @opt_param string orderBy Sorts list results by a certain order. By default, 283 * results are returned in alphanumerical order based on the resource name. You 284 * can also sort results in descending order based on the creation timestamp 285 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 286 * `creationTimestamp` field in reverse chronological order (newest result 287 * first). Use this to sort resources like operations so that the newest 288 * operation is returned first. Currently, only sorting by `name` or 289 * `creationTimestamp desc` is supported. 290 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 291 * the `nextPageToken` returned by a previous list request to get the next page 292 * of results. 293 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 294 * which provides partial results in case of failure. The default value is 295 * false. 296 * @return NodeGroupList 297 */ 298 public function listNodeGroups($project, $zone, $optParams = []) 299 { 300 $params = ['project' => $project, 'zone' => $zone]; 301 $params = array_merge($params, $optParams); 302 return $this->call('list', [$params], NodeGroupList::class); 303 } 304 /** 305 * Lists nodes in the node group. (nodeGroups.listNodes) 306 * 307 * @param string $project Project ID for this request. 308 * @param string $zone The name of the zone for this request. 309 * @param string $nodeGroup Name of the NodeGroup resource whose nodes you want 310 * to list. 311 * @param array $optParams Optional parameters. 312 * 313 * @opt_param string filter A filter expression that filters resources listed in 314 * the response. The expression must specify the field name, an operator, and 315 * the value that you want to use for filtering. The value must be a string, a 316 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 317 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 318 * can exclude instances named `example-instance` by specifying `name != 319 * example-instance`. The `:` operator can be used with string fields to match 320 * substrings. For non-string fields it is equivalent to the `=` operator. The 321 * `:*` comparison can be used to test whether a key has been defined. For 322 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 323 * You can also filter nested fields. For example, you could specify 324 * `scheduling.automaticRestart = false` to include instances only if they are 325 * not scheduled for automatic restarts. You can use filtering on nested fields 326 * to filter based on resource labels. To filter on multiple expressions, 327 * provide each separate expression within parentheses. For example: ``` 328 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 329 * default, each expression is an `AND` expression. However, you can include 330 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 331 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 332 * (scheduling.automaticRestart = true) ``` 333 * @opt_param string maxResults The maximum number of results per page that 334 * should be returned. If the number of available results is larger than 335 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 336 * get the next page of results in subsequent list requests. Acceptable values 337 * are `0` to `500`, inclusive. (Default: `500`) 338 * @opt_param string orderBy Sorts list results by a certain order. By default, 339 * results are returned in alphanumerical order based on the resource name. You 340 * can also sort results in descending order based on the creation timestamp 341 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 342 * `creationTimestamp` field in reverse chronological order (newest result 343 * first). Use this to sort resources like operations so that the newest 344 * operation is returned first. Currently, only sorting by `name` or 345 * `creationTimestamp desc` is supported. 346 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 347 * the `nextPageToken` returned by a previous list request to get the next page 348 * of results. 349 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 350 * which provides partial results in case of failure. The default value is 351 * false. 352 * @return NodeGroupsListNodes 353 */ 354 public function listNodes($project, $zone, $nodeGroup, $optParams = []) 355 { 356 $params = ['project' => $project, 'zone' => $zone, 'nodeGroup' => $nodeGroup]; 357 $params = array_merge($params, $optParams); 358 return $this->call('listNodes', [$params], NodeGroupsListNodes::class); 359 } 360 /** 361 * Updates the specified node group. (nodeGroups.patch) 362 * 363 * @param string $project Project ID for this request. 364 * @param string $zone The name of the zone for this request. 365 * @param string $nodeGroup Name of the NodeGroup resource to update. 366 * @param NodeGroup $postBody 367 * @param array $optParams Optional parameters. 368 * 369 * @opt_param string requestId An optional request ID to identify requests. 370 * Specify a unique request ID so that if you must retry your request, the 371 * server will know to ignore the request if it has already been completed. For 372 * example, consider a situation where you make an initial request and the 373 * request times out. If you make the request again with the same request ID, 374 * the server can check if original operation with the same request ID was 375 * received, and if so, will ignore the second request. This prevents clients 376 * from accidentally creating duplicate commitments. The request ID must be a 377 * valid UUID with the exception that zero UUID is not supported ( 378 * 00000000-0000-0000-0000-000000000000). 379 * @return Operation 380 */ 381 public function patch($project, $zone, $nodeGroup, NodeGroup $postBody, $optParams = []) 382 { 383 $params = ['project' => $project, 'zone' => $zone, 'nodeGroup' => $nodeGroup, 'postBody' => $postBody]; 384 $params = array_merge($params, $optParams); 385 return $this->call('patch', [$params], Operation::class); 386 } 387 /** 388 * Sets the access control policy on the specified resource. Replaces any 389 * existing policy. (nodeGroups.setIamPolicy) 390 * 391 * @param string $project Project ID for this request. 392 * @param string $zone The name of the zone for this request. 393 * @param string $resource Name or id of the resource for this request. 394 * @param ZoneSetPolicyRequest $postBody 395 * @param array $optParams Optional parameters. 396 * @return Policy 397 */ 398 public function setIamPolicy($project, $zone, $resource, ZoneSetPolicyRequest $postBody, $optParams = []) 399 { 400 $params = ['project' => $project, 'zone' => $zone, 'resource' => $resource, 'postBody' => $postBody]; 401 $params = array_merge($params, $optParams); 402 return $this->call('setIamPolicy', [$params], Policy::class); 403 } 404 /** 405 * Updates the node template of the node group. (nodeGroups.setNodeTemplate) 406 * 407 * @param string $project Project ID for this request. 408 * @param string $zone The name of the zone for this request. 409 * @param string $nodeGroup Name of the NodeGroup resource to update. 410 * @param NodeGroupsSetNodeTemplateRequest $postBody 411 * @param array $optParams Optional parameters. 412 * 413 * @opt_param string requestId An optional request ID to identify requests. 414 * Specify a unique request ID so that if you must retry your request, the 415 * server will know to ignore the request if it has already been completed. For 416 * example, consider a situation where you make an initial request and the 417 * request times out. If you make the request again with the same request ID, 418 * the server can check if original operation with the same request ID was 419 * received, and if so, will ignore the second request. This prevents clients 420 * from accidentally creating duplicate commitments. The request ID must be a 421 * valid UUID with the exception that zero UUID is not supported ( 422 * 00000000-0000-0000-0000-000000000000). 423 * @return Operation 424 */ 425 public function setNodeTemplate($project, $zone, $nodeGroup, NodeGroupsSetNodeTemplateRequest $postBody, $optParams = []) 426 { 427 $params = ['project' => $project, 'zone' => $zone, 'nodeGroup' => $nodeGroup, 'postBody' => $postBody]; 428 $params = array_merge($params, $optParams); 429 return $this->call('setNodeTemplate', [$params], Operation::class); 430 } 431 /** 432 * Returns permissions that a caller has on the specified resource. 433 * (nodeGroups.testIamPermissions) 434 * 435 * @param string $project Project ID for this request. 436 * @param string $zone The name of the zone for this request. 437 * @param string $resource Name or id of the resource for this request. 438 * @param TestPermissionsRequest $postBody 439 * @param array $optParams Optional parameters. 440 * @return TestPermissionsResponse 441 */ 442 public function testIamPermissions($project, $zone, $resource, TestPermissionsRequest $postBody, $optParams = []) 443 { 444 $params = ['project' => $project, 'zone' => $zone, 'resource' => $resource, 'postBody' => $postBody]; 445 $params = array_merge($params, $optParams); 446 return $this->call('testIamPermissions', [$params], TestPermissionsResponse::class); 447 } 448} 449 450// Adding a class alias for backwards compatibility with the previous class name. 451class_alias(NodeGroups::class, 'Google_Service_Compute_Resource_NodeGroups'); 452