Compute V1 Client - Class InstancesClient (1.21.0)

Reference documentation and code samples for the Compute V1 Client class InstancesClient.

Service Description: The Instances API.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods.

Namespace

Google \ Cloud \ Compute \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport string|TransportInterface

The transport used for executing network requests. At the moment, supports only rest. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'rest' => [...], ]; See the Google\ApiCore\Transport\RestTransport::build() method for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

addAccessConfig

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

The async variant is InstancesClient::addAccessConfigAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\AddAccessConfigInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

addResourcePolicies

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.

The async variant is InstancesClient::addResourcePoliciesAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\AddResourcePoliciesInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

aggregatedList

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.

The async variant is InstancesClient::aggregatedListAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\AggregatedListInstancesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse

attachDisk

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.

The async variant is InstancesClient::attachDiskAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\AttachDiskInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

bulkInsert

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

The async variant is InstancesClient::bulkInsertAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\BulkInsertInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

delete

Deletes the specified Instance resource. For more information, see Deleting an instance.

The async variant is InstancesClient::deleteAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\DeleteInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

deleteAccessConfig

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

The async variant is InstancesClient::deleteAccessConfigAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\DeleteAccessConfigInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

detachDisk

Detaches a disk from an instance.

The async variant is InstancesClient::detachDiskAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\DetachDiskInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

get

Returns the specified Instance resource.

The async variant is InstancesClient::getAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\GetInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Compute\V1\Instance

getEffectiveFirewalls

Returns effective firewalls applied to an interface of the instance.

The async variant is InstancesClient::getEffectiveFirewallsAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\GetEffectiveFirewallsInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Compute\V1\InstancesGetEffectiveFirewallsResponse

getGuestAttributes

Returns the specified guest attributes entry.

The async variant is InstancesClient::getGuestAttributesAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\GetGuestAttributesInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Compute\V1\GuestAttributes

getIamPolicy

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

The async variant is InstancesClient::getIamPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\GetIamPolicyInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Compute\V1\Policy

getScreenshot

Returns the screenshot from the specified instance.

The async variant is InstancesClient::getScreenshotAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\GetScreenshotInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Compute\V1\Screenshot

getSerialPortOutput

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

The async variant is InstancesClient::getSerialPortOutputAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\GetSerialPortOutputInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Compute\V1\SerialPortOutput

getShieldedInstanceIdentity

Returns the Shielded Instance Identity of an instance

The async variant is InstancesClient::getShieldedInstanceIdentityAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\GetShieldedInstanceIdentityInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Compute\V1\ShieldedInstanceIdentity

insert

Creates an instance resource in the specified project using the data included in the request.

The async variant is InstancesClient::insertAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\InsertInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

list

Retrieves the list of instances contained within the specified zone.

The async variant is InstancesClient::listAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\ListInstancesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse

listReferrers

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.

The async variant is InstancesClient::listReferrersAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\ListReferrersInstancesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse

performMaintenance

Perform a manual maintenance on the instance.

The async variant is InstancesClient::performMaintenanceAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\PerformMaintenanceInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

removeResourcePolicies

Removes resource policies from an instance.

The async variant is InstancesClient::removeResourcePoliciesAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\RemoveResourcePoliciesInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

reset

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.

The async variant is InstancesClient::resetAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\ResetInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

resume

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

The async variant is InstancesClient::resumeAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\ResumeInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

sendDiagnosticInterrupt

Sends diagnostic interrupt to the instance.

The async variant is InstancesClient::sendDiagnosticInterruptAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SendDiagnosticInterruptInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Compute\V1\SendDiagnosticInterruptInstanceResponse

setDeletionProtection

Sets deletion protection on the instance.

The async variant is InstancesClient::setDeletionProtectionAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetDeletionProtectionInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

setDiskAutoDelete

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

The async variant is InstancesClient::setDiskAutoDeleteAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetDiskAutoDeleteInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

setIamPolicy

Sets the access control policy on the specified resource. Replaces any existing policy.

The async variant is InstancesClient::setIamPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetIamPolicyInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Compute\V1\Policy

setLabels

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

The async variant is InstancesClient::setLabelsAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetLabelsInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

setMachineResources

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

The async variant is InstancesClient::setMachineResourcesAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetMachineResourcesInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

setMachineType

Changes the machine type for a stopped instance to the machine type specified in the request.

The async variant is InstancesClient::setMachineTypeAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetMachineTypeInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

setMetadata

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

The async variant is InstancesClient::setMetadataAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetMetadataInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

setMinCpuPlatform

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.

The async variant is InstancesClient::setMinCpuPlatformAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetMinCpuPlatformInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

setName

Sets name of an instance.

The async variant is InstancesClient::setNameAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetNameInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

setScheduling

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.

The async variant is InstancesClient::setSchedulingAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetSchedulingInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

setSecurityPolicy

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

The async variant is InstancesClient::setSecurityPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetSecurityPolicyInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

setServiceAccount

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

The async variant is InstancesClient::setServiceAccountAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetServiceAccountInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

setShieldedInstanceIntegrityPolicy

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.

The async variant is InstancesClient::setShieldedInstanceIntegrityPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetShieldedInstanceIntegrityPolicyInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

setTags

Sets network tags for the specified instance to the data included in the request.

The async variant is InstancesClient::setTagsAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SetTagsInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

simulateMaintenanceEvent

Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.

The async variant is InstancesClient::simulateMaintenanceEventAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SimulateMaintenanceEventInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

start

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

The async variant is InstancesClient::startAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\StartInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

startWithEncryptionKey

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

The async variant is InstancesClient::startWithEncryptionKeyAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\StartWithEncryptionKeyInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

stop

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.

The async variant is InstancesClient::stopAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\StopInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

suspend

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.

The async variant is InstancesClient::suspendAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\SuspendInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

testIamPermissions

Returns permissions that a caller has on the specified resource.

The async variant is InstancesClient::testIamPermissionsAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\TestIamPermissionsInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Compute\V1\TestPermissionsResponse

update

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.

The async variant is InstancesClient::updateAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\UpdateInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

updateAccessConfig

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.

The async variant is InstancesClient::updateAccessConfigAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\UpdateAccessConfigInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

updateDisplayDevice

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.

The async variant is InstancesClient::updateDisplayDeviceAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\UpdateDisplayDeviceInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

updateNetworkInterface

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.

The async variant is InstancesClient::updateNetworkInterfaceAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\UpdateNetworkInterfaceInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

updateShieldedInstanceConfig

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.

The async variant is InstancesClient::updateShieldedInstanceConfigAsync() .

Parameters
Name Description
request Google\Cloud\Compute\V1\UpdateShieldedInstanceConfigInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse

addAccessConfigAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\AddAccessConfigInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

addResourcePoliciesAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\AddResourcePoliciesInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

aggregatedListAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\AggregatedListInstancesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

attachDiskAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\AttachDiskInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

bulkInsertAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\BulkInsertInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\DeleteInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteAccessConfigAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\DeleteAccessConfigInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

detachDiskAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\DetachDiskInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

getAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\GetInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\Instance>

getEffectiveFirewallsAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\GetEffectiveFirewallsInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\InstancesGetEffectiveFirewallsResponse>

getGuestAttributesAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\GetGuestAttributesInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\GuestAttributes>

getIamPolicyAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\GetIamPolicyInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\Policy>

getScreenshotAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\GetScreenshotInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\Screenshot>

getSerialPortOutputAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\GetSerialPortOutputInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\SerialPortOutput>

getShieldedInstanceIdentityAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\GetShieldedInstanceIdentityInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\ShieldedInstanceIdentity>

insertAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\InsertInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

listAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\ListInstancesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listReferrersAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\ListReferrersInstancesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

performMaintenanceAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\PerformMaintenanceInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

removeResourcePoliciesAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\RemoveResourcePoliciesInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

resetAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\ResetInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

resumeAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\ResumeInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

sendDiagnosticInterruptAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SendDiagnosticInterruptInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\SendDiagnosticInterruptInstanceResponse>

setDeletionProtectionAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetDeletionProtectionInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setDiskAutoDeleteAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetDiskAutoDeleteInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setIamPolicyAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetIamPolicyInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\Policy>

setLabelsAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetLabelsInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setMachineResourcesAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetMachineResourcesInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setMachineTypeAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetMachineTypeInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setMetadataAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetMetadataInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setMinCpuPlatformAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetMinCpuPlatformInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setNameAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetNameInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setSchedulingAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetSchedulingInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setSecurityPolicyAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetSecurityPolicyInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setServiceAccountAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetServiceAccountInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setShieldedInstanceIntegrityPolicyAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetShieldedInstanceIntegrityPolicyInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

setTagsAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SetTagsInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

simulateMaintenanceEventAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SimulateMaintenanceEventInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

startAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\StartInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

startWithEncryptionKeyAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\StartWithEncryptionKeyInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

stopAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\StopInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

suspendAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\SuspendInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

testIamPermissionsAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\TestIamPermissionsInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\TestPermissionsResponse>

updateAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\UpdateInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateAccessConfigAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\UpdateAccessConfigInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateDisplayDeviceAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\UpdateDisplayDeviceInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateNetworkInterfaceAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\UpdateNetworkInterfaceInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateShieldedInstanceConfigAsync

Parameters
Name Description
request Google\Cloud\Compute\V1\UpdateShieldedInstanceConfigInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

getOperationsClient

Return an ZoneOperationsClient object with the same endpoint as $this.

Returns
Type Description
Google\Cloud\Compute\V1\ZoneOperationsClient

resumeOperation

Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.

Parameters
Name Description
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
Type Description
Google\ApiCore\OperationResponse