class Instances extends Resource (View source)

The "instances" collection of methods.

Typical usage is:

 $computeService = new Google\Service\Compute(...);
 $instances = $computeService->instances;

Methods

addAccessConfig(string $project, string $zone, string $instance, string $networkInterface, AccessConfig $postBody, array $optParams = [])

Adds an access config to an instance's network interface.

addResourcePolicies(string $project, string $zone, string $instance, InstancesAddResourcePoliciesRequest $postBody, array $optParams = [])

Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations. (instances.addResourcePolicies)

aggregatedList(string $project, array $optParams = [])

Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true. (instances.aggregatedList)

attachDisk(string $project, string $zone, string $instance, AttachedDisk $postBody, array $optParams = [])

Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance. (instances.attachDisk)

bulkInsert(string $project, string $zone, BulkInsertInstanceResource $postBody, array $optParams = [])

Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.

delete(string $project, string $zone, string $instance, array $optParams = [])

Deletes the specified Instance resource. For more information, see Deleting an instance. (instances.delete)

deleteAccessConfig(string $project, string $zone, string $instance, string $accessConfig, string $networkInterface, array $optParams = [])

Deletes an access config from an instance's network interface.

detachDisk(string $project, string $zone, string $instance, string $deviceName, array $optParams = [])

Detaches a disk from an instance. (instances.detachDisk)

get(string $project, string $zone, string $instance, array $optParams = [])

Returns the specified Instance resource. (instances.get)

getEffectiveFirewalls(string $project, string $zone, string $instance, string $networkInterface, array $optParams = [])

Returns effective firewalls applied to an interface of the instance.

getGuestAttributes(string $project, string $zone, string $instance, array $optParams = [])

Returns the specified guest attributes entry. (instances.getGuestAttributes)

getIamPolicy(string $project, string $zone, string $resource, array $optParams = [])

Gets the access control policy for a resource. May be empty if no such policy or resource exists. (instances.getIamPolicy)

getScreenshot(string $project, string $zone, string $instance, array $optParams = [])

Returns the screenshot from the specified instance. (instances.getScreenshot)

getSerialPortOutput(string $project, string $zone, string $instance, array $optParams = [])

Returns the last 1 MB of serial port output from the specified instance.

getShieldedInstanceIdentity(string $project, string $zone, string $instance, array $optParams = [])

Returns the Shielded Instance Identity of an instance (instances.getShieldedInstanceIdentity)

insert(string $project, string $zone, Instance $postBody, array $optParams = [])

Creates an instance resource in the specified project using the data included in the request. (instances.insert)

listInstances(string $project, string $zone, array $optParams = [])

Retrieves the list of instances contained within the specified zone.

listReferrers(string $project, string $zone, string $instance, array $optParams = [])

Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.

performMaintenance(string $project, string $zone, string $instance, array $optParams = [])

Perform a manual maintenance on the instance. (instances.performMaintenance)

removeResourcePolicies(string $project, string $zone, string $instance, InstancesRemoveResourcePoliciesRequest $postBody, array $optParams = [])

Removes resource policies from an instance.

reset(string $project, string $zone, string $instance, array $optParams = [])

Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.

resume(string $project, string $zone, string $instance, array $optParams = [])

Resumes an instance that was suspended using the instances().suspend method.

sendDiagnosticInterrupt(string $project, string $zone, string $instance, array $optParams = [])

Sends diagnostic interrupt to the instance.

setDeletionProtection(string $project, string $zone, string $resource, array $optParams = [])

Sets deletion protection on the instance. (instances.setDeletionProtection)

setDiskAutoDelete(string $project, string $zone, string $instance, bool $autoDelete, string $deviceName, array $optParams = [])

Sets the auto-delete flag for a disk attached to an instance.

setIamPolicy(string $project, string $zone, string $resource, ZoneSetPolicyRequest $postBody, array $optParams = [])

Sets the access control policy on the specified resource. Replaces any existing policy. (instances.setIamPolicy)

setLabels(string $project, string $zone, string $instance, InstancesSetLabelsRequest $postBody, array $optParams = [])

Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation. (instances.setLabels)

setMachineResources(string $project, string $zone, string $instance, InstancesSetMachineResourcesRequest $postBody, array $optParams = [])

Changes the number and/or type of accelerator for a stopped instance to the values specified in the request. (instances.setMachineResources)

setMachineType(string $project, string $zone, string $instance, InstancesSetMachineTypeRequest $postBody, array $optParams = [])

Changes the machine type for a stopped instance to the machine type specified in the request. (instances.setMachineType)

setMetadata(string $project, string $zone, string $instance, Metadata $postBody, array $optParams = [])

Sets metadata for the specified instance to the data included in the request.

setMinCpuPlatform(string $project, string $zone, string $instance, InstancesSetMinCpuPlatformRequest $postBody, array $optParams = [])

Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform. (instances.setMinCpuPlatform)

setName(string $project, string $zone, string $instance, InstancesSetNameRequest $postBody, array $optParams = [])

Sets name of an instance. (instances.setName)

setScheduling(string $project, string $zone, string $instance, Scheduling $postBody, array $optParams = [])

Sets an instance's scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a TERMINATED state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy. (instances.setScheduling)

setSecurityPolicy(string $project, string $zone, string $instance, InstancesSetSecurityPolicyRequest $postBody, array $optParams = [])

Sets the Google Cloud Armor security policy for the specified instance. For more information, see Google Cloud Armor Overview (instances.setSecurityPolicy)

setServiceAccount(string $project, string $zone, string $instance, InstancesSetServiceAccountRequest $postBody, array $optParams = [])

Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.

setShieldedInstanceIntegrityPolicy(string $project, string $zone, string $instance, ShieldedInstanceIntegrityPolicy $postBody, array $optParams = [])

Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

setTags(string $project, string $zone, string $instance, Tags $postBody, array $optParams = [])

Sets network tags for the specified instance to the data included in the request. (instances.setTags)

simulateMaintenanceEvent(string $project, string $zone, string $instance, array $optParams = [])

Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event. (instances.simulateMaintenanceEvent)

start(string $project, string $zone, string $instance, array $optParams = [])

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. (instances.start)

startWithEncryptionKey(string $project, string $zone, string $instance, InstancesStartWithEncryptionKeyRequest $postBody, array $optParams = [])

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. (instances.startWithEncryptionKey)

stop(string $project, string $zone, string $instance, array $optParams = [])

Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.

suspend(string $project, string $zone, string $instance, array $optParams = [])

This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance. (instances.suspend)

testIamPermissions(string $project, string $zone, string $resource, TestPermissionsRequest $postBody, array $optParams = [])

Returns permissions that a caller has on the specified resource.

update(string $project, string $zone, string $instance, Instance $postBody, array $optParams = [])

Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.

updateAccessConfig(string $project, string $zone, string $instance, string $networkInterface, AccessConfig $postBody, array $optParams = [])

Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

updateDisplayDevice(string $project, string $zone, string $instance, DisplayDevice $postBody, array $optParams = [])

Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. (instances.updateDisplayDevice)

updateNetworkInterface(string $project, string $zone, string $instance, string $networkInterface, NetworkInterface $postBody, array $optParams = [])

Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges.

updateShieldedInstanceConfig(string $project, string $zone, string $instance, ShieldedInstanceConfig $postBody, array $optParams = [])

Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Details

Operation addAccessConfig(string $project, string $zone, string $instance, string $networkInterface, AccessConfig $postBody, array $optParams = [])

Adds an access config to an instance's network interface.

(instances.addAccessConfig)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

The instance name for this request.

string $networkInterface

The name of the network interface to add to this instance.

AccessConfig $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation addResourcePolicies(string $project, string $zone, string $instance, InstancesAddResourcePoliciesRequest $postBody, array $optParams = [])

Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations. (instances.addResourcePolicies)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

The instance name for this request.

InstancesAddResourcePoliciesRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

InstanceAggregatedList aggregatedList(string $project, array $optParams = [])

Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true. (instances.aggregatedList)

Parameters

string $project

Project ID for this request.

array $optParams

Optional parameters.

Return Value

InstanceAggregatedList

Exceptions

Exception

Operation attachDisk(string $project, string $zone, string $instance, AttachedDisk $postBody, array $optParams = [])

Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance. (instances.attachDisk)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

The instance name for this request.

AttachedDisk $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation bulkInsert(string $project, string $zone, BulkInsertInstanceResource $postBody, array $optParams = [])

Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.

(instances.bulkInsert)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

BulkInsertInstanceResource $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation delete(string $project, string $zone, string $instance, array $optParams = [])

Deletes the specified Instance resource. For more information, see Deleting an instance. (instances.delete)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance resource to delete.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation deleteAccessConfig(string $project, string $zone, string $instance, string $accessConfig, string $networkInterface, array $optParams = [])

Deletes an access config from an instance's network interface.

(instances.deleteAccessConfig)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

The instance name for this request.

string $accessConfig

The name of the access config to delete.

string $networkInterface

The name of the network interface.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation detachDisk(string $project, string $zone, string $instance, string $deviceName, array $optParams = [])

Detaches a disk from an instance. (instances.detachDisk)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Instance name for this request.

string $deviceName

The device name of the disk to detach. Make a get() request on the instance to view currently attached disks and device names.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Instance get(string $project, string $zone, string $instance, array $optParams = [])

Returns the specified Instance resource. (instances.get)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance resource to return.

array $optParams

Optional parameters.

Return Value

Instance

Exceptions

Exception

InstancesGetEffectiveFirewallsResponse getEffectiveFirewalls(string $project, string $zone, string $instance, string $networkInterface, array $optParams = [])

Returns effective firewalls applied to an interface of the instance.

(instances.getEffectiveFirewalls)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

string $networkInterface

The name of the network interface to get the effective firewalls.

array $optParams

Optional parameters.

Return Value

InstancesGetEffectiveFirewallsResponse

Exceptions

Exception

GuestAttributes getGuestAttributes(string $project, string $zone, string $instance, array $optParams = [])

Returns the specified guest attributes entry. (instances.getGuestAttributes)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

array $optParams

Optional parameters.

Return Value

GuestAttributes

Exceptions

Exception

Policy getIamPolicy(string $project, string $zone, string $resource, array $optParams = [])

Gets the access control policy for a resource. May be empty if no such policy or resource exists. (instances.getIamPolicy)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $resource

Name or id of the resource for this request.

array $optParams

Optional parameters.

Return Value

Policy

Exceptions

Exception

Screenshot getScreenshot(string $project, string $zone, string $instance, array $optParams = [])

Returns the screenshot from the specified instance. (instances.getScreenshot)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

array $optParams

Optional parameters.

Return Value

Screenshot

Exceptions

Exception

SerialPortOutput getSerialPortOutput(string $project, string $zone, string $instance, array $optParams = [])

Returns the last 1 MB of serial port output from the specified instance.

(instances.getSerialPortOutput)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance for this request.

array $optParams

Optional parameters.

Return Value

SerialPortOutput

Exceptions

Exception

ShieldedInstanceIdentity getShieldedInstanceIdentity(string $project, string $zone, string $instance, array $optParams = [])

Returns the Shielded Instance Identity of an instance (instances.getShieldedInstanceIdentity)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name or id of the instance scoping this request.

array $optParams

Optional parameters.

Return Value

ShieldedInstanceIdentity

Exceptions

Exception

Operation insert(string $project, string $zone, Instance $postBody, array $optParams = [])

Creates an instance resource in the specified project using the data included in the request. (instances.insert)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

Instance $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

InstanceList listInstances(string $project, string $zone, array $optParams = [])

Retrieves the list of instances contained within the specified zone.

(instances.listInstances)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

array $optParams

Optional parameters.

Return Value

InstanceList

Exceptions

Exception

InstanceListReferrers listReferrers(string $project, string $zone, string $instance, array $optParams = [])

Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.

(instances.listReferrers)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the target instance scoping this request, or '-' if the request should span over all instances in the container.

array $optParams

Optional parameters.

Return Value

InstanceListReferrers

Exceptions

Exception

Operation performMaintenance(string $project, string $zone, string $instance, array $optParams = [])

Perform a manual maintenance on the instance. (instances.performMaintenance)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation removeResourcePolicies(string $project, string $zone, string $instance, InstancesRemoveResourcePoliciesRequest $postBody, array $optParams = [])

Removes resource policies from an instance.

(instances.removeResourcePolicies)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

The instance name for this request.

InstancesRemoveResourcePoliciesRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation reset(string $project, string $zone, string $instance, array $optParams = [])

Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.

(instances.reset)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation resume(string $project, string $zone, string $instance, array $optParams = [])

Resumes an instance that was suspended using the instances().suspend method.

(instances.resume)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance resource to resume.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

sendDiagnosticInterrupt(string $project, string $zone, string $instance, array $optParams = [])

Sends diagnostic interrupt to the instance.

(instances.sendDiagnosticInterrupt)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

array $optParams

Optional parameters.

Exceptions

Exception

Operation setDeletionProtection(string $project, string $zone, string $resource, array $optParams = [])

Sets deletion protection on the instance. (instances.setDeletionProtection)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $resource

Name or id of the resource for this request.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation setDiskAutoDelete(string $project, string $zone, string $instance, bool $autoDelete, string $deviceName, array $optParams = [])

Sets the auto-delete flag for a disk attached to an instance.

(instances.setDiskAutoDelete)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

The instance name for this request.

bool $autoDelete

Whether to auto-delete the disk when the instance is deleted.

string $deviceName

The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Policy setIamPolicy(string $project, string $zone, string $resource, ZoneSetPolicyRequest $postBody, array $optParams = [])

Sets the access control policy on the specified resource. Replaces any existing policy. (instances.setIamPolicy)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $resource

Name or id of the resource for this request.

ZoneSetPolicyRequest $postBody
array $optParams

Optional parameters.

Return Value

Policy

Exceptions

Exception

Operation setLabels(string $project, string $zone, string $instance, InstancesSetLabelsRequest $postBody, array $optParams = [])

Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation. (instances.setLabels)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

InstancesSetLabelsRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation setMachineResources(string $project, string $zone, string $instance, InstancesSetMachineResourcesRequest $postBody, array $optParams = [])

Changes the number and/or type of accelerator for a stopped instance to the values specified in the request. (instances.setMachineResources)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

InstancesSetMachineResourcesRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation setMachineType(string $project, string $zone, string $instance, InstancesSetMachineTypeRequest $postBody, array $optParams = [])

Changes the machine type for a stopped instance to the machine type specified in the request. (instances.setMachineType)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

InstancesSetMachineTypeRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation setMetadata(string $project, string $zone, string $instance, Metadata $postBody, array $optParams = [])

Sets metadata for the specified instance to the data included in the request.

(instances.setMetadata)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

Metadata $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation setMinCpuPlatform(string $project, string $zone, string $instance, InstancesSetMinCpuPlatformRequest $postBody, array $optParams = [])

Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform. (instances.setMinCpuPlatform)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

InstancesSetMinCpuPlatformRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation setName(string $project, string $zone, string $instance, InstancesSetNameRequest $postBody, array $optParams = [])

Sets name of an instance. (instances.setName)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

The instance name for this request.

InstancesSetNameRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation setScheduling(string $project, string $zone, string $instance, Scheduling $postBody, array $optParams = [])

Sets an instance's scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a TERMINATED state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy. (instances.setScheduling)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Instance name for this request.

Scheduling $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation setSecurityPolicy(string $project, string $zone, string $instance, InstancesSetSecurityPolicyRequest $postBody, array $optParams = [])

Sets the Google Cloud Armor security policy for the specified instance. For more information, see Google Cloud Armor Overview (instances.setSecurityPolicy)

Parameters

string $project

Project ID for this request.

string $zone

Name of the zone scoping this request.

string $instance

Name of the Instance resource to which the security policy should be set. The name should conform to RFC1035.

InstancesSetSecurityPolicyRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation setServiceAccount(string $project, string $zone, string $instance, InstancesSetServiceAccountRequest $postBody, array $optParams = [])

Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.

(instances.setServiceAccount)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance resource to start.

InstancesSetServiceAccountRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation setShieldedInstanceIntegrityPolicy(string $project, string $zone, string $instance, ShieldedInstanceIntegrityPolicy $postBody, array $optParams = [])

Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

(instances.setShieldedInstanceIntegrityPolicy)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name or id of the instance scoping this request.

ShieldedInstanceIntegrityPolicy $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation setTags(string $project, string $zone, string $instance, Tags $postBody, array $optParams = [])

Sets network tags for the specified instance to the data included in the request. (instances.setTags)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

Tags $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation simulateMaintenanceEvent(string $project, string $zone, string $instance, array $optParams = [])

Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event. (instances.simulateMaintenanceEvent)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation start(string $project, string $zone, string $instance, array $optParams = [])

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. (instances.start)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance resource to start.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation startWithEncryptionKey(string $project, string $zone, string $instance, InstancesStartWithEncryptionKeyRequest $postBody, array $optParams = [])

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. (instances.startWithEncryptionKey)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance resource to start.

InstancesStartWithEncryptionKeyRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation stop(string $project, string $zone, string $instance, array $optParams = [])

Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.

(instances.stop)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance resource to stop.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation suspend(string $project, string $zone, string $instance, array $optParams = [])

This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance. (instances.suspend)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance resource to suspend.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

TestPermissionsResponse testIamPermissions(string $project, string $zone, string $resource, TestPermissionsRequest $postBody, array $optParams = [])

Returns permissions that a caller has on the specified resource.

(instances.testIamPermissions)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $resource

Name or id of the resource for this request.

TestPermissionsRequest $postBody
array $optParams

Optional parameters.

Return Value

TestPermissionsResponse

Exceptions

Exception

Operation update(string $project, string $zone, string $instance, Instance $postBody, array $optParams = [])

Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.

(instances.update)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance resource to update.

Instance $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation updateAccessConfig(string $project, string $zone, string $instance, string $networkInterface, AccessConfig $postBody, array $optParams = [])

Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

(instances.updateAccessConfig)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

The instance name for this request.

string $networkInterface

The name of the network interface where the access config is attached.

AccessConfig $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation updateDisplayDevice(string $project, string $zone, string $instance, DisplayDevice $postBody, array $optParams = [])

Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. (instances.updateDisplayDevice)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name of the instance scoping this request.

DisplayDevice $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation updateNetworkInterface(string $project, string $zone, string $instance, string $networkInterface, NetworkInterface $postBody, array $optParams = [])

Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges.

See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics. (instances.updateNetworkInterface)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

The instance name for this request.

string $networkInterface

The name of the network interface to update.

NetworkInterface $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation updateShieldedInstanceConfig(string $project, string $zone, string $instance, ShieldedInstanceConfig $postBody, array $optParams = [])

Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

(instances.updateShieldedInstanceConfig)

Parameters

string $project

Project ID for this request.

string $zone

The name of the zone for this request.

string $instance

Name or id of the instance scoping this request.

ShieldedInstanceConfig $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception