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\InstanceGroupManager; 21use Google\Service\Compute\InstanceGroupManagerAggregatedList; 22use Google\Service\Compute\InstanceGroupManagerList; 23use Google\Service\Compute\InstanceGroupManagersAbandonInstancesRequest; 24use Google\Service\Compute\InstanceGroupManagersApplyUpdatesRequest; 25use Google\Service\Compute\InstanceGroupManagersCreateInstancesRequest; 26use Google\Service\Compute\InstanceGroupManagersDeleteInstancesRequest; 27use Google\Service\Compute\InstanceGroupManagersDeletePerInstanceConfigsReq; 28use Google\Service\Compute\InstanceGroupManagersListErrorsResponse; 29use Google\Service\Compute\InstanceGroupManagersListManagedInstancesResponse; 30use Google\Service\Compute\InstanceGroupManagersListPerInstanceConfigsResp; 31use Google\Service\Compute\InstanceGroupManagersPatchPerInstanceConfigsReq; 32use Google\Service\Compute\InstanceGroupManagersRecreateInstancesRequest; 33use Google\Service\Compute\InstanceGroupManagersSetInstanceTemplateRequest; 34use Google\Service\Compute\InstanceGroupManagersSetTargetPoolsRequest; 35use Google\Service\Compute\InstanceGroupManagersUpdatePerInstanceConfigsReq; 36use Google\Service\Compute\Operation; 37 38/** 39 * The "instanceGroupManagers" collection of methods. 40 * Typical usage is: 41 * <code> 42 * $computeService = new Google\Service\Compute(...); 43 * $instanceGroupManagers = $computeService->instanceGroupManagers; 44 * </code> 45 */ 46class InstanceGroupManagers extends \Google\Service\Resource 47{ 48 /** 49 * Flags the specified instances to be removed from the managed instance group. 50 * Abandoning an instance does not delete the instance, but it does remove the 51 * instance from any target pools that are applied by the managed instance 52 * group. This method reduces the targetSize of the managed instance group by 53 * the number of instances that you abandon. This operation is marked as DONE 54 * when the action is scheduled even if the instances have not yet been removed 55 * from the group. You must separately verify the status of the abandoning 56 * action with the listmanagedinstances method. If the group is part of a 57 * backend service that has enabled connection draining, it can take up to 60 58 * seconds after the connection draining duration has elapsed before the VM 59 * instance is removed or deleted. You can specify a maximum of 1000 instances 60 * with this method per request. (instanceGroupManagers.abandonInstances) 61 * 62 * @param string $project Project ID for this request. 63 * @param string $zone The name of the zone where the managed instance group is 64 * located. 65 * @param string $instanceGroupManager The name of the managed instance group. 66 * @param InstanceGroupManagersAbandonInstancesRequest $postBody 67 * @param array $optParams Optional parameters. 68 * 69 * @opt_param string requestId An optional request ID to identify requests. 70 * Specify a unique request ID so that if you must retry your request, the 71 * server will know to ignore the request if it has already been completed. For 72 * example, consider a situation where you make an initial request and the 73 * request times out. If you make the request again with the same request ID, 74 * the server can check if original operation with the same request ID was 75 * received, and if so, will ignore the second request. This prevents clients 76 * from accidentally creating duplicate commitments. The request ID must be a 77 * valid UUID with the exception that zero UUID is not supported ( 78 * 00000000-0000-0000-0000-000000000000). 79 * @return Operation 80 */ 81 public function abandonInstances($project, $zone, $instanceGroupManager, InstanceGroupManagersAbandonInstancesRequest $postBody, $optParams = []) 82 { 83 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager, 'postBody' => $postBody]; 84 $params = array_merge($params, $optParams); 85 return $this->call('abandonInstances', [$params], Operation::class); 86 } 87 /** 88 * Retrieves the list of managed instance groups and groups them by zone. 89 * (instanceGroupManagers.aggregatedList) 90 * 91 * @param string $project Project ID for this request. 92 * @param array $optParams Optional parameters. 93 * 94 * @opt_param string filter A filter expression that filters resources listed in 95 * the response. The expression must specify the field name, an operator, and 96 * the value that you want to use for filtering. The value must be a string, a 97 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 98 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 99 * can exclude instances named `example-instance` by specifying `name != 100 * example-instance`. The `:` operator can be used with string fields to match 101 * substrings. For non-string fields it is equivalent to the `=` operator. The 102 * `:*` comparison can be used to test whether a key has been defined. For 103 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 104 * You can also filter nested fields. For example, you could specify 105 * `scheduling.automaticRestart = false` to include instances only if they are 106 * not scheduled for automatic restarts. You can use filtering on nested fields 107 * to filter based on resource labels. To filter on multiple expressions, 108 * provide each separate expression within parentheses. For example: ``` 109 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 110 * default, each expression is an `AND` expression. However, you can include 111 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 112 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 113 * (scheduling.automaticRestart = true) ``` 114 * @opt_param bool includeAllScopes Indicates whether every visible scope for 115 * each scope type (zone, region, global) should be included in the response. 116 * For new resource types added after this field, the flag has no effect as new 117 * resource types will always include every visible scope for each scope type in 118 * response. For resource types which predate this field, if this flag is 119 * omitted or false, only scopes of the scope types where the resource type is 120 * expected to be found will be included. 121 * @opt_param string maxResults The maximum number of results per page that 122 * should be returned. If the number of available results is larger than 123 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 124 * get the next page of results in subsequent list requests. Acceptable values 125 * are `0` to `500`, inclusive. (Default: `500`) 126 * @opt_param string orderBy Sorts list results by a certain order. By default, 127 * results are returned in alphanumerical order based on the resource name. You 128 * can also sort results in descending order based on the creation timestamp 129 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 130 * `creationTimestamp` field in reverse chronological order (newest result 131 * first). Use this to sort resources like operations so that the newest 132 * operation is returned first. Currently, only sorting by `name` or 133 * `creationTimestamp desc` is supported. 134 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 135 * the `nextPageToken` returned by a previous list request to get the next page 136 * of results. 137 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 138 * which provides partial results in case of failure. The default value is 139 * false. 140 * @return InstanceGroupManagerAggregatedList 141 */ 142 public function aggregatedList($project, $optParams = []) 143 { 144 $params = ['project' => $project]; 145 $params = array_merge($params, $optParams); 146 return $this->call('aggregatedList', [$params], InstanceGroupManagerAggregatedList::class); 147 } 148 /** 149 * Applies changes to selected instances on the managed instance group. This 150 * method can be used to apply new overrides and/or new versions. 151 * (instanceGroupManagers.applyUpdatesToInstances) 152 * 153 * @param string $project Project ID for this request. 154 * @param string $zone The name of the zone where the managed instance group is 155 * located. Should conform to RFC1035. 156 * @param string $instanceGroupManager The name of the managed instance group, 157 * should conform to RFC1035. 158 * @param InstanceGroupManagersApplyUpdatesRequest $postBody 159 * @param array $optParams Optional parameters. 160 * @return Operation 161 */ 162 public function applyUpdatesToInstances($project, $zone, $instanceGroupManager, InstanceGroupManagersApplyUpdatesRequest $postBody, $optParams = []) 163 { 164 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager, 'postBody' => $postBody]; 165 $params = array_merge($params, $optParams); 166 return $this->call('applyUpdatesToInstances', [$params], Operation::class); 167 } 168 /** 169 * Creates instances with per-instance configurations in this managed instance 170 * group. Instances are created using the current instance template. The create 171 * instances operation is marked DONE if the createInstances request is 172 * successful. The underlying actions take additional time. You must separately 173 * verify the status of the creating or actions with the listmanagedinstances 174 * method. (instanceGroupManagers.createInstances) 175 * 176 * @param string $project Project ID for this request. 177 * @param string $zone The name of the zone where the managed instance group is 178 * located. It should conform to RFC1035. 179 * @param string $instanceGroupManager The name of the managed instance group. 180 * It should conform to RFC1035. 181 * @param InstanceGroupManagersCreateInstancesRequest $postBody 182 * @param array $optParams Optional parameters. 183 * 184 * @opt_param string requestId An optional request ID to identify requests. 185 * Specify a unique request ID so that if you must retry your request, the 186 * server will know to ignore the request if it has already been completed. For 187 * example, consider a situation where you make an initial request and the 188 * request times out. If you make the request again with the same request ID, 189 * the server can check if original operation with the same request ID was 190 * received, and if so, will ignore the second request. The request ID must be a 191 * valid UUID with the exception that zero UUID is not supported ( 192 * 00000000-0000-0000-0000-000000000000). 193 * @return Operation 194 */ 195 public function createInstances($project, $zone, $instanceGroupManager, InstanceGroupManagersCreateInstancesRequest $postBody, $optParams = []) 196 { 197 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager, 'postBody' => $postBody]; 198 $params = array_merge($params, $optParams); 199 return $this->call('createInstances', [$params], Operation::class); 200 } 201 /** 202 * Deletes the specified managed instance group and all of the instances in that 203 * group. Note that the instance group must not belong to a backend service. 204 * Read Deleting an instance group for more information. 205 * (instanceGroupManagers.delete) 206 * 207 * @param string $project Project ID for this request. 208 * @param string $zone The name of the zone where the managed instance group is 209 * located. 210 * @param string $instanceGroupManager The name of the managed instance group to 211 * delete. 212 * @param array $optParams Optional parameters. 213 * 214 * @opt_param string requestId An optional request ID to identify requests. 215 * Specify a unique request ID so that if you must retry your request, the 216 * server will know to ignore the request if it has already been completed. For 217 * example, consider a situation where you make an initial request and the 218 * request times out. If you make the request again with the same request ID, 219 * the server can check if original operation with the same request ID was 220 * received, and if so, will ignore the second request. This prevents clients 221 * from accidentally creating duplicate commitments. The request ID must be a 222 * valid UUID with the exception that zero UUID is not supported ( 223 * 00000000-0000-0000-0000-000000000000). 224 * @return Operation 225 */ 226 public function delete($project, $zone, $instanceGroupManager, $optParams = []) 227 { 228 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager]; 229 $params = array_merge($params, $optParams); 230 return $this->call('delete', [$params], Operation::class); 231 } 232 /** 233 * Flags the specified instances in the managed instance group for immediate 234 * deletion. The instances are also removed from any target pools of which they 235 * were a member. This method reduces the targetSize of the managed instance 236 * group by the number of instances that you delete. This operation is marked as 237 * DONE when the action is scheduled even if the instances are still being 238 * deleted. You must separately verify the status of the deleting action with 239 * the listmanagedinstances method. If the group is part of a backend service 240 * that has enabled connection draining, it can take up to 60 seconds after the 241 * connection draining duration has elapsed before the VM instance is removed or 242 * deleted. You can specify a maximum of 1000 instances with this method per 243 * request. (instanceGroupManagers.deleteInstances) 244 * 245 * @param string $project Project ID for this request. 246 * @param string $zone The name of the zone where the managed instance group is 247 * located. 248 * @param string $instanceGroupManager The name of the managed instance group. 249 * @param InstanceGroupManagersDeleteInstancesRequest $postBody 250 * @param array $optParams Optional parameters. 251 * 252 * @opt_param string requestId An optional request ID to identify requests. 253 * Specify a unique request ID so that if you must retry your request, the 254 * server will know to ignore the request if it has already been completed. For 255 * example, consider a situation where you make an initial request and the 256 * request times out. If you make the request again with the same request ID, 257 * the server can check if original operation with the same request ID was 258 * received, and if so, will ignore the second request. This prevents clients 259 * from accidentally creating duplicate commitments. The request ID must be a 260 * valid UUID with the exception that zero UUID is not supported ( 261 * 00000000-0000-0000-0000-000000000000). 262 * @return Operation 263 */ 264 public function deleteInstances($project, $zone, $instanceGroupManager, InstanceGroupManagersDeleteInstancesRequest $postBody, $optParams = []) 265 { 266 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager, 'postBody' => $postBody]; 267 $params = array_merge($params, $optParams); 268 return $this->call('deleteInstances', [$params], Operation::class); 269 } 270 /** 271 * Deletes selected per-instance configurations for the managed instance group. 272 * (instanceGroupManagers.deletePerInstanceConfigs) 273 * 274 * @param string $project Project ID for this request. 275 * @param string $zone The name of the zone where the managed instance group is 276 * located. It should conform to RFC1035. 277 * @param string $instanceGroupManager The name of the managed instance group. 278 * It should conform to RFC1035. 279 * @param InstanceGroupManagersDeletePerInstanceConfigsReq $postBody 280 * @param array $optParams Optional parameters. 281 * @return Operation 282 */ 283 public function deletePerInstanceConfigs($project, $zone, $instanceGroupManager, InstanceGroupManagersDeletePerInstanceConfigsReq $postBody, $optParams = []) 284 { 285 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager, 'postBody' => $postBody]; 286 $params = array_merge($params, $optParams); 287 return $this->call('deletePerInstanceConfigs', [$params], Operation::class); 288 } 289 /** 290 * Returns all of the details about the specified managed instance group. Gets a 291 * list of available managed instance groups by making a list() request. 292 * (instanceGroupManagers.get) 293 * 294 * @param string $project Project ID for this request. 295 * @param string $zone The name of the zone where the managed instance group is 296 * located. 297 * @param string $instanceGroupManager The name of the managed instance group. 298 * @param array $optParams Optional parameters. 299 * @return InstanceGroupManager 300 */ 301 public function get($project, $zone, $instanceGroupManager, $optParams = []) 302 { 303 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager]; 304 $params = array_merge($params, $optParams); 305 return $this->call('get', [$params], InstanceGroupManager::class); 306 } 307 /** 308 * Creates a managed instance group using the information that you specify in 309 * the request. After the group is created, instances in the group are created 310 * using the specified instance template. This operation is marked as DONE when 311 * the group is created even if the instances in the group have not yet been 312 * created. You must separately verify the status of the individual instances 313 * with the listmanagedinstances method. A managed instance group can have up to 314 * 1000 VM instances per group. Please contact Cloud Support if you need an 315 * increase in this limit. (instanceGroupManagers.insert) 316 * 317 * @param string $project Project ID for this request. 318 * @param string $zone The name of the zone where you want to create the managed 319 * instance group. 320 * @param InstanceGroupManager $postBody 321 * @param array $optParams Optional parameters. 322 * 323 * @opt_param string requestId An optional request ID to identify requests. 324 * Specify a unique request ID so that if you must retry your request, the 325 * server will know to ignore the request if it has already been completed. For 326 * example, consider a situation where you make an initial request and the 327 * request times out. If you make the request again with the same request ID, 328 * the server can check if original operation with the same request ID was 329 * received, and if so, will ignore the second request. This prevents clients 330 * from accidentally creating duplicate commitments. The request ID must be a 331 * valid UUID with the exception that zero UUID is not supported ( 332 * 00000000-0000-0000-0000-000000000000). 333 * @return Operation 334 */ 335 public function insert($project, $zone, InstanceGroupManager $postBody, $optParams = []) 336 { 337 $params = ['project' => $project, 'zone' => $zone, 'postBody' => $postBody]; 338 $params = array_merge($params, $optParams); 339 return $this->call('insert', [$params], Operation::class); 340 } 341 /** 342 * Retrieves a list of managed instance groups that are contained within the 343 * specified project and zone. (instanceGroupManagers.listInstanceGroupManagers) 344 * 345 * @param string $project Project ID for this request. 346 * @param string $zone The name of the zone where the managed instance group is 347 * located. 348 * @param array $optParams Optional parameters. 349 * 350 * @opt_param string filter A filter expression that filters resources listed in 351 * the response. The expression must specify the field name, an operator, and 352 * the value that you want to use for filtering. The value must be a string, a 353 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 354 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 355 * can exclude instances named `example-instance` by specifying `name != 356 * example-instance`. The `:` operator can be used with string fields to match 357 * substrings. For non-string fields it is equivalent to the `=` operator. The 358 * `:*` comparison can be used to test whether a key has been defined. For 359 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 360 * You can also filter nested fields. For example, you could specify 361 * `scheduling.automaticRestart = false` to include instances only if they are 362 * not scheduled for automatic restarts. You can use filtering on nested fields 363 * to filter based on resource labels. To filter on multiple expressions, 364 * provide each separate expression within parentheses. For example: ``` 365 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 366 * default, each expression is an `AND` expression. However, you can include 367 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 368 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 369 * (scheduling.automaticRestart = true) ``` 370 * @opt_param string maxResults The maximum number of results per page that 371 * should be returned. If the number of available results is larger than 372 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 373 * get the next page of results in subsequent list requests. Acceptable values 374 * are `0` to `500`, inclusive. (Default: `500`) 375 * @opt_param string orderBy Sorts list results by a certain order. By default, 376 * results are returned in alphanumerical order based on the resource name. You 377 * can also sort results in descending order based on the creation timestamp 378 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 379 * `creationTimestamp` field in reverse chronological order (newest result 380 * first). Use this to sort resources like operations so that the newest 381 * operation is returned first. Currently, only sorting by `name` or 382 * `creationTimestamp desc` is supported. 383 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 384 * the `nextPageToken` returned by a previous list request to get the next page 385 * of results. 386 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 387 * which provides partial results in case of failure. The default value is 388 * false. 389 * @return InstanceGroupManagerList 390 */ 391 public function listInstanceGroupManagers($project, $zone, $optParams = []) 392 { 393 $params = ['project' => $project, 'zone' => $zone]; 394 $params = array_merge($params, $optParams); 395 return $this->call('list', [$params], InstanceGroupManagerList::class); 396 } 397 /** 398 * Lists all errors thrown by actions on instances for a given managed instance 399 * group. The filter and orderBy query parameters are not supported. 400 * (instanceGroupManagers.listErrors) 401 * 402 * @param string $project Project ID for this request. 403 * @param string $zone The name of the zone where the managed instance group is 404 * located. It should conform to RFC1035. 405 * @param string $instanceGroupManager The name of the managed instance group. 406 * It must be a string that meets the requirements in RFC1035, or an unsigned 407 * long integer: must match regexp pattern: 408 * (?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)|1-9{0,19}. 409 * @param array $optParams Optional parameters. 410 * 411 * @opt_param string filter A filter expression that filters resources listed in 412 * the response. The expression must specify the field name, an operator, and 413 * the value that you want to use for filtering. The value must be a string, a 414 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 415 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 416 * can exclude instances named `example-instance` by specifying `name != 417 * example-instance`. The `:` operator can be used with string fields to match 418 * substrings. For non-string fields it is equivalent to the `=` operator. The 419 * `:*` comparison can be used to test whether a key has been defined. For 420 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 421 * You can also filter nested fields. For example, you could specify 422 * `scheduling.automaticRestart = false` to include instances only if they are 423 * not scheduled for automatic restarts. You can use filtering on nested fields 424 * to filter based on resource labels. To filter on multiple expressions, 425 * provide each separate expression within parentheses. For example: ``` 426 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 427 * default, each expression is an `AND` expression. However, you can include 428 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 429 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 430 * (scheduling.automaticRestart = true) ``` 431 * @opt_param string maxResults The maximum number of results per page that 432 * should be returned. If the number of available results is larger than 433 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 434 * get the next page of results in subsequent list requests. Acceptable values 435 * are `0` to `500`, inclusive. (Default: `500`) 436 * @opt_param string orderBy Sorts list results by a certain order. By default, 437 * results are returned in alphanumerical order based on the resource name. You 438 * can also sort results in descending order based on the creation timestamp 439 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 440 * `creationTimestamp` field in reverse chronological order (newest result 441 * first). Use this to sort resources like operations so that the newest 442 * operation is returned first. Currently, only sorting by `name` or 443 * `creationTimestamp desc` is supported. 444 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 445 * the `nextPageToken` returned by a previous list request to get the next page 446 * of results. 447 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 448 * which provides partial results in case of failure. The default value is 449 * false. 450 * @return InstanceGroupManagersListErrorsResponse 451 */ 452 public function listErrors($project, $zone, $instanceGroupManager, $optParams = []) 453 { 454 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager]; 455 $params = array_merge($params, $optParams); 456 return $this->call('listErrors', [$params], InstanceGroupManagersListErrorsResponse::class); 457 } 458 /** 459 * Lists all of the instances in the managed instance group. Each instance in 460 * the list has a currentAction, which indicates the action that the managed 461 * instance group is performing on the instance. For example, if the group is 462 * still creating an instance, the currentAction is CREATING. If a previous 463 * action failed, the list displays the errors for that failed action. The 464 * orderBy query parameter is not supported. 465 * (instanceGroupManagers.listManagedInstances) 466 * 467 * @param string $project Project ID for this request. 468 * @param string $zone The name of the zone where the managed instance group is 469 * located. 470 * @param string $instanceGroupManager The name of the managed instance group. 471 * @param array $optParams Optional parameters. 472 * 473 * @opt_param string filter A filter expression that filters resources listed in 474 * the response. The expression must specify the field name, an operator, and 475 * the value that you want to use for filtering. The value must be a string, a 476 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 477 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 478 * can exclude instances named `example-instance` by specifying `name != 479 * example-instance`. The `:` operator can be used with string fields to match 480 * substrings. For non-string fields it is equivalent to the `=` operator. The 481 * `:*` comparison can be used to test whether a key has been defined. For 482 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 483 * You can also filter nested fields. For example, you could specify 484 * `scheduling.automaticRestart = false` to include instances only if they are 485 * not scheduled for automatic restarts. You can use filtering on nested fields 486 * to filter based on resource labels. To filter on multiple expressions, 487 * provide each separate expression within parentheses. For example: ``` 488 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 489 * default, each expression is an `AND` expression. However, you can include 490 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 491 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 492 * (scheduling.automaticRestart = true) ``` 493 * @opt_param string maxResults The maximum number of results per page that 494 * should be returned. If the number of available results is larger than 495 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 496 * get the next page of results in subsequent list requests. Acceptable values 497 * are `0` to `500`, inclusive. (Default: `500`) 498 * @opt_param string orderBy Sorts list results by a certain order. By default, 499 * results are returned in alphanumerical order based on the resource name. You 500 * can also sort results in descending order based on the creation timestamp 501 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 502 * `creationTimestamp` field in reverse chronological order (newest result 503 * first). Use this to sort resources like operations so that the newest 504 * operation is returned first. Currently, only sorting by `name` or 505 * `creationTimestamp desc` is supported. 506 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 507 * the `nextPageToken` returned by a previous list request to get the next page 508 * of results. 509 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 510 * which provides partial results in case of failure. The default value is 511 * false. 512 * @return InstanceGroupManagersListManagedInstancesResponse 513 */ 514 public function listManagedInstances($project, $zone, $instanceGroupManager, $optParams = []) 515 { 516 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager]; 517 $params = array_merge($params, $optParams); 518 return $this->call('listManagedInstances', [$params], InstanceGroupManagersListManagedInstancesResponse::class); 519 } 520 /** 521 * Lists all of the per-instance configurations defined for the managed instance 522 * group. The orderBy query parameter is not supported. 523 * (instanceGroupManagers.listPerInstanceConfigs) 524 * 525 * @param string $project Project ID for this request. 526 * @param string $zone The name of the zone where the managed instance group is 527 * located. It should conform to RFC1035. 528 * @param string $instanceGroupManager The name of the managed instance group. 529 * It should conform to RFC1035. 530 * @param array $optParams Optional parameters. 531 * 532 * @opt_param string filter A filter expression that filters resources listed in 533 * the response. The expression must specify the field name, an operator, and 534 * the value that you want to use for filtering. The value must be a string, a 535 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 536 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 537 * can exclude instances named `example-instance` by specifying `name != 538 * example-instance`. The `:` operator can be used with string fields to match 539 * substrings. For non-string fields it is equivalent to the `=` operator. The 540 * `:*` comparison can be used to test whether a key has been defined. For 541 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 542 * You can also filter nested fields. For example, you could specify 543 * `scheduling.automaticRestart = false` to include instances only if they are 544 * not scheduled for automatic restarts. You can use filtering on nested fields 545 * to filter based on resource labels. To filter on multiple expressions, 546 * provide each separate expression within parentheses. For example: ``` 547 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 548 * default, each expression is an `AND` expression. However, you can include 549 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 550 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 551 * (scheduling.automaticRestart = true) ``` 552 * @opt_param string maxResults The maximum number of results per page that 553 * should be returned. If the number of available results is larger than 554 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 555 * get the next page of results in subsequent list requests. Acceptable values 556 * are `0` to `500`, inclusive. (Default: `500`) 557 * @opt_param string orderBy Sorts list results by a certain order. By default, 558 * results are returned in alphanumerical order based on the resource name. You 559 * can also sort results in descending order based on the creation timestamp 560 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 561 * `creationTimestamp` field in reverse chronological order (newest result 562 * first). Use this to sort resources like operations so that the newest 563 * operation is returned first. Currently, only sorting by `name` or 564 * `creationTimestamp desc` is supported. 565 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 566 * the `nextPageToken` returned by a previous list request to get the next page 567 * of results. 568 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 569 * which provides partial results in case of failure. The default value is 570 * false. 571 * @return InstanceGroupManagersListPerInstanceConfigsResp 572 */ 573 public function listPerInstanceConfigs($project, $zone, $instanceGroupManager, $optParams = []) 574 { 575 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager]; 576 $params = array_merge($params, $optParams); 577 return $this->call('listPerInstanceConfigs', [$params], InstanceGroupManagersListPerInstanceConfigsResp::class); 578 } 579 /** 580 * Updates a managed instance group using the information that you specify in 581 * the request. This operation is marked as DONE when the group is patched even 582 * if the instances in the group are still in the process of being patched. You 583 * must separately verify the status of the individual instances with the 584 * listManagedInstances method. This method supports PATCH semantics and uses 585 * the JSON merge patch format and processing rules. If you update your group to 586 * specify a new template or instance configuration, it's possible that your 587 * intended specification for each VM in the group is different from the current 588 * state of that VM. To learn how to apply an updated configuration to the VMs 589 * in a MIG, see Updating instances in a MIG. (instanceGroupManagers.patch) 590 * 591 * @param string $project Project ID for this request. 592 * @param string $zone The name of the zone where you want to create the managed 593 * instance group. 594 * @param string $instanceGroupManager The name of the instance group manager. 595 * @param InstanceGroupManager $postBody 596 * @param array $optParams Optional parameters. 597 * 598 * @opt_param string requestId An optional request ID to identify requests. 599 * Specify a unique request ID so that if you must retry your request, the 600 * server will know to ignore the request if it has already been completed. For 601 * example, consider a situation where you make an initial request and the 602 * request times out. If you make the request again with the same request ID, 603 * the server can check if original operation with the same request ID was 604 * received, and if so, will ignore the second request. This prevents clients 605 * from accidentally creating duplicate commitments. The request ID must be a 606 * valid UUID with the exception that zero UUID is not supported ( 607 * 00000000-0000-0000-0000-000000000000). 608 * @return Operation 609 */ 610 public function patch($project, $zone, $instanceGroupManager, InstanceGroupManager $postBody, $optParams = []) 611 { 612 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager, 'postBody' => $postBody]; 613 $params = array_merge($params, $optParams); 614 return $this->call('patch', [$params], Operation::class); 615 } 616 /** 617 * Inserts or patches per-instance configurations for the managed instance 618 * group. perInstanceConfig.name serves as a key used to distinguish whether to 619 * perform insert or patch. (instanceGroupManagers.patchPerInstanceConfigs) 620 * 621 * @param string $project Project ID for this request. 622 * @param string $zone The name of the zone where the managed instance group is 623 * located. It should conform to RFC1035. 624 * @param string $instanceGroupManager The name of the managed instance group. 625 * It should conform to RFC1035. 626 * @param InstanceGroupManagersPatchPerInstanceConfigsReq $postBody 627 * @param array $optParams Optional parameters. 628 * 629 * @opt_param string requestId An optional request ID to identify requests. 630 * Specify a unique request ID so that if you must retry your request, the 631 * server will know to ignore the request if it has already been completed. For 632 * example, consider a situation where you make an initial request and the 633 * request times out. If you make the request again with the same request ID, 634 * the server can check if original operation with the same request ID was 635 * received, and if so, will ignore the second request. This prevents clients 636 * from accidentally creating duplicate commitments. The request ID must be a 637 * valid UUID with the exception that zero UUID is not supported ( 638 * 00000000-0000-0000-0000-000000000000). 639 * @return Operation 640 */ 641 public function patchPerInstanceConfigs($project, $zone, $instanceGroupManager, InstanceGroupManagersPatchPerInstanceConfigsReq $postBody, $optParams = []) 642 { 643 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager, 'postBody' => $postBody]; 644 $params = array_merge($params, $optParams); 645 return $this->call('patchPerInstanceConfigs', [$params], Operation::class); 646 } 647 /** 648 * Flags the specified VM instances in the managed instance group to be 649 * immediately recreated. Each instance is recreated using the group's current 650 * configuration. This operation is marked as DONE when the flag is set even if 651 * the instances have not yet been recreated. You must separately verify the 652 * status of each instance by checking its currentAction field; for more 653 * information, see Checking the status of managed instances. If the group is 654 * part of a backend service that has enabled connection draining, it can take 655 * up to 60 seconds after the connection draining duration has elapsed before 656 * the VM instance is removed or deleted. You can specify a maximum of 1000 657 * instances with this method per request. 658 * (instanceGroupManagers.recreateInstances) 659 * 660 * @param string $project Project ID for this request. 661 * @param string $zone The name of the zone where the managed instance group is 662 * located. 663 * @param string $instanceGroupManager The name of the managed instance group. 664 * @param InstanceGroupManagersRecreateInstancesRequest $postBody 665 * @param array $optParams Optional parameters. 666 * 667 * @opt_param string requestId An optional request ID to identify requests. 668 * Specify a unique request ID so that if you must retry your request, the 669 * server will know to ignore the request if it has already been completed. For 670 * example, consider a situation where you make an initial request and the 671 * request times out. If you make the request again with the same request ID, 672 * the server can check if original operation with the same request ID was 673 * received, and if so, will ignore the second request. This prevents clients 674 * from accidentally creating duplicate commitments. The request ID must be a 675 * valid UUID with the exception that zero UUID is not supported ( 676 * 00000000-0000-0000-0000-000000000000). 677 * @return Operation 678 */ 679 public function recreateInstances($project, $zone, $instanceGroupManager, InstanceGroupManagersRecreateInstancesRequest $postBody, $optParams = []) 680 { 681 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager, 'postBody' => $postBody]; 682 $params = array_merge($params, $optParams); 683 return $this->call('recreateInstances', [$params], Operation::class); 684 } 685 /** 686 * Resizes the managed instance group. If you increase the size, the group 687 * creates new instances using the current instance template. If you decrease 688 * the size, the group deletes instances. The resize operation is marked DONE 689 * when the resize actions are scheduled even if the group has not yet added or 690 * deleted any instances. You must separately verify the status of the creating 691 * or deleting actions with the listmanagedinstances method. When resizing down, 692 * the instance group arbitrarily chooses the order in which VMs are deleted. 693 * The group takes into account some VM attributes when making the selection 694 * including: + The status of the VM instance. + The health of the VM instance. 695 * + The instance template version the VM is based on. + For regional managed 696 * instance groups, the location of the VM instance. This list is subject to 697 * change. If the group is part of a backend service that has enabled connection 698 * draining, it can take up to 60 seconds after the connection draining duration 699 * has elapsed before the VM instance is removed or deleted. 700 * (instanceGroupManagers.resize) 701 * 702 * @param string $project Project ID for this request. 703 * @param string $zone The name of the zone where the managed instance group is 704 * located. 705 * @param string $instanceGroupManager The name of the managed instance group. 706 * @param int $size The number of running instances that the managed instance 707 * group should maintain at any given time. The group automatically adds or 708 * removes instances to maintain the number of instances specified by this 709 * parameter. 710 * @param array $optParams Optional parameters. 711 * 712 * @opt_param string requestId An optional request ID to identify requests. 713 * Specify a unique request ID so that if you must retry your request, the 714 * server will know to ignore the request if it has already been completed. For 715 * example, consider a situation where you make an initial request and the 716 * request times out. If you make the request again with the same request ID, 717 * the server can check if original operation with the same request ID was 718 * received, and if so, will ignore the second request. This prevents clients 719 * from accidentally creating duplicate commitments. The request ID must be a 720 * valid UUID with the exception that zero UUID is not supported ( 721 * 00000000-0000-0000-0000-000000000000). 722 * @return Operation 723 */ 724 public function resize($project, $zone, $instanceGroupManager, $size, $optParams = []) 725 { 726 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager, 'size' => $size]; 727 $params = array_merge($params, $optParams); 728 return $this->call('resize', [$params], Operation::class); 729 } 730 /** 731 * Specifies the instance template to use when creating new instances in this 732 * group. The templates for existing instances in the group do not change unless 733 * you run recreateInstances, run applyUpdatesToInstances, or set the group's 734 * updatePolicy.type to PROACTIVE. (instanceGroupManagers.setInstanceTemplate) 735 * 736 * @param string $project Project ID for this request. 737 * @param string $zone The name of the zone where the managed instance group is 738 * located. 739 * @param string $instanceGroupManager The name of the managed instance group. 740 * @param InstanceGroupManagersSetInstanceTemplateRequest $postBody 741 * @param array $optParams Optional parameters. 742 * 743 * @opt_param string requestId An optional request ID to identify requests. 744 * Specify a unique request ID so that if you must retry your request, the 745 * server will know to ignore the request if it has already been completed. For 746 * example, consider a situation where you make an initial request and the 747 * request times out. If you make the request again with the same request ID, 748 * the server can check if original operation with the same request ID was 749 * received, and if so, will ignore the second request. This prevents clients 750 * from accidentally creating duplicate commitments. The request ID must be a 751 * valid UUID with the exception that zero UUID is not supported ( 752 * 00000000-0000-0000-0000-000000000000). 753 * @return Operation 754 */ 755 public function setInstanceTemplate($project, $zone, $instanceGroupManager, InstanceGroupManagersSetInstanceTemplateRequest $postBody, $optParams = []) 756 { 757 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager, 'postBody' => $postBody]; 758 $params = array_merge($params, $optParams); 759 return $this->call('setInstanceTemplate', [$params], Operation::class); 760 } 761 /** 762 * Modifies the target pools to which all instances in this managed instance 763 * group are assigned. The target pools automatically apply to all of the 764 * instances in the managed instance group. This operation is marked DONE when 765 * you make the request even if the instances have not yet been added to their 766 * target pools. The change might take some time to apply to all of the 767 * instances in the group depending on the size of the group. 768 * (instanceGroupManagers.setTargetPools) 769 * 770 * @param string $project Project ID for this request. 771 * @param string $zone The name of the zone where the managed instance group is 772 * located. 773 * @param string $instanceGroupManager The name of the managed instance group. 774 * @param InstanceGroupManagersSetTargetPoolsRequest $postBody 775 * @param array $optParams Optional parameters. 776 * 777 * @opt_param string requestId An optional request ID to identify requests. 778 * Specify a unique request ID so that if you must retry your request, the 779 * server will know to ignore the request if it has already been completed. For 780 * example, consider a situation where you make an initial request and the 781 * request times out. If you make the request again with the same request ID, 782 * the server can check if original operation with the same request ID was 783 * received, and if so, will ignore the second request. This prevents clients 784 * from accidentally creating duplicate commitments. The request ID must be a 785 * valid UUID with the exception that zero UUID is not supported ( 786 * 00000000-0000-0000-0000-000000000000). 787 * @return Operation 788 */ 789 public function setTargetPools($project, $zone, $instanceGroupManager, InstanceGroupManagersSetTargetPoolsRequest $postBody, $optParams = []) 790 { 791 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager, 'postBody' => $postBody]; 792 $params = array_merge($params, $optParams); 793 return $this->call('setTargetPools', [$params], Operation::class); 794 } 795 /** 796 * Inserts or updates per-instance configurations for the managed instance 797 * group. perInstanceConfig.name serves as a key used to distinguish whether to 798 * perform insert or patch. (instanceGroupManagers.updatePerInstanceConfigs) 799 * 800 * @param string $project Project ID for this request. 801 * @param string $zone The name of the zone where the managed instance group is 802 * located. It should conform to RFC1035. 803 * @param string $instanceGroupManager The name of the managed instance group. 804 * It should conform to RFC1035. 805 * @param InstanceGroupManagersUpdatePerInstanceConfigsReq $postBody 806 * @param array $optParams Optional parameters. 807 * 808 * @opt_param string requestId An optional request ID to identify requests. 809 * Specify a unique request ID so that if you must retry your request, the 810 * server will know to ignore the request if it has already been completed. For 811 * example, consider a situation where you make an initial request and the 812 * request times out. If you make the request again with the same request ID, 813 * the server can check if original operation with the same request ID was 814 * received, and if so, will ignore the second request. This prevents clients 815 * from accidentally creating duplicate commitments. The request ID must be a 816 * valid UUID with the exception that zero UUID is not supported ( 817 * 00000000-0000-0000-0000-000000000000). 818 * @return Operation 819 */ 820 public function updatePerInstanceConfigs($project, $zone, $instanceGroupManager, InstanceGroupManagersUpdatePerInstanceConfigsReq $postBody, $optParams = []) 821 { 822 $params = ['project' => $project, 'zone' => $zone, 'instanceGroupManager' => $instanceGroupManager, 'postBody' => $postBody]; 823 $params = array_merge($params, $optParams); 824 return $this->call('updatePerInstanceConfigs', [$params], Operation::class); 825 } 826} 827 828// Adding a class alias for backwards compatibility with the previous class name. 829class_alias(InstanceGroupManagers::class, 'Google_Service_Compute_Resource_InstanceGroupManagers'); 830