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\AccessConfig;
21use Google\Service\Compute\AttachedDisk;
22use Google\Service\Compute\BulkInsertInstanceResource;
23use Google\Service\Compute\DisplayDevice;
24use Google\Service\Compute\GuestAttributes;
25use Google\Service\Compute\Instance;
26use Google\Service\Compute\InstanceAggregatedList;
27use Google\Service\Compute\InstanceList;
28use Google\Service\Compute\InstanceListReferrers;
29use Google\Service\Compute\InstancesAddResourcePoliciesRequest;
30use Google\Service\Compute\InstancesGetEffectiveFirewallsResponse;
31use Google\Service\Compute\InstancesRemoveResourcePoliciesRequest;
32use Google\Service\Compute\InstancesSetLabelsRequest;
33use Google\Service\Compute\InstancesSetMachineResourcesRequest;
34use Google\Service\Compute\InstancesSetMachineTypeRequest;
35use Google\Service\Compute\InstancesSetMinCpuPlatformRequest;
36use Google\Service\Compute\InstancesSetServiceAccountRequest;
37use Google\Service\Compute\InstancesStartWithEncryptionKeyRequest;
38use Google\Service\Compute\Metadata;
39use Google\Service\Compute\NetworkInterface;
40use Google\Service\Compute\Operation;
41use Google\Service\Compute\Policy;
42use Google\Service\Compute\Scheduling;
43use Google\Service\Compute\Screenshot;
44use Google\Service\Compute\SerialPortOutput;
45use Google\Service\Compute\ShieldedInstanceConfig;
46use Google\Service\Compute\ShieldedInstanceIdentity;
47use Google\Service\Compute\ShieldedInstanceIntegrityPolicy;
48use Google\Service\Compute\Tags;
49use Google\Service\Compute\TestPermissionsRequest;
50use Google\Service\Compute\TestPermissionsResponse;
51use Google\Service\Compute\ZoneSetPolicyRequest;
52
53/**
54 * The "instances" collection of methods.
55 * Typical usage is:
56 *  <code>
57 *   $computeService = new Google\Service\Compute(...);
58 *   $instances = $computeService->instances;
59 *  </code>
60 */
61class Instances extends \Google\Service\Resource
62{
63  /**
64   * Adds an access config to an instance's network interface.
65   * (instances.addAccessConfig)
66   *
67   * @param string $project Project ID for this request.
68   * @param string $zone The name of the zone for this request.
69   * @param string $instance The instance name for this request.
70   * @param string $networkInterface The name of the network interface to add to
71   * this instance.
72   * @param AccessConfig $postBody
73   * @param array $optParams Optional parameters.
74   *
75   * @opt_param string requestId An optional request ID to identify requests.
76   * Specify a unique request ID so that if you must retry your request, the
77   * server will know to ignore the request if it has already been completed. For
78   * example, consider a situation where you make an initial request and the
79   * request times out. If you make the request again with the same request ID,
80   * the server can check if original operation with the same request ID was
81   * received, and if so, will ignore the second request. This prevents clients
82   * from accidentally creating duplicate commitments. The request ID must be a
83   * valid UUID with the exception that zero UUID is not supported (
84   * 00000000-0000-0000-0000-000000000000).
85   * @return Operation
86   */
87  public function addAccessConfig($project, $zone, $instance, $networkInterface, AccessConfig $postBody, $optParams = [])
88  {
89    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'networkInterface' => $networkInterface, 'postBody' => $postBody];
90    $params = array_merge($params, $optParams);
91    return $this->call('addAccessConfig', [$params], Operation::class);
92  }
93  /**
94   * Adds existing resource policies to an instance. You can only add one policy
95   * right now which will be applied to this instance for scheduling live
96   * migrations. (instances.addResourcePolicies)
97   *
98   * @param string $project Project ID for this request.
99   * @param string $zone The name of the zone for this request.
100   * @param string $instance The instance name for this request.
101   * @param InstancesAddResourcePoliciesRequest $postBody
102   * @param array $optParams Optional parameters.
103   *
104   * @opt_param string requestId An optional request ID to identify requests.
105   * Specify a unique request ID so that if you must retry your request, the
106   * server will know to ignore the request if it has already been completed. For
107   * example, consider a situation where you make an initial request and the
108   * request times out. If you make the request again with the same request ID,
109   * the server can check if original operation with the same request ID was
110   * received, and if so, will ignore the second request. This prevents clients
111   * from accidentally creating duplicate commitments. The request ID must be a
112   * valid UUID with the exception that zero UUID is not supported (
113   * 00000000-0000-0000-0000-000000000000).
114   * @return Operation
115   */
116  public function addResourcePolicies($project, $zone, $instance, InstancesAddResourcePoliciesRequest $postBody, $optParams = [])
117  {
118    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
119    $params = array_merge($params, $optParams);
120    return $this->call('addResourcePolicies', [$params], Operation::class);
121  }
122  /**
123   * Retrieves an aggregated list of all of the instances in your project across
124   * all regions and zones. The performance of this method degrades when a filter
125   * is specified on a project that has a very large number of instances.
126   * (instances.aggregatedList)
127   *
128   * @param string $project Project ID for this request.
129   * @param array $optParams Optional parameters.
130   *
131   * @opt_param string filter A filter expression that filters resources listed in
132   * the response. The expression must specify the field name, an operator, and
133   * the value that you want to use for filtering. The value must be a string, a
134   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
135   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
136   * can exclude instances named `example-instance` by specifying `name !=
137   * example-instance`. The `:` operator can be used with string fields to match
138   * substrings. For non-string fields it is equivalent to the `=` operator. The
139   * `:*` comparison can be used to test whether a key has been defined. For
140   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
141   * You can also filter nested fields. For example, you could specify
142   * `scheduling.automaticRestart = false` to include instances only if they are
143   * not scheduled for automatic restarts. You can use filtering on nested fields
144   * to filter based on resource labels. To filter on multiple expressions,
145   * provide each separate expression within parentheses. For example: ```
146   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
147   * default, each expression is an `AND` expression. However, you can include
148   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
149   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
150   * (scheduling.automaticRestart = true) ```
151   * @opt_param bool includeAllScopes Indicates whether every visible scope for
152   * each scope type (zone, region, global) should be included in the response.
153   * For new resource types added after this field, the flag has no effect as new
154   * resource types will always include every visible scope for each scope type in
155   * response. For resource types which predate this field, if this flag is
156   * omitted or false, only scopes of the scope types where the resource type is
157   * expected to be found will be included.
158   * @opt_param string maxResults The maximum number of results per page that
159   * should be returned. If the number of available results is larger than
160   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
161   * get the next page of results in subsequent list requests. Acceptable values
162   * are `0` to `500`, inclusive. (Default: `500`)
163   * @opt_param string orderBy Sorts list results by a certain order. By default,
164   * results are returned in alphanumerical order based on the resource name. You
165   * can also sort results in descending order based on the creation timestamp
166   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
167   * `creationTimestamp` field in reverse chronological order (newest result
168   * first). Use this to sort resources like operations so that the newest
169   * operation is returned first. Currently, only sorting by `name` or
170   * `creationTimestamp desc` is supported.
171   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
172   * the `nextPageToken` returned by a previous list request to get the next page
173   * of results.
174   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
175   * which provides partial results in case of failure. The default value is
176   * false.
177   * @return InstanceAggregatedList
178   */
179  public function aggregatedList($project, $optParams = [])
180  {
181    $params = ['project' => $project];
182    $params = array_merge($params, $optParams);
183    return $this->call('aggregatedList', [$params], InstanceAggregatedList::class);
184  }
185  /**
186   * Attaches an existing Disk resource to an instance. You must first create the
187   * disk before you can attach it. It is not possible to create and attach a disk
188   * at the same time. For more information, read Adding a persistent disk to your
189   * instance. (instances.attachDisk)
190   *
191   * @param string $project Project ID for this request.
192   * @param string $zone The name of the zone for this request.
193   * @param string $instance The instance name for this request.
194   * @param AttachedDisk $postBody
195   * @param array $optParams Optional parameters.
196   *
197   * @opt_param bool forceAttach Whether to force attach the regional disk even if
198   * it's currently attached to another instance. If you try to force attach a
199   * zonal disk to an instance, you will receive an error.
200   * @opt_param string requestId An optional request ID to identify requests.
201   * Specify a unique request ID so that if you must retry your request, the
202   * server will know to ignore the request if it has already been completed. For
203   * example, consider a situation where you make an initial request and the
204   * request times out. If you make the request again with the same request ID,
205   * the server can check if original operation with the same request ID was
206   * received, and if so, will ignore the second request. This prevents clients
207   * from accidentally creating duplicate commitments. The request ID must be a
208   * valid UUID with the exception that zero UUID is not supported (
209   * 00000000-0000-0000-0000-000000000000).
210   * @return Operation
211   */
212  public function attachDisk($project, $zone, $instance, AttachedDisk $postBody, $optParams = [])
213  {
214    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
215    $params = array_merge($params, $optParams);
216    return $this->call('attachDisk', [$params], Operation::class);
217  }
218  /**
219   * Creates multiple instances. Count specifies the number of instances to
220   * create. (instances.bulkInsert)
221   *
222   * @param string $project Project ID for this request.
223   * @param string $zone The name of the zone for this request.
224   * @param BulkInsertInstanceResource $postBody
225   * @param array $optParams Optional parameters.
226   *
227   * @opt_param string requestId An optional request ID to identify requests.
228   * Specify a unique request ID so that if you must retry your request, the
229   * server will know to ignore the request if it has already been completed. For
230   * example, consider a situation where you make an initial request and the
231   * request times out. If you make the request again with the same request ID,
232   * the server can check if original operation with the same request ID was
233   * received, and if so, will ignore the second request. This prevents clients
234   * from accidentally creating duplicate commitments. The request ID must be a
235   * valid UUID with the exception that zero UUID is not supported (
236   * 00000000-0000-0000-0000-000000000000).
237   * @return Operation
238   */
239  public function bulkInsert($project, $zone, BulkInsertInstanceResource $postBody, $optParams = [])
240  {
241    $params = ['project' => $project, 'zone' => $zone, 'postBody' => $postBody];
242    $params = array_merge($params, $optParams);
243    return $this->call('bulkInsert', [$params], Operation::class);
244  }
245  /**
246   * Deletes the specified Instance resource. For more information, see Deleting
247   * an instance. (instances.delete)
248   *
249   * @param string $project Project ID for this request.
250   * @param string $zone The name of the zone for this request.
251   * @param string $instance Name of the instance resource to delete.
252   * @param array $optParams Optional parameters.
253   *
254   * @opt_param string requestId An optional request ID to identify requests.
255   * Specify a unique request ID so that if you must retry your request, the
256   * server will know to ignore the request if it has already been completed. For
257   * example, consider a situation where you make an initial request and the
258   * request times out. If you make the request again with the same request ID,
259   * the server can check if original operation with the same request ID was
260   * received, and if so, will ignore the second request. This prevents clients
261   * from accidentally creating duplicate commitments. The request ID must be a
262   * valid UUID with the exception that zero UUID is not supported (
263   * 00000000-0000-0000-0000-000000000000).
264   * @return Operation
265   */
266  public function delete($project, $zone, $instance, $optParams = [])
267  {
268    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
269    $params = array_merge($params, $optParams);
270    return $this->call('delete', [$params], Operation::class);
271  }
272  /**
273   * Deletes an access config from an instance's network interface.
274   * (instances.deleteAccessConfig)
275   *
276   * @param string $project Project ID for this request.
277   * @param string $zone The name of the zone for this request.
278   * @param string $instance The instance name for this request.
279   * @param string $accessConfig The name of the access config to delete.
280   * @param string $networkInterface The name of the network interface.
281   * @param array $optParams Optional parameters.
282   *
283   * @opt_param string requestId An optional request ID to identify requests.
284   * Specify a unique request ID so that if you must retry your request, the
285   * server will know to ignore the request if it has already been completed. For
286   * example, consider a situation where you make an initial request and the
287   * request times out. If you make the request again with the same request ID,
288   * the server can check if original operation with the same request ID was
289   * received, and if so, will ignore the second request. This prevents clients
290   * from accidentally creating duplicate commitments. The request ID must be a
291   * valid UUID with the exception that zero UUID is not supported (
292   * 00000000-0000-0000-0000-000000000000).
293   * @return Operation
294   */
295  public function deleteAccessConfig($project, $zone, $instance, $accessConfig, $networkInterface, $optParams = [])
296  {
297    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'accessConfig' => $accessConfig, 'networkInterface' => $networkInterface];
298    $params = array_merge($params, $optParams);
299    return $this->call('deleteAccessConfig', [$params], Operation::class);
300  }
301  /**
302   * Detaches a disk from an instance. (instances.detachDisk)
303   *
304   * @param string $project Project ID for this request.
305   * @param string $zone The name of the zone for this request.
306   * @param string $instance Instance name for this request.
307   * @param string $deviceName The device name of the disk to detach. Make a get()
308   * request on the instance to view currently attached disks and device names.
309   * @param array $optParams Optional parameters.
310   *
311   * @opt_param string requestId An optional request ID to identify requests.
312   * Specify a unique request ID so that if you must retry your request, the
313   * server will know to ignore the request if it has already been completed. For
314   * example, consider a situation where you make an initial request and the
315   * request times out. If you make the request again with the same request ID,
316   * the server can check if original operation with the same request ID was
317   * received, and if so, will ignore the second request. This prevents clients
318   * from accidentally creating duplicate commitments. The request ID must be a
319   * valid UUID with the exception that zero UUID is not supported (
320   * 00000000-0000-0000-0000-000000000000).
321   * @return Operation
322   */
323  public function detachDisk($project, $zone, $instance, $deviceName, $optParams = [])
324  {
325    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'deviceName' => $deviceName];
326    $params = array_merge($params, $optParams);
327    return $this->call('detachDisk', [$params], Operation::class);
328  }
329  /**
330   * Returns the specified Instance resource. Gets a list of available instances
331   * by making a list() request. (instances.get)
332   *
333   * @param string $project Project ID for this request.
334   * @param string $zone The name of the zone for this request.
335   * @param string $instance Name of the instance resource to return.
336   * @param array $optParams Optional parameters.
337   * @return Instance
338   */
339  public function get($project, $zone, $instance, $optParams = [])
340  {
341    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
342    $params = array_merge($params, $optParams);
343    return $this->call('get', [$params], Instance::class);
344  }
345  /**
346   * Returns effective firewalls applied to an interface of the instance.
347   * (instances.getEffectiveFirewalls)
348   *
349   * @param string $project Project ID for this request.
350   * @param string $zone The name of the zone for this request.
351   * @param string $instance Name of the instance scoping this request.
352   * @param string $networkInterface The name of the network interface to get the
353   * effective firewalls.
354   * @param array $optParams Optional parameters.
355   * @return InstancesGetEffectiveFirewallsResponse
356   */
357  public function getEffectiveFirewalls($project, $zone, $instance, $networkInterface, $optParams = [])
358  {
359    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'networkInterface' => $networkInterface];
360    $params = array_merge($params, $optParams);
361    return $this->call('getEffectiveFirewalls', [$params], InstancesGetEffectiveFirewallsResponse::class);
362  }
363  /**
364   * Returns the specified guest attributes entry. (instances.getGuestAttributes)
365   *
366   * @param string $project Project ID for this request.
367   * @param string $zone The name of the zone for this request.
368   * @param string $instance Name of the instance scoping this request.
369   * @param array $optParams Optional parameters.
370   *
371   * @opt_param string queryPath Specifies the guest attributes path to be
372   * queried.
373   * @opt_param string variableKey Specifies the key for the guest attributes
374   * entry.
375   * @return GuestAttributes
376   */
377  public function getGuestAttributes($project, $zone, $instance, $optParams = [])
378  {
379    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
380    $params = array_merge($params, $optParams);
381    return $this->call('getGuestAttributes', [$params], GuestAttributes::class);
382  }
383  /**
384   * Gets the access control policy for a resource. May be empty if no such policy
385   * or resource exists. (instances.getIamPolicy)
386   *
387   * @param string $project Project ID for this request.
388   * @param string $zone The name of the zone for this request.
389   * @param string $resource Name or id of the resource for this request.
390   * @param array $optParams Optional parameters.
391   *
392   * @opt_param int optionsRequestedPolicyVersion Requested IAM Policy version.
393   * @return Policy
394   */
395  public function getIamPolicy($project, $zone, $resource, $optParams = [])
396  {
397    $params = ['project' => $project, 'zone' => $zone, 'resource' => $resource];
398    $params = array_merge($params, $optParams);
399    return $this->call('getIamPolicy', [$params], Policy::class);
400  }
401  /**
402   * Returns the screenshot from the specified instance. (instances.getScreenshot)
403   *
404   * @param string $project Project ID for this request.
405   * @param string $zone The name of the zone for this request.
406   * @param string $instance Name of the instance scoping this request.
407   * @param array $optParams Optional parameters.
408   * @return Screenshot
409   */
410  public function getScreenshot($project, $zone, $instance, $optParams = [])
411  {
412    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
413    $params = array_merge($params, $optParams);
414    return $this->call('getScreenshot', [$params], Screenshot::class);
415  }
416  /**
417   * Returns the last 1 MB of serial port output from the specified instance.
418   * (instances.getSerialPortOutput)
419   *
420   * @param string $project Project ID for this request.
421   * @param string $zone The name of the zone for this request.
422   * @param string $instance Name of the instance for this request.
423   * @param array $optParams Optional parameters.
424   *
425   * @opt_param int port Specifies which COM or serial port to retrieve data from.
426   * @opt_param string start Specifies the starting byte position of the output to
427   * return. To start with the first byte of output to the specified port, omit
428   * this field or set it to `0`. If the output for that byte position is
429   * available, this field matches the `start` parameter sent with the request. If
430   * the amount of serial console output exceeds the size of the buffer (1 MB),
431   * the oldest output is discarded and is no longer available. If the requested
432   * start position refers to discarded output, the start position is adjusted to
433   * the oldest output still available, and the adjusted start position is
434   * returned as the `start` property value. You can also provide a negative start
435   * position, which translates to the most recent number of bytes written to the
436   * serial port. For example, -3 is interpreted as the most recent 3 bytes
437   * written to the serial console.
438   * @return SerialPortOutput
439   */
440  public function getSerialPortOutput($project, $zone, $instance, $optParams = [])
441  {
442    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
443    $params = array_merge($params, $optParams);
444    return $this->call('getSerialPortOutput', [$params], SerialPortOutput::class);
445  }
446  /**
447   * Returns the Shielded Instance Identity of an instance
448   * (instances.getShieldedInstanceIdentity)
449   *
450   * @param string $project Project ID for this request.
451   * @param string $zone The name of the zone for this request.
452   * @param string $instance Name or id of the instance scoping this request.
453   * @param array $optParams Optional parameters.
454   * @return ShieldedInstanceIdentity
455   */
456  public function getShieldedInstanceIdentity($project, $zone, $instance, $optParams = [])
457  {
458    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
459    $params = array_merge($params, $optParams);
460    return $this->call('getShieldedInstanceIdentity', [$params], ShieldedInstanceIdentity::class);
461  }
462  /**
463   * Creates an instance resource in the specified project using the data included
464   * in the request. (instances.insert)
465   *
466   * @param string $project Project ID for this request.
467   * @param string $zone The name of the zone for this request.
468   * @param Instance $postBody
469   * @param array $optParams Optional parameters.
470   *
471   * @opt_param string requestId An optional request ID to identify requests.
472   * Specify a unique request ID so that if you must retry your request, the
473   * server will know to ignore the request if it has already been completed. For
474   * example, consider a situation where you make an initial request and the
475   * request times out. If you make the request again with the same request ID,
476   * the server can check if original operation with the same request ID was
477   * received, and if so, will ignore the second request. This prevents clients
478   * from accidentally creating duplicate commitments. The request ID must be a
479   * valid UUID with the exception that zero UUID is not supported (
480   * 00000000-0000-0000-0000-000000000000).
481   * @opt_param string sourceInstanceTemplate Specifies instance template to
482   * create the instance. This field is optional. It can be a full or partial URL.
483   * For example, the following are all valid URLs to an instance template: -
484   * https://www.googleapis.com/compute/v1/projects/project
485   * /global/instanceTemplates/instanceTemplate -
486   * projects/project/global/instanceTemplates/instanceTemplate -
487   * global/instanceTemplates/instanceTemplate
488   * @opt_param string sourceMachineImage Specifies the machine image to use to
489   * create the instance. This field is optional. It can be a full or partial URL.
490   * For example, the following are all valid URLs to a machine image: -
491   * https://www.googleapis.com/compute/v1/projects/project/global/global
492   * /machineImages/machineImage -
493   * projects/project/global/global/machineImages/machineImage -
494   * global/machineImages/machineImage
495   * @return Operation
496   */
497  public function insert($project, $zone, Instance $postBody, $optParams = [])
498  {
499    $params = ['project' => $project, 'zone' => $zone, 'postBody' => $postBody];
500    $params = array_merge($params, $optParams);
501    return $this->call('insert', [$params], Operation::class);
502  }
503  /**
504   * Retrieves the list of instances contained within the specified zone.
505   * (instances.listInstances)
506   *
507   * @param string $project Project ID for this request.
508   * @param string $zone The name of the zone for this request.
509   * @param array $optParams Optional parameters.
510   *
511   * @opt_param string filter A filter expression that filters resources listed in
512   * the response. The expression must specify the field name, an operator, and
513   * the value that you want to use for filtering. The value must be a string, a
514   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
515   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
516   * can exclude instances named `example-instance` by specifying `name !=
517   * example-instance`. The `:` operator can be used with string fields to match
518   * substrings. For non-string fields it is equivalent to the `=` operator. The
519   * `:*` comparison can be used to test whether a key has been defined. For
520   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
521   * You can also filter nested fields. For example, you could specify
522   * `scheduling.automaticRestart = false` to include instances only if they are
523   * not scheduled for automatic restarts. You can use filtering on nested fields
524   * to filter based on resource labels. To filter on multiple expressions,
525   * provide each separate expression within parentheses. For example: ```
526   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
527   * default, each expression is an `AND` expression. However, you can include
528   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
529   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
530   * (scheduling.automaticRestart = true) ```
531   * @opt_param string maxResults The maximum number of results per page that
532   * should be returned. If the number of available results is larger than
533   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
534   * get the next page of results in subsequent list requests. Acceptable values
535   * are `0` to `500`, inclusive. (Default: `500`)
536   * @opt_param string orderBy Sorts list results by a certain order. By default,
537   * results are returned in alphanumerical order based on the resource name. You
538   * can also sort results in descending order based on the creation timestamp
539   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
540   * `creationTimestamp` field in reverse chronological order (newest result
541   * first). Use this to sort resources like operations so that the newest
542   * operation is returned first. Currently, only sorting by `name` or
543   * `creationTimestamp desc` is supported.
544   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
545   * the `nextPageToken` returned by a previous list request to get the next page
546   * of results.
547   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
548   * which provides partial results in case of failure. The default value is
549   * false.
550   * @return InstanceList
551   */
552  public function listInstances($project, $zone, $optParams = [])
553  {
554    $params = ['project' => $project, 'zone' => $zone];
555    $params = array_merge($params, $optParams);
556    return $this->call('list', [$params], InstanceList::class);
557  }
558  /**
559   * Retrieves a list of resources that refer to the VM instance specified in the
560   * request. For example, if the VM instance is part of a managed or unmanaged
561   * instance group, the referrers list includes the instance group. For more
562   * information, read Viewing referrers to VM instances.
563   * (instances.listReferrers)
564   *
565   * @param string $project Project ID for this request.
566   * @param string $zone The name of the zone for this request.
567   * @param string $instance Name of the target instance scoping this request, or
568   * '-' if the request should span over all instances in the container.
569   * @param array $optParams Optional parameters.
570   *
571   * @opt_param string filter A filter expression that filters resources listed in
572   * the response. The expression must specify the field name, an operator, and
573   * the value that you want to use for filtering. The value must be a string, a
574   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
575   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
576   * can exclude instances named `example-instance` by specifying `name !=
577   * example-instance`. The `:` operator can be used with string fields to match
578   * substrings. For non-string fields it is equivalent to the `=` operator. The
579   * `:*` comparison can be used to test whether a key has been defined. For
580   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
581   * You can also filter nested fields. For example, you could specify
582   * `scheduling.automaticRestart = false` to include instances only if they are
583   * not scheduled for automatic restarts. You can use filtering on nested fields
584   * to filter based on resource labels. To filter on multiple expressions,
585   * provide each separate expression within parentheses. For example: ```
586   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
587   * default, each expression is an `AND` expression. However, you can include
588   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
589   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
590   * (scheduling.automaticRestart = true) ```
591   * @opt_param string maxResults The maximum number of results per page that
592   * should be returned. If the number of available results is larger than
593   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
594   * get the next page of results in subsequent list requests. Acceptable values
595   * are `0` to `500`, inclusive. (Default: `500`)
596   * @opt_param string orderBy Sorts list results by a certain order. By default,
597   * results are returned in alphanumerical order based on the resource name. You
598   * can also sort results in descending order based on the creation timestamp
599   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
600   * `creationTimestamp` field in reverse chronological order (newest result
601   * first). Use this to sort resources like operations so that the newest
602   * operation is returned first. Currently, only sorting by `name` or
603   * `creationTimestamp desc` is supported.
604   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
605   * the `nextPageToken` returned by a previous list request to get the next page
606   * of results.
607   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
608   * which provides partial results in case of failure. The default value is
609   * false.
610   * @return InstanceListReferrers
611   */
612  public function listReferrers($project, $zone, $instance, $optParams = [])
613  {
614    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
615    $params = array_merge($params, $optParams);
616    return $this->call('listReferrers', [$params], InstanceListReferrers::class);
617  }
618  /**
619   * Removes resource policies from an instance.
620   * (instances.removeResourcePolicies)
621   *
622   * @param string $project Project ID for this request.
623   * @param string $zone The name of the zone for this request.
624   * @param string $instance The instance name for this request.
625   * @param InstancesRemoveResourcePoliciesRequest $postBody
626   * @param array $optParams Optional parameters.
627   *
628   * @opt_param string requestId An optional request ID to identify requests.
629   * Specify a unique request ID so that if you must retry your request, the
630   * server will know to ignore the request if it has already been completed. For
631   * example, consider a situation where you make an initial request and the
632   * request times out. If you make the request again with the same request ID,
633   * the server can check if original operation with the same request ID was
634   * received, and if so, will ignore the second request. This prevents clients
635   * from accidentally creating duplicate commitments. The request ID must be a
636   * valid UUID with the exception that zero UUID is not supported (
637   * 00000000-0000-0000-0000-000000000000).
638   * @return Operation
639   */
640  public function removeResourcePolicies($project, $zone, $instance, InstancesRemoveResourcePoliciesRequest $postBody, $optParams = [])
641  {
642    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
643    $params = array_merge($params, $optParams);
644    return $this->call('removeResourcePolicies', [$params], Operation::class);
645  }
646  /**
647   * Performs a reset on the instance. This is a hard reset. The VM does not do a
648   * graceful shutdown. For more information, see Resetting an instance.
649   * (instances.reset)
650   *
651   * @param string $project Project ID for this request.
652   * @param string $zone The name of the zone for this request.
653   * @param string $instance Name of the instance scoping this request.
654   * @param array $optParams Optional parameters.
655   *
656   * @opt_param string requestId An optional request ID to identify requests.
657   * Specify a unique request ID so that if you must retry your request, the
658   * server will know to ignore the request if it has already been completed. For
659   * example, consider a situation where you make an initial request and the
660   * request times out. If you make the request again with the same request ID,
661   * the server can check if original operation with the same request ID was
662   * received, and if so, will ignore the second request. This prevents clients
663   * from accidentally creating duplicate commitments. The request ID must be a
664   * valid UUID with the exception that zero UUID is not supported (
665   * 00000000-0000-0000-0000-000000000000).
666   * @return Operation
667   */
668  public function reset($project, $zone, $instance, $optParams = [])
669  {
670    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
671    $params = array_merge($params, $optParams);
672    return $this->call('reset', [$params], Operation::class);
673  }
674  /**
675   * Resumes an instance that was suspended using the instances().suspend method.
676   * (instances.resume)
677   *
678   * @param string $project Project ID for this request.
679   * @param string $zone The name of the zone for this request.
680   * @param string $instance Name of the instance resource to resume.
681   * @param array $optParams Optional parameters.
682   *
683   * @opt_param string requestId An optional request ID to identify requests.
684   * Specify a unique request ID so that if you must retry your request, the
685   * server will know to ignore the request if it has already been completed. For
686   * example, consider a situation where you make an initial request and the
687   * request times out. If you make the request again with the same request ID,
688   * the server can check if original operation with the same request ID was
689   * received, and if so, will ignore the second request. This prevents clients
690   * from accidentally creating duplicate commitments. The request ID must be a
691   * valid UUID with the exception that zero UUID is not supported (
692   * 00000000-0000-0000-0000-000000000000).
693   * @return Operation
694   */
695  public function resume($project, $zone, $instance, $optParams = [])
696  {
697    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
698    $params = array_merge($params, $optParams);
699    return $this->call('resume', [$params], Operation::class);
700  }
701  /**
702   * Sends diagnostic interrupt to the instance.
703   * (instances.sendDiagnosticInterrupt)
704   *
705   * @param string $project Project ID for this request.
706   * @param string $zone The name of the zone for this request.
707   * @param string $instance Name of the instance scoping this request.
708   * @param array $optParams Optional parameters.
709   */
710  public function sendDiagnosticInterrupt($project, $zone, $instance, $optParams = [])
711  {
712    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
713    $params = array_merge($params, $optParams);
714    return $this->call('sendDiagnosticInterrupt', [$params]);
715  }
716  /**
717   * Sets deletion protection on the instance. (instances.setDeletionProtection)
718   *
719   * @param string $project Project ID for this request.
720   * @param string $zone The name of the zone for this request.
721   * @param string $resource Name or id of the resource for this request.
722   * @param array $optParams Optional parameters.
723   *
724   * @opt_param bool deletionProtection Whether the resource should be protected
725   * against deletion.
726   * @opt_param string requestId An optional request ID to identify requests.
727   * Specify a unique request ID so that if you must retry your request, the
728   * server will know to ignore the request if it has already been completed. For
729   * example, consider a situation where you make an initial request and the
730   * request times out. If you make the request again with the same request ID,
731   * the server can check if original operation with the same request ID was
732   * received, and if so, will ignore the second request. This prevents clients
733   * from accidentally creating duplicate commitments. The request ID must be a
734   * valid UUID with the exception that zero UUID is not supported (
735   * 00000000-0000-0000-0000-000000000000).
736   * @return Operation
737   */
738  public function setDeletionProtection($project, $zone, $resource, $optParams = [])
739  {
740    $params = ['project' => $project, 'zone' => $zone, 'resource' => $resource];
741    $params = array_merge($params, $optParams);
742    return $this->call('setDeletionProtection', [$params], Operation::class);
743  }
744  /**
745   * Sets the auto-delete flag for a disk attached to an instance.
746   * (instances.setDiskAutoDelete)
747   *
748   * @param string $project Project ID for this request.
749   * @param string $zone The name of the zone for this request.
750   * @param string $instance The instance name for this request.
751   * @param bool $autoDelete Whether to auto-delete the disk when the instance is
752   * deleted.
753   * @param string $deviceName The device name of the disk to modify. Make a get()
754   * request on the instance to view currently attached disks and device names.
755   * @param array $optParams Optional parameters.
756   *
757   * @opt_param string requestId An optional request ID to identify requests.
758   * Specify a unique request ID so that if you must retry your request, the
759   * server will know to ignore the request if it has already been completed. For
760   * example, consider a situation where you make an initial request and the
761   * request times out. If you make the request again with the same request ID,
762   * the server can check if original operation with the same request ID was
763   * received, and if so, will ignore the second request. This prevents clients
764   * from accidentally creating duplicate commitments. The request ID must be a
765   * valid UUID with the exception that zero UUID is not supported (
766   * 00000000-0000-0000-0000-000000000000).
767   * @return Operation
768   */
769  public function setDiskAutoDelete($project, $zone, $instance, $autoDelete, $deviceName, $optParams = [])
770  {
771    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'autoDelete' => $autoDelete, 'deviceName' => $deviceName];
772    $params = array_merge($params, $optParams);
773    return $this->call('setDiskAutoDelete', [$params], Operation::class);
774  }
775  /**
776   * Sets the access control policy on the specified resource. Replaces any
777   * existing policy. (instances.setIamPolicy)
778   *
779   * @param string $project Project ID for this request.
780   * @param string $zone The name of the zone for this request.
781   * @param string $resource Name or id of the resource for this request.
782   * @param ZoneSetPolicyRequest $postBody
783   * @param array $optParams Optional parameters.
784   * @return Policy
785   */
786  public function setIamPolicy($project, $zone, $resource, ZoneSetPolicyRequest $postBody, $optParams = [])
787  {
788    $params = ['project' => $project, 'zone' => $zone, 'resource' => $resource, 'postBody' => $postBody];
789    $params = array_merge($params, $optParams);
790    return $this->call('setIamPolicy', [$params], Policy::class);
791  }
792  /**
793   * Sets labels on an instance. To learn more about labels, read the Labeling
794   * Resources documentation. (instances.setLabels)
795   *
796   * @param string $project Project ID for this request.
797   * @param string $zone The name of the zone for this request.
798   * @param string $instance Name of the instance scoping this request.
799   * @param InstancesSetLabelsRequest $postBody
800   * @param array $optParams Optional parameters.
801   *
802   * @opt_param string requestId An optional request ID to identify requests.
803   * Specify a unique request ID so that if you must retry your request, the
804   * server will know to ignore the request if it has already been completed. For
805   * example, consider a situation where you make an initial request and the
806   * request times out. If you make the request again with the same request ID,
807   * the server can check if original operation with the same request ID was
808   * received, and if so, will ignore the second request. This prevents clients
809   * from accidentally creating duplicate commitments. The request ID must be a
810   * valid UUID with the exception that zero UUID is not supported (
811   * 00000000-0000-0000-0000-000000000000).
812   * @return Operation
813   */
814  public function setLabels($project, $zone, $instance, InstancesSetLabelsRequest $postBody, $optParams = [])
815  {
816    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
817    $params = array_merge($params, $optParams);
818    return $this->call('setLabels', [$params], Operation::class);
819  }
820  /**
821   * Changes the number and/or type of accelerator for a stopped instance to the
822   * values specified in the request. (instances.setMachineResources)
823   *
824   * @param string $project Project ID for this request.
825   * @param string $zone The name of the zone for this request.
826   * @param string $instance Name of the instance scoping this request.
827   * @param InstancesSetMachineResourcesRequest $postBody
828   * @param array $optParams Optional parameters.
829   *
830   * @opt_param string requestId An optional request ID to identify requests.
831   * Specify a unique request ID so that if you must retry your request, the
832   * server will know to ignore the request if it has already been completed. For
833   * example, consider a situation where you make an initial request and the
834   * request times out. If you make the request again with the same request ID,
835   * the server can check if original operation with the same request ID was
836   * received, and if so, will ignore the second request. This prevents clients
837   * from accidentally creating duplicate commitments. The request ID must be a
838   * valid UUID with the exception that zero UUID is not supported (
839   * 00000000-0000-0000-0000-000000000000).
840   * @return Operation
841   */
842  public function setMachineResources($project, $zone, $instance, InstancesSetMachineResourcesRequest $postBody, $optParams = [])
843  {
844    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
845    $params = array_merge($params, $optParams);
846    return $this->call('setMachineResources', [$params], Operation::class);
847  }
848  /**
849   * Changes the machine type for a stopped instance to the machine type specified
850   * in the request. (instances.setMachineType)
851   *
852   * @param string $project Project ID for this request.
853   * @param string $zone The name of the zone for this request.
854   * @param string $instance Name of the instance scoping this request.
855   * @param InstancesSetMachineTypeRequest $postBody
856   * @param array $optParams Optional parameters.
857   *
858   * @opt_param string requestId An optional request ID to identify requests.
859   * Specify a unique request ID so that if you must retry your request, the
860   * server will know to ignore the request if it has already been completed. For
861   * example, consider a situation where you make an initial request and the
862   * request times out. If you make the request again with the same request ID,
863   * the server can check if original operation with the same request ID was
864   * received, and if so, will ignore the second request. This prevents clients
865   * from accidentally creating duplicate commitments. The request ID must be a
866   * valid UUID with the exception that zero UUID is not supported (
867   * 00000000-0000-0000-0000-000000000000).
868   * @return Operation
869   */
870  public function setMachineType($project, $zone, $instance, InstancesSetMachineTypeRequest $postBody, $optParams = [])
871  {
872    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
873    $params = array_merge($params, $optParams);
874    return $this->call('setMachineType', [$params], Operation::class);
875  }
876  /**
877   * Sets metadata for the specified instance to the data included in the request.
878   * (instances.setMetadata)
879   *
880   * @param string $project Project ID for this request.
881   * @param string $zone The name of the zone for this request.
882   * @param string $instance Name of the instance scoping this request.
883   * @param Metadata $postBody
884   * @param array $optParams Optional parameters.
885   *
886   * @opt_param string requestId An optional request ID to identify requests.
887   * Specify a unique request ID so that if you must retry your request, the
888   * server will know to ignore the request if it has already been completed. For
889   * example, consider a situation where you make an initial request and the
890   * request times out. If you make the request again with the same request ID,
891   * the server can check if original operation with the same request ID was
892   * received, and if so, will ignore the second request. This prevents clients
893   * from accidentally creating duplicate commitments. The request ID must be a
894   * valid UUID with the exception that zero UUID is not supported (
895   * 00000000-0000-0000-0000-000000000000).
896   * @return Operation
897   */
898  public function setMetadata($project, $zone, $instance, Metadata $postBody, $optParams = [])
899  {
900    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
901    $params = array_merge($params, $optParams);
902    return $this->call('setMetadata', [$params], Operation::class);
903  }
904  /**
905   * Changes the minimum CPU platform that this instance should use. This method
906   * can only be called on a stopped instance. For more information, read
907   * Specifying a Minimum CPU Platform. (instances.setMinCpuPlatform)
908   *
909   * @param string $project Project ID for this request.
910   * @param string $zone The name of the zone for this request.
911   * @param string $instance Name of the instance scoping this request.
912   * @param InstancesSetMinCpuPlatformRequest $postBody
913   * @param array $optParams Optional parameters.
914   *
915   * @opt_param string requestId An optional request ID to identify requests.
916   * Specify a unique request ID so that if you must retry your request, the
917   * server will know to ignore the request if it has already been completed. For
918   * example, consider a situation where you make an initial request and the
919   * request times out. If you make the request again with the same request ID,
920   * the server can check if original operation with the same request ID was
921   * received, and if so, will ignore the second request. This prevents clients
922   * from accidentally creating duplicate commitments. The request ID must be a
923   * valid UUID with the exception that zero UUID is not supported (
924   * 00000000-0000-0000-0000-000000000000).
925   * @return Operation
926   */
927  public function setMinCpuPlatform($project, $zone, $instance, InstancesSetMinCpuPlatformRequest $postBody, $optParams = [])
928  {
929    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
930    $params = array_merge($params, $optParams);
931    return $this->call('setMinCpuPlatform', [$params], Operation::class);
932  }
933  /**
934   * Sets an instance's scheduling options. You can only call this method on a
935   * stopped instance, that is, a VM instance that is in a `TERMINATED` state. See
936   * Instance Life Cycle for more information on the possible instance states. For
937   * more information about setting scheduling options for a VM, see Set VM
938   * availability policies. (instances.setScheduling)
939   *
940   * @param string $project Project ID for this request.
941   * @param string $zone The name of the zone for this request.
942   * @param string $instance Instance name for this request.
943   * @param Scheduling $postBody
944   * @param array $optParams Optional parameters.
945   *
946   * @opt_param string requestId An optional request ID to identify requests.
947   * Specify a unique request ID so that if you must retry your request, the
948   * server will know to ignore the request if it has already been completed. For
949   * example, consider a situation where you make an initial request and the
950   * request times out. If you make the request again with the same request ID,
951   * the server can check if original operation with the same request ID was
952   * received, and if so, will ignore the second request. This prevents clients
953   * from accidentally creating duplicate commitments. The request ID must be a
954   * valid UUID with the exception that zero UUID is not supported (
955   * 00000000-0000-0000-0000-000000000000).
956   * @return Operation
957   */
958  public function setScheduling($project, $zone, $instance, Scheduling $postBody, $optParams = [])
959  {
960    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
961    $params = array_merge($params, $optParams);
962    return $this->call('setScheduling', [$params], Operation::class);
963  }
964  /**
965   * Sets the service account on the instance. For more information, read Changing
966   * the service account and access scopes for an instance.
967   * (instances.setServiceAccount)
968   *
969   * @param string $project Project ID for this request.
970   * @param string $zone The name of the zone for this request.
971   * @param string $instance Name of the instance resource to start.
972   * @param InstancesSetServiceAccountRequest $postBody
973   * @param array $optParams Optional parameters.
974   *
975   * @opt_param string requestId An optional request ID to identify requests.
976   * Specify a unique request ID so that if you must retry your request, the
977   * server will know to ignore the request if it has already been completed. For
978   * example, consider a situation where you make an initial request and the
979   * request times out. If you make the request again with the same request ID,
980   * the server can check if original operation with the same request ID was
981   * received, and if so, will ignore the second request. This prevents clients
982   * from accidentally creating duplicate commitments. The request ID must be a
983   * valid UUID with the exception that zero UUID is not supported (
984   * 00000000-0000-0000-0000-000000000000).
985   * @return Operation
986   */
987  public function setServiceAccount($project, $zone, $instance, InstancesSetServiceAccountRequest $postBody, $optParams = [])
988  {
989    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
990    $params = array_merge($params, $optParams);
991    return $this->call('setServiceAccount', [$params], Operation::class);
992  }
993  /**
994   * Sets the Shielded Instance integrity policy for an instance. You can only use
995   * this method on a running instance. This method supports PATCH semantics and
996   * uses the JSON merge patch format and processing rules.
997   * (instances.setShieldedInstanceIntegrityPolicy)
998   *
999   * @param string $project Project ID for this request.
1000   * @param string $zone The name of the zone for this request.
1001   * @param string $instance Name or id of the instance scoping this request.
1002   * @param ShieldedInstanceIntegrityPolicy $postBody
1003   * @param array $optParams Optional parameters.
1004   *
1005   * @opt_param string requestId An optional request ID to identify requests.
1006   * Specify a unique request ID so that if you must retry your request, the
1007   * server will know to ignore the request if it has already been completed. For
1008   * example, consider a situation where you make an initial request and the
1009   * request times out. If you make the request again with the same request ID,
1010   * the server can check if original operation with the same request ID was
1011   * received, and if so, will ignore the second request. This prevents clients
1012   * from accidentally creating duplicate commitments. The request ID must be a
1013   * valid UUID with the exception that zero UUID is not supported (
1014   * 00000000-0000-0000-0000-000000000000).
1015   * @return Operation
1016   */
1017  public function setShieldedInstanceIntegrityPolicy($project, $zone, $instance, ShieldedInstanceIntegrityPolicy $postBody, $optParams = [])
1018  {
1019    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
1020    $params = array_merge($params, $optParams);
1021    return $this->call('setShieldedInstanceIntegrityPolicy', [$params], Operation::class);
1022  }
1023  /**
1024   * Sets network tags for the specified instance to the data included in the
1025   * request. (instances.setTags)
1026   *
1027   * @param string $project Project ID for this request.
1028   * @param string $zone The name of the zone for this request.
1029   * @param string $instance Name of the instance scoping this request.
1030   * @param Tags $postBody
1031   * @param array $optParams Optional parameters.
1032   *
1033   * @opt_param string requestId An optional request ID to identify requests.
1034   * Specify a unique request ID so that if you must retry your request, the
1035   * server will know to ignore the request if it has already been completed. For
1036   * example, consider a situation where you make an initial request and the
1037   * request times out. If you make the request again with the same request ID,
1038   * the server can check if original operation with the same request ID was
1039   * received, and if so, will ignore the second request. This prevents clients
1040   * from accidentally creating duplicate commitments. The request ID must be a
1041   * valid UUID with the exception that zero UUID is not supported (
1042   * 00000000-0000-0000-0000-000000000000).
1043   * @return Operation
1044   */
1045  public function setTags($project, $zone, $instance, Tags $postBody, $optParams = [])
1046  {
1047    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
1048    $params = array_merge($params, $optParams);
1049    return $this->call('setTags', [$params], Operation::class);
1050  }
1051  /**
1052   * Simulates a host maintenance event on a VM. For more information, see
1053   * Simulate a host maintenance event. (instances.simulateMaintenanceEvent)
1054   *
1055   * @param string $project Project ID for this request.
1056   * @param string $zone The name of the zone for this request.
1057   * @param string $instance Name of the instance scoping this request.
1058   * @param array $optParams Optional parameters.
1059   * @return Operation
1060   */
1061  public function simulateMaintenanceEvent($project, $zone, $instance, $optParams = [])
1062  {
1063    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
1064    $params = array_merge($params, $optParams);
1065    return $this->call('simulateMaintenanceEvent', [$params], Operation::class);
1066  }
1067  /**
1068   * Starts an instance that was stopped using the instances().stop method. For
1069   * more information, see Restart an instance. (instances.start)
1070   *
1071   * @param string $project Project ID for this request.
1072   * @param string $zone The name of the zone for this request.
1073   * @param string $instance Name of the instance resource to start.
1074   * @param array $optParams Optional parameters.
1075   *
1076   * @opt_param string requestId An optional request ID to identify requests.
1077   * Specify a unique request ID so that if you must retry your request, the
1078   * server will know to ignore the request if it has already been completed. For
1079   * example, consider a situation where you make an initial request and the
1080   * request times out. If you make the request again with the same request ID,
1081   * the server can check if original operation with the same request ID was
1082   * received, and if so, will ignore the second request. This prevents clients
1083   * from accidentally creating duplicate commitments. The request ID must be a
1084   * valid UUID with the exception that zero UUID is not supported (
1085   * 00000000-0000-0000-0000-000000000000).
1086   * @return Operation
1087   */
1088  public function start($project, $zone, $instance, $optParams = [])
1089  {
1090    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
1091    $params = array_merge($params, $optParams);
1092    return $this->call('start', [$params], Operation::class);
1093  }
1094  /**
1095   * Starts an instance that was stopped using the instances().stop method. For
1096   * more information, see Restart an instance. (instances.startWithEncryptionKey)
1097   *
1098   * @param string $project Project ID for this request.
1099   * @param string $zone The name of the zone for this request.
1100   * @param string $instance Name of the instance resource to start.
1101   * @param InstancesStartWithEncryptionKeyRequest $postBody
1102   * @param array $optParams Optional parameters.
1103   *
1104   * @opt_param string requestId An optional request ID to identify requests.
1105   * Specify a unique request ID so that if you must retry your request, the
1106   * server will know to ignore the request if it has already been completed. For
1107   * example, consider a situation where you make an initial request and the
1108   * request times out. If you make the request again with the same request ID,
1109   * the server can check if original operation with the same request ID was
1110   * received, and if so, will ignore the second request. This prevents clients
1111   * from accidentally creating duplicate commitments. The request ID must be a
1112   * valid UUID with the exception that zero UUID is not supported (
1113   * 00000000-0000-0000-0000-000000000000).
1114   * @return Operation
1115   */
1116  public function startWithEncryptionKey($project, $zone, $instance, InstancesStartWithEncryptionKeyRequest $postBody, $optParams = [])
1117  {
1118    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
1119    $params = array_merge($params, $optParams);
1120    return $this->call('startWithEncryptionKey', [$params], Operation::class);
1121  }
1122  /**
1123   * Stops a running instance, shutting it down cleanly, and allows you to restart
1124   * the instance at a later time. Stopped instances do not incur VM usage charges
1125   * while they are stopped. However, resources that the VM is using, such as
1126   * persistent disks and static IP addresses, will continue to be charged until
1127   * they are deleted. For more information, see Stopping an instance.
1128   * (instances.stop)
1129   *
1130   * @param string $project Project ID for this request.
1131   * @param string $zone The name of the zone for this request.
1132   * @param string $instance Name of the instance resource to stop.
1133   * @param array $optParams Optional parameters.
1134   *
1135   * @opt_param string requestId An optional request ID to identify requests.
1136   * Specify a unique request ID so that if you must retry your request, the
1137   * server will know to ignore the request if it has already been completed. For
1138   * example, consider a situation where you make an initial request and the
1139   * request times out. If you make the request again with the same request ID,
1140   * the server can check if original operation with the same request ID was
1141   * received, and if so, will ignore the second request. This prevents clients
1142   * from accidentally creating duplicate commitments. The request ID must be a
1143   * valid UUID with the exception that zero UUID is not supported (
1144   * 00000000-0000-0000-0000-000000000000).
1145   * @return Operation
1146   */
1147  public function stop($project, $zone, $instance, $optParams = [])
1148  {
1149    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
1150    $params = array_merge($params, $optParams);
1151    return $this->call('stop', [$params], Operation::class);
1152  }
1153  /**
1154   * This method suspends a running instance, saving its state to persistent
1155   * storage, and allows you to resume the instance at a later time. Suspended
1156   * instances have no compute costs (cores or RAM), and incur only storage
1157   * charges for the saved VM memory and localSSD data. Any charged resources the
1158   * virtual machine was using, such as persistent disks and static IP addresses,
1159   * will continue to be charged while the instance is suspended. For more
1160   * information, see Suspending and resuming an instance. (instances.suspend)
1161   *
1162   * @param string $project Project ID for this request.
1163   * @param string $zone The name of the zone for this request.
1164   * @param string $instance Name of the instance resource to suspend.
1165   * @param array $optParams Optional parameters.
1166   *
1167   * @opt_param string requestId An optional request ID to identify requests.
1168   * Specify a unique request ID so that if you must retry your request, the
1169   * server will know to ignore the request if it has already been completed. For
1170   * example, consider a situation where you make an initial request and the
1171   * request times out. If you make the request again with the same request ID,
1172   * the server can check if original operation with the same request ID was
1173   * received, and if so, will ignore the second request. This prevents clients
1174   * from accidentally creating duplicate commitments. The request ID must be a
1175   * valid UUID with the exception that zero UUID is not supported (
1176   * 00000000-0000-0000-0000-000000000000).
1177   * @return Operation
1178   */
1179  public function suspend($project, $zone, $instance, $optParams = [])
1180  {
1181    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance];
1182    $params = array_merge($params, $optParams);
1183    return $this->call('suspend', [$params], Operation::class);
1184  }
1185  /**
1186   * Returns permissions that a caller has on the specified resource.
1187   * (instances.testIamPermissions)
1188   *
1189   * @param string $project Project ID for this request.
1190   * @param string $zone The name of the zone for this request.
1191   * @param string $resource Name or id of the resource for this request.
1192   * @param TestPermissionsRequest $postBody
1193   * @param array $optParams Optional parameters.
1194   * @return TestPermissionsResponse
1195   */
1196  public function testIamPermissions($project, $zone, $resource, TestPermissionsRequest $postBody, $optParams = [])
1197  {
1198    $params = ['project' => $project, 'zone' => $zone, 'resource' => $resource, 'postBody' => $postBody];
1199    $params = array_merge($params, $optParams);
1200    return $this->call('testIamPermissions', [$params], TestPermissionsResponse::class);
1201  }
1202  /**
1203   * Updates an instance only if the necessary resources are available. This
1204   * method can update only a specific set of instance properties. See Updating a
1205   * running instance for a list of updatable instance properties.
1206   * (instances.update)
1207   *
1208   * @param string $project Project ID for this request.
1209   * @param string $zone The name of the zone for this request.
1210   * @param string $instance Name of the instance resource to update.
1211   * @param Instance $postBody
1212   * @param array $optParams Optional parameters.
1213   *
1214   * @opt_param string minimalAction Specifies the action to take when updating an
1215   * instance even if the updated properties do not require it. If not specified,
1216   * then Compute Engine acts based on the minimum action that the updated
1217   * properties require.
1218   * @opt_param string mostDisruptiveAllowedAction Specifies the most disruptive
1219   * action that can be taken on the instance as part of the update. Compute
1220   * Engine returns an error if the instance properties require a more disruptive
1221   * action as part of the instance update. Valid options from lowest to highest
1222   * are NO_EFFECT, REFRESH, and RESTART.
1223   * @opt_param string requestId An optional request ID to identify requests.
1224   * Specify a unique request ID so that if you must retry your request, the
1225   * server will know to ignore the request if it has already been completed. For
1226   * example, consider a situation where you make an initial request and the
1227   * request times out. If you make the request again with the same request ID,
1228   * the server can check if original operation with the same request ID was
1229   * received, and if so, will ignore the second request. This prevents clients
1230   * from accidentally creating duplicate commitments. The request ID must be a
1231   * valid UUID with the exception that zero UUID is not supported (
1232   * 00000000-0000-0000-0000-000000000000).
1233   * @return Operation
1234   */
1235  public function update($project, $zone, $instance, Instance $postBody, $optParams = [])
1236  {
1237    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
1238    $params = array_merge($params, $optParams);
1239    return $this->call('update', [$params], Operation::class);
1240  }
1241  /**
1242   * Updates the specified access config from an instance's network interface with
1243   * the data included in the request. This method supports PATCH semantics and
1244   * uses the JSON merge patch format and processing rules.
1245   * (instances.updateAccessConfig)
1246   *
1247   * @param string $project Project ID for this request.
1248   * @param string $zone The name of the zone for this request.
1249   * @param string $instance The instance name for this request.
1250   * @param string $networkInterface The name of the network interface where the
1251   * access config is attached.
1252   * @param AccessConfig $postBody
1253   * @param array $optParams Optional parameters.
1254   *
1255   * @opt_param string requestId An optional request ID to identify requests.
1256   * Specify a unique request ID so that if you must retry your request, the
1257   * server will know to ignore the request if it has already been completed. For
1258   * example, consider a situation where you make an initial request and the
1259   * request times out. If you make the request again with the same request ID,
1260   * the server can check if original operation with the same request ID was
1261   * received, and if so, will ignore the second request. This prevents clients
1262   * from accidentally creating duplicate commitments. The request ID must be a
1263   * valid UUID with the exception that zero UUID is not supported (
1264   * 00000000-0000-0000-0000-000000000000).
1265   * @return Operation
1266   */
1267  public function updateAccessConfig($project, $zone, $instance, $networkInterface, AccessConfig $postBody, $optParams = [])
1268  {
1269    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'networkInterface' => $networkInterface, 'postBody' => $postBody];
1270    $params = array_merge($params, $optParams);
1271    return $this->call('updateAccessConfig', [$params], Operation::class);
1272  }
1273  /**
1274   * Updates the Display config for a VM instance. You can only use this method on
1275   * a stopped VM instance. This method supports PATCH semantics and uses the JSON
1276   * merge patch format and processing rules. (instances.updateDisplayDevice)
1277   *
1278   * @param string $project Project ID for this request.
1279   * @param string $zone The name of the zone for this request.
1280   * @param string $instance Name of the instance scoping this request.
1281   * @param DisplayDevice $postBody
1282   * @param array $optParams Optional parameters.
1283   *
1284   * @opt_param string requestId An optional request ID to identify requests.
1285   * Specify a unique request ID so that if you must retry your request, the
1286   * server will know to ignore the request if it has already been completed. For
1287   * example, consider a situation where you make an initial request and the
1288   * request times out. If you make the request again with the same request ID,
1289   * the server can check if original operation with the same request ID was
1290   * received, and if so, will ignore the second request. This prevents clients
1291   * from accidentally creating duplicate commitments. The request ID must be a
1292   * valid UUID with the exception that zero UUID is not supported (
1293   * 00000000-0000-0000-0000-000000000000).
1294   * @return Operation
1295   */
1296  public function updateDisplayDevice($project, $zone, $instance, DisplayDevice $postBody, $optParams = [])
1297  {
1298    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
1299    $params = array_merge($params, $optParams);
1300    return $this->call('updateDisplayDevice', [$params], Operation::class);
1301  }
1302  /**
1303   * Updates an instance's network interface. This method can only update an
1304   * interface's alias IP range and attached network. See Modifying alias IP
1305   * ranges for an existing instance for instructions on changing alias IP ranges.
1306   * See Migrating a VM between networks for instructions on migrating an
1307   * interface. This method follows PATCH semantics.
1308   * (instances.updateNetworkInterface)
1309   *
1310   * @param string $project Project ID for this request.
1311   * @param string $zone The name of the zone for this request.
1312   * @param string $instance The instance name for this request.
1313   * @param string $networkInterface The name of the network interface to update.
1314   * @param NetworkInterface $postBody
1315   * @param array $optParams Optional parameters.
1316   *
1317   * @opt_param string requestId An optional request ID to identify requests.
1318   * Specify a unique request ID so that if you must retry your request, the
1319   * server will know to ignore the request if it has already been completed. For
1320   * example, consider a situation where you make an initial request and the
1321   * request times out. If you make the request again with the same request ID,
1322   * the server can check if original operation with the same request ID was
1323   * received, and if so, will ignore the second request. This prevents clients
1324   * from accidentally creating duplicate commitments. The request ID must be a
1325   * valid UUID with the exception that zero UUID is not supported (
1326   * 00000000-0000-0000-0000-000000000000).
1327   * @return Operation
1328   */
1329  public function updateNetworkInterface($project, $zone, $instance, $networkInterface, NetworkInterface $postBody, $optParams = [])
1330  {
1331    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'networkInterface' => $networkInterface, 'postBody' => $postBody];
1332    $params = array_merge($params, $optParams);
1333    return $this->call('updateNetworkInterface', [$params], Operation::class);
1334  }
1335  /**
1336   * Updates the Shielded Instance config for an instance. You can only use this
1337   * method on a stopped instance. This method supports PATCH semantics and uses
1338   * the JSON merge patch format and processing rules.
1339   * (instances.updateShieldedInstanceConfig)
1340   *
1341   * @param string $project Project ID for this request.
1342   * @param string $zone The name of the zone for this request.
1343   * @param string $instance Name or id of the instance scoping this request.
1344   * @param ShieldedInstanceConfig $postBody
1345   * @param array $optParams Optional parameters.
1346   *
1347   * @opt_param string requestId An optional request ID to identify requests.
1348   * Specify a unique request ID so that if you must retry your request, the
1349   * server will know to ignore the request if it has already been completed. For
1350   * example, consider a situation where you make an initial request and the
1351   * request times out. If you make the request again with the same request ID,
1352   * the server can check if original operation with the same request ID was
1353   * received, and if so, will ignore the second request. This prevents clients
1354   * from accidentally creating duplicate commitments. The request ID must be a
1355   * valid UUID with the exception that zero UUID is not supported (
1356   * 00000000-0000-0000-0000-000000000000).
1357   * @return Operation
1358   */
1359  public function updateShieldedInstanceConfig($project, $zone, $instance, ShieldedInstanceConfig $postBody, $optParams = [])
1360  {
1361    $params = ['project' => $project, 'zone' => $zone, 'instance' => $instance, 'postBody' => $postBody];
1362    $params = array_merge($params, $optParams);
1363    return $this->call('updateShieldedInstanceConfig', [$params], Operation::class);
1364  }
1365}
1366
1367// Adding a class alias for backwards compatibility with the previous class name.
1368class_alias(Instances::class, 'Google_Service_Compute_Resource_Instances');
1369