Instances
class Instances extends Resource (View source)
The "instances" collection of methods.
Typical usage is:
$computeService = new Google\Service\Compute(...);
$instances = $computeService->instances;
Methods
Adds an access config to an instance's network interface.
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)
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)
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)
Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.
Deletes the specified Instance resource. For more information, see Deleting an instance. (instances.delete)
Deletes an access config from an instance's network interface.
Detaches a disk from an instance. (instances.detachDisk)
Returns the specified Instance resource. (instances.get)
Returns effective firewalls applied to an interface of the instance.
Returns the specified guest attributes entry. (instances.getGuestAttributes)
Gets the access control policy for a resource. May be empty if no such policy or resource exists. (instances.getIamPolicy)
Returns the screenshot from the specified instance. (instances.getScreenshot)
Returns the last 1 MB of serial port output from the specified instance.
Returns the Shielded Instance Identity of an instance (instances.getShieldedInstanceIdentity)
Retrieves the list of instances contained within the specified zone.
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.
Perform a manual maintenance on the instance. (instances.performMaintenance)
Removes resource policies from an instance.
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.
Resumes an instance that was suspended using the instances().suspend method.
Sends diagnostic interrupt to the instance.
Sets deletion protection on the instance. (instances.setDeletionProtection)
Sets the auto-delete flag for a disk attached to an instance.
Sets the access control policy on the specified resource. Replaces any existing policy. (instances.setIamPolicy)
Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation. (instances.setLabels)
Changes the number and/or type of accelerator for a stopped instance to the values specified in the request. (instances.setMachineResources)
Changes the machine type for a stopped instance to the machine type specified in the request. (instances.setMachineType)
Sets metadata for the specified instance to the data included in the request.
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)
Sets name of an instance. (instances.setName)
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)
Sets the Google Cloud Armor security policy for the specified instance. For more information, see Google Cloud Armor Overview (instances.setSecurityPolicy)
Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
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.
Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event. (instances.simulateMaintenanceEvent)
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. (instances.start)
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. (instances.startWithEncryptionKey)
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.
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)
Returns permissions that a caller has on the specified resource.
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.
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.
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)
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.
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)
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)
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)
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)
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)
Operation
delete(string $project, string $zone, string $instance, array $optParams = [])
Deletes the specified Instance resource. For more information, see Deleting an instance. (instances.delete)
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)
Operation
detachDisk(string $project, string $zone, string $instance, string $deviceName, array $optParams = [])
Detaches a disk from an instance. (instances.detachDisk)
Instance
get(string $project, string $zone, string $instance, array $optParams = [])
Returns the specified Instance resource. (instances.get)
InstancesGetEffectiveFirewallsResponse
getEffectiveFirewalls(string $project, string $zone, string $instance, string $networkInterface, array $optParams = [])
Returns effective firewalls applied to an interface of the instance.
(instances.getEffectiveFirewalls)
GuestAttributes
getGuestAttributes(string $project, string $zone, string $instance, array $optParams = [])
Returns the specified guest attributes entry. (instances.getGuestAttributes)
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)
Screenshot
getScreenshot(string $project, string $zone, string $instance, array $optParams = [])
Returns the screenshot from the specified instance. (instances.getScreenshot)
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)
ShieldedInstanceIdentity
getShieldedInstanceIdentity(string $project, string $zone, string $instance, array $optParams = [])
Returns the Shielded Instance Identity of an instance (instances.getShieldedInstanceIdentity)
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)
InstanceList
listInstances(string $project, string $zone, array $optParams = [])
Retrieves the list of instances contained within the specified zone.
(instances.listInstances)
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)
Operation
performMaintenance(string $project, string $zone, string $instance, array $optParams = [])
Perform a manual maintenance on the instance. (instances.performMaintenance)
Operation
removeResourcePolicies(string $project, string $zone, string $instance, InstancesRemoveResourcePoliciesRequest $postBody, array $optParams = [])
Removes resource policies from an instance.
(instances.removeResourcePolicies)
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)
Operation
resume(string $project, string $zone, string $instance, array $optParams = [])
Resumes an instance that was suspended using the instances().suspend method.
(instances.resume)
sendDiagnosticInterrupt(string $project, string $zone, string $instance, array $optParams = [])
Sends diagnostic interrupt to the instance.
(instances.sendDiagnosticInterrupt)
Operation
setDeletionProtection(string $project, string $zone, string $resource, array $optParams = [])
Sets deletion protection on the instance. (instances.setDeletionProtection)
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)
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)
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)
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)
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)
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)
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)
Operation
setName(string $project, string $zone, string $instance, InstancesSetNameRequest $postBody, array $optParams = [])
Sets name of an instance. (instances.setName)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
TestPermissionsResponse
testIamPermissions(string $project, string $zone, string $resource, TestPermissionsRequest $postBody, array $optParams = [])
Returns permissions that a caller has on the specified resource.
(instances.testIamPermissions)
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)
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)
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)
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)
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)