Class v1.InstancesClient (3.1.2)

The Instances API. v1

Package

@google-cloud/compute

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Construct an instance of InstancesClient.

Parameter
NameDescription
opts ClientOptions

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

instancesStub

instancesStub?: Promise<{
        [name: string]: Function;
    }>;

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

addAccessConfig(request, options)

addAccessConfig(request?: protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The body resource for this request
   */
  // const accessConfigResource = {}
  /**
   *  The instance name for this request.
   */
  // const instance = 'abc123'
  /**
   *  The name of the network interface to add to this instance.
   */
  // const networkInterface = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callAddAccessConfig() {
    // Construct request
    const request = {
      accessConfigResource,
      instance,
      networkInterface,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.addAccessConfig(request);
    console.log(response);
  }

  callAddAccessConfig();

addAccessConfig(request, options, callback)

addAccessConfig(request: protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

addAccessConfig(request, callback)

addAccessConfig(request: protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

addResourcePolicies(request, options)

addResourcePolicies(request?: protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The instance name for this request.
   */
  // const instance = 'abc123'
  /**
   *  The body resource for this request
   */
  // const instancesAddResourcePoliciesRequestResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callAddResourcePolicies() {
    // Construct request
    const request = {
      instance,
      instancesAddResourcePoliciesRequestResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.addResourcePolicies(request);
    console.log(response);
  }

  callAddResourcePolicies();

addResourcePolicies(request, options, callback)

addResourcePolicies(request: protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

addResourcePolicies(request, callback)

addResourcePolicies(request: protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

aggregatedListAsync(request, options)

aggregatedListAsync(request?: protos.google.cloud.compute.v1.IAggregatedListInstancesRequest, options?: CallOptions): AsyncIterable<[
        string,
        protos.google.cloud.compute.v1.IInstancesScopedList
    ]>;

Equivalent to aggregatedList, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IAggregatedListInstancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<[ string, protos.google.cloud.compute.v1.IInstancesScopedList ]>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing as tuple [string, [InstancesScopedList]]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  A filter expression that filters resources listed in the response. The expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`,><=`, `="">=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
   */
  // const filter = 'abc123'
  /**
   *  Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included.
   */
  // const includeAllScopes = true
  /**
   *  The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
   */
  // const maxResults = 1234
  /**
   *  Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported.
   */
  // const orderBy = 'abc123'
  /**
   *  Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
   */
  // const pageToken = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  Opt-in for partial success behavior which provides partial results in case of failure. The default value is false.
   */
  // const returnPartialSuccess = true

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callAggregatedList() {
    // Construct request
    const request = {
      project,
    };

    // Run request
    const iterable = await computeClient.aggregatedListAsync(request);
    for await (const [key, value] of iterable) {
        console.log(response);
    }
  }

  callAggregatedList();

attachDisk(request, options)

attachDisk(request?: protos.google.cloud.compute.v1.IAttachDiskInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IAttachDiskInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The body resource for this request
   */
  // const attachedDiskResource = {}
  /**
   *  Whether to force attach the regional disk even if it's currently attached to another instance. If you try to force attach a zonal disk to an instance, you will receive an error.
   */
  // const forceAttach = true
  /**
   *  The instance name for this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callAttachDisk() {
    // Construct request
    const request = {
      attachedDiskResource,
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.attachDisk(request);
    console.log(response);
  }

  callAttachDisk();

attachDisk(request, options, callback)

attachDisk(request: protos.google.cloud.compute.v1.IAttachDiskInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAttachDiskInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IAttachDiskInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAttachDiskInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

attachDisk(request, callback)

attachDisk(request: protos.google.cloud.compute.v1.IAttachDiskInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAttachDiskInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IAttachDiskInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAttachDiskInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

bulkInsert(request, options)

bulkInsert(request?: protos.google.cloud.compute.v1.IBulkInsertInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Creates multiple instances. Count specifies the number of instances to create.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IBulkInsertInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The body resource for this request
   */
  // const bulkInsertInstanceResourceResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callBulkInsert() {
    // Construct request
    const request = {
      bulkInsertInstanceResourceResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.bulkInsert(request);
    console.log(response);
  }

  callBulkInsert();

bulkInsert(request, options, callback)

bulkInsert(request: protos.google.cloud.compute.v1.IBulkInsertInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IBulkInsertInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IBulkInsertInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IBulkInsertInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

bulkInsert(request, callback)

bulkInsert(request: protos.google.cloud.compute.v1.IBulkInsertInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IBulkInsertInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IBulkInsertInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IBulkInsertInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

delete(request, options)

delete(request?: protos.google.cloud.compute.v1.IDeleteInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.IDeleteInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance resource to delete.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callDelete() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.delete(request);
    console.log(response);
  }

  callDelete();

delete(request, options, callback)

delete(request: protos.google.cloud.compute.v1.IDeleteInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDeleteInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IDeleteInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDeleteInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

delete(request, callback)

delete(request: protos.google.cloud.compute.v1.IDeleteInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDeleteInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IDeleteInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDeleteInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteAccessConfig(request, options)

deleteAccessConfig(request?: protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the access config to delete.
   */
  // const accessConfig = 'abc123'
  /**
   *  The instance name for this request.
   */
  // const instance = 'abc123'
  /**
   *  The name of the network interface.
   */
  // const networkInterface = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callDeleteAccessConfig() {
    // Construct request
    const request = {
      accessConfig,
      instance,
      networkInterface,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.deleteAccessConfig(request);
    console.log(response);
  }

  callDeleteAccessConfig();

deleteAccessConfig(request, options, callback)

deleteAccessConfig(request: protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteAccessConfig(request, callback)

deleteAccessConfig(request: protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

detachDisk(request, options)

detachDisk(request?: protos.google.cloud.compute.v1.IDetachDiskInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Detaches a disk from an instance.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IDetachDiskInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The device name of the disk to detach. Make a get() request on the instance to view currently attached disks and device names.
   */
  // const deviceName = 'abc123'
  /**
   *  Instance name for this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callDetachDisk() {
    // Construct request
    const request = {
      deviceName,
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.detachDisk(request);
    console.log(response);
  }

  callDetachDisk();

detachDisk(request, options, callback)

detachDisk(request: protos.google.cloud.compute.v1.IDetachDiskInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDetachDiskInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IDetachDiskInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDetachDiskInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

detachDisk(request, callback)

detachDisk(request: protos.google.cloud.compute.v1.IDetachDiskInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDetachDiskInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IDetachDiskInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDetachDiskInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

get(request, options)

get(request?: protos.google.cloud.compute.v1.IGetInstanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IInstance,
        protos.google.cloud.compute.v1.IGetInstanceRequest | undefined,
        {} | undefined
    ]>;

Returns the specified Instance resource. Gets a list of available instances by making a list() request.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IInstance, protos.google.cloud.compute.v1.IGetInstanceRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Instance]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance resource to return.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callGet() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.get(request);
    console.log(response);
  }

  callGet();

get(request, options, callback)

get(request: protos.google.cloud.compute.v1.IGetInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IInstance, protos.google.cloud.compute.v1.IGetInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IInstance, protos.google.cloud.compute.v1.IGetInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

get(request, callback)

get(request: protos.google.cloud.compute.v1.IGetInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IInstance, protos.google.cloud.compute.v1.IGetInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IInstance, protos.google.cloud.compute.v1.IGetInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getEffectiveFirewalls(request, options)

getEffectiveFirewalls(request?: protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IInstancesGetEffectiveFirewallsResponse,
        (protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest | undefined),
        {} | undefined
    ]>;

Returns effective firewalls applied to an interface of the instance.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IInstancesGetEffectiveFirewallsResponse, (protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [InstancesGetEffectiveFirewallsResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  The name of the network interface to get the effective firewalls.
   */
  // const networkInterface = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callGetEffectiveFirewalls() {
    // Construct request
    const request = {
      instance,
      networkInterface,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.getEffectiveFirewalls(request);
    console.log(response);
  }

  callGetEffectiveFirewalls();

getEffectiveFirewalls(request, options, callback)

getEffectiveFirewalls(request: protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IInstancesGetEffectiveFirewallsResponse, protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IInstancesGetEffectiveFirewallsResponse, protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getEffectiveFirewalls(request, callback)

getEffectiveFirewalls(request: protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IInstancesGetEffectiveFirewallsResponse, protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IInstancesGetEffectiveFirewallsResponse, protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getGuestAttributes(request, options)

getGuestAttributes(request?: protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IGuestAttributes,
        (protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest | undefined),
        {} | undefined
    ]>;

Returns the specified guest attributes entry.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IGuestAttributes, (protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [GuestAttributes]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  Specifies the guest attributes path to be queried.
   */
  // const queryPath = 'abc123'
  /**
   *  Specifies the key for the guest attributes entry.
   */
  // const variableKey = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callGetGuestAttributes() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.getGuestAttributes(request);
    console.log(response);
  }

  callGetGuestAttributes();

getGuestAttributes(request, options, callback)

getGuestAttributes(request: protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IGuestAttributes, protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IGuestAttributes, protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getGuestAttributes(request, callback)

getGuestAttributes(request: protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IGuestAttributes, protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IGuestAttributes, protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getIamPolicy(request, options)

getIamPolicy(request?: protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IPolicy,
        protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Policy]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Requested IAM Policy version.
   */
  // const optionsRequestedPolicyVersion = 1234
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  Name or id of the resource for this request.
   */
  // const resource = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callGetIamPolicy() {
    // Construct request
    const request = {
      project,
      resource,
      zone,
    };

    // Run request
    const response = await computeClient.getIamPolicy(request);
    console.log(response);
  }

  callGetIamPolicy();

getIamPolicy(request, options, callback)

getIamPolicy(request: protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getIamPolicy(request, callback)

getIamPolicy(request: protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

getScreenshot(request, options)

getScreenshot(request?: protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IScreenshot,
        protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest | undefined,
        {} | undefined
    ]>;

Returns the screenshot from the specified instance.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IScreenshot, protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Screenshot]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callGetScreenshot() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.getScreenshot(request);
    console.log(response);
  }

  callGetScreenshot();

getScreenshot(request, options, callback)

getScreenshot(request: protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IScreenshot, protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IScreenshot, protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getScreenshot(request, callback)

getScreenshot(request: protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IScreenshot, protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IScreenshot, protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getSerialPortOutput(request, options)

getSerialPortOutput(request?: protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.ISerialPortOutput,
        (protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest | undefined),
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.ISerialPortOutput, (protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [SerialPortOutput]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance for this request.
   */
  // const instance = 'abc123'
  /**
   *  Specifies which COM or serial port to retrieve data from.
   */
  // const port = 1234
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  Specifies the starting byte position of the output to return. To start with the first byte of output to the specified port, omit this field or set it to `0`. If the output for that byte position is available, this field matches the `start` parameter sent with the request. If the amount of serial console output exceeds the size of the buffer (1 MB), the oldest output is discarded and is no longer available. If the requested start position refers to discarded output, the start position is adjusted to the oldest output still available, and the adjusted start position is returned as the `start` property value. You can also provide a negative start position, which translates to the most recent number of bytes written to the serial port. For example, -3 is interpreted as the most recent 3 bytes written to the serial console.
   */
  // const start = 1234
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callGetSerialPortOutput() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.getSerialPortOutput(request);
    console.log(response);
  }

  callGetSerialPortOutput();

getSerialPortOutput(request, options, callback)

getSerialPortOutput(request: protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.ISerialPortOutput, protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.ISerialPortOutput, protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getSerialPortOutput(request, callback)

getSerialPortOutput(request: protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.ISerialPortOutput, protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest
callback Callback<protos.google.cloud.compute.v1.ISerialPortOutput, protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getShieldedInstanceIdentity(request, options)

getShieldedInstanceIdentity(request?: protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IShieldedInstanceIdentity,
        (protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest | undefined),
        {} | undefined
    ]>;

Returns the Shielded Instance Identity of an instance

Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IShieldedInstanceIdentity, (protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [ShieldedInstanceIdentity]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name or id of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callGetShieldedInstanceIdentity() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.getShieldedInstanceIdentity(request);
    console.log(response);
  }

  callGetShieldedInstanceIdentity();

getShieldedInstanceIdentity(request, options, callback)

getShieldedInstanceIdentity(request: protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IShieldedInstanceIdentity, protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IShieldedInstanceIdentity, protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getShieldedInstanceIdentity(request, callback)

getShieldedInstanceIdentity(request: protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IShieldedInstanceIdentity, protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IShieldedInstanceIdentity, protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

insert(request, options)

insert(request?: protos.google.cloud.compute.v1.IInsertInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.IInsertInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The body resource for this request
   */
  // const instanceResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  Specifies instance template to create the instance. This field is optional. It can be a full or partial URL. For example, the following are all valid URLs to an instance template: - https://www.googleapis.com/compute/v1/projects/project /global/instanceTemplates/instanceTemplate - projects/project/global/instanceTemplates/instanceTemplate - global/instanceTemplates/instanceTemplate
   */
  // const sourceInstanceTemplate = 'abc123'
  /**
   *  Specifies the machine image to use to create the instance. This field is optional. It can be a full or partial URL. For example, the following are all valid URLs to a machine image: - https://www.googleapis.com/compute/v1/projects/project/global/global /machineImages/machineImage - projects/project/global/global/machineImages/machineImage - global/machineImages/machineImage
   */
  // const sourceMachineImage = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callInsert() {
    // Construct request
    const request = {
      instanceResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.insert(request);
    console.log(response);
  }

  callInsert();

insert(request, options, callback)

insert(request: protos.google.cloud.compute.v1.IInsertInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IInsertInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IInsertInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IInsertInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

insert(request, callback)

insert(request: protos.google.cloud.compute.v1.IInsertInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IInsertInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IInsertInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IInsertInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

list(request, options)

list(request?: protos.google.cloud.compute.v1.IListInstancesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IInstance[],
        protos.google.cloud.compute.v1.IListInstancesRequest | null,
        protos.google.cloud.compute.v1.IInstanceList
    ]>;

Retrieves the list of instances contained within the specified zone.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IListInstancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IInstance[], protos.google.cloud.compute.v1.IListInstancesRequest | null, protos.google.cloud.compute.v1.IInstanceList ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [Instance]. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

list(request, options, callback)

list(request: protos.google.cloud.compute.v1.IListInstancesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.compute.v1.IListInstancesRequest, protos.google.cloud.compute.v1.IInstanceList | null | undefined, protos.google.cloud.compute.v1.IInstance>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IListInstancesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.compute.v1.IListInstancesRequest, protos.google.cloud.compute.v1.IInstanceList | null | undefined, protos.google.cloud.compute.v1.IInstance>
Returns
TypeDescription
void

list(request, callback)

list(request: protos.google.cloud.compute.v1.IListInstancesRequest, callback: PaginationCallback<protos.google.cloud.compute.v1.IListInstancesRequest, protos.google.cloud.compute.v1.IInstanceList | null | undefined, protos.google.cloud.compute.v1.IInstance>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IListInstancesRequest
callback PaginationCallback<protos.google.cloud.compute.v1.IListInstancesRequest, protos.google.cloud.compute.v1.IInstanceList | null | undefined, protos.google.cloud.compute.v1.IInstance>
Returns
TypeDescription
void

listAsync(request, options)

listAsync(request?: protos.google.cloud.compute.v1.IListInstancesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.compute.v1.IInstance>;

Equivalent to list, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IListInstancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.compute.v1.IInstance>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [Instance]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  A filter expression that filters resources listed in the response. The expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`,><=`, `="">=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
   */
  // const filter = 'abc123'
  /**
   *  The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
   */
  // const maxResults = 1234
  /**
   *  Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported.
   */
  // const orderBy = 'abc123'
  /**
   *  Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
   */
  // const pageToken = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  Opt-in for partial success behavior which provides partial results in case of failure. The default value is false.
   */
  // const returnPartialSuccess = true
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callList() {
    // Construct request
    const request = {
      project,
      zone,
    };

    // Run request
    const iterable = await computeClient.listAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callList();

listReferrers(request, options)

listReferrers(request?: protos.google.cloud.compute.v1.IListReferrersInstancesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IReference[],
        protos.google.cloud.compute.v1.IListReferrersInstancesRequest | null,
        protos.google.cloud.compute.v1.IInstanceListReferrers
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IListReferrersInstancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IReference[], protos.google.cloud.compute.v1.IListReferrersInstancesRequest | null, protos.google.cloud.compute.v1.IInstanceListReferrers ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [Reference]. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listReferrersAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listReferrers(request, options, callback)

listReferrers(request: protos.google.cloud.compute.v1.IListReferrersInstancesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.compute.v1.IListReferrersInstancesRequest, protos.google.cloud.compute.v1.IInstanceListReferrers | null | undefined, protos.google.cloud.compute.v1.IReference>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IListReferrersInstancesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.compute.v1.IListReferrersInstancesRequest, protos.google.cloud.compute.v1.IInstanceListReferrers | null | undefined, protos.google.cloud.compute.v1.IReference>
Returns
TypeDescription
void

listReferrers(request, callback)

listReferrers(request: protos.google.cloud.compute.v1.IListReferrersInstancesRequest, callback: PaginationCallback<protos.google.cloud.compute.v1.IListReferrersInstancesRequest, protos.google.cloud.compute.v1.IInstanceListReferrers | null | undefined, protos.google.cloud.compute.v1.IReference>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IListReferrersInstancesRequest
callback PaginationCallback<protos.google.cloud.compute.v1.IListReferrersInstancesRequest, protos.google.cloud.compute.v1.IInstanceListReferrers | null | undefined, protos.google.cloud.compute.v1.IReference>
Returns
TypeDescription
void

listReferrersAsync(request, options)

listReferrersAsync(request?: protos.google.cloud.compute.v1.IListReferrersInstancesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.compute.v1.IReference>;

Equivalent to listReferrers, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IListReferrersInstancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.compute.v1.IReference>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [Reference]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  A filter expression that filters resources listed in the response. The expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`,><=`, `="">=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
   */
  // const filter = 'abc123'
  /**
   *  Name of the target instance scoping this request, or '-' if the request should span over all instances in the container.
   */
  // const instance = 'abc123'
  /**
   *  The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
   */
  // const maxResults = 1234
  /**
   *  Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported.
   */
  // const orderBy = 'abc123'
  /**
   *  Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
   */
  // const pageToken = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  Opt-in for partial success behavior which provides partial results in case of failure. The default value is false.
   */
  // const returnPartialSuccess = true
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callListReferrers() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const iterable = await computeClient.listReferrersAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListReferrers();

listReferrersStream(request, options)

listReferrersStream(request?: protos.google.cloud.compute.v1.IListReferrersInstancesRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IListReferrersInstancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [Reference] on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listReferrersAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listStream(request, options)

listStream(request?: protos.google.cloud.compute.v1.IListInstancesRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IListInstancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [Instance] on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

removeResourcePolicies(request, options)

removeResourcePolicies(request?: protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Removes resource policies from an instance.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The instance name for this request.
   */
  // const instance = 'abc123'
  /**
   *  The body resource for this request
   */
  // const instancesRemoveResourcePoliciesRequestResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callRemoveResourcePolicies() {
    // Construct request
    const request = {
      instance,
      instancesRemoveResourcePoliciesRequestResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.removeResourcePolicies(request);
    console.log(response);
  }

  callRemoveResourcePolicies();

removeResourcePolicies(request, options, callback)

removeResourcePolicies(request: protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

removeResourcePolicies(request, callback)

removeResourcePolicies(request: protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

reset(request, options)

reset(request?: protos.google.cloud.compute.v1.IResetInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IResetInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callReset() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.reset(request);
    console.log(response);
  }

  callReset();

reset(request, options, callback)

reset(request: protos.google.cloud.compute.v1.IResetInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IResetInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IResetInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IResetInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

reset(request, callback)

reset(request: protos.google.cloud.compute.v1.IResetInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IResetInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IResetInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IResetInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

resume(request, options)

resume(request?: protos.google.cloud.compute.v1.IResumeInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.IResumeInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance resource to resume.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callResume() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.resume(request);
    console.log(response);
  }

  callResume();

resume(request, options, callback)

resume(request: protos.google.cloud.compute.v1.IResumeInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IResumeInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IResumeInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IResumeInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

resume(request, callback)

resume(request: protos.google.cloud.compute.v1.IResumeInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IResumeInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IResumeInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IResumeInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

sendDiagnosticInterrupt(request, options)

sendDiagnosticInterrupt(request?: protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceResponse,
        (protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest | undefined),
        {} | undefined
    ]>;

Sends diagnostic interrupt to the instance.

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceResponse, (protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [SendDiagnosticInterruptInstanceResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSendDiagnosticInterrupt() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.sendDiagnosticInterrupt(request);
    console.log(response);
  }

  callSendDiagnosticInterrupt();

sendDiagnosticInterrupt(request, options, callback)

sendDiagnosticInterrupt(request: protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceResponse, protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceResponse, protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

sendDiagnosticInterrupt(request, callback)

sendDiagnosticInterrupt(request: protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceResponse, protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest
callback Callback<protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceResponse, protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setDeletionProtection(request, options)

setDeletionProtection(request?: protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Sets deletion protection on the instance.

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Whether the resource should be protected against deletion.
   */
  // const deletionProtection = true
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  Name or id of the resource for this request.
   */
  // const resource = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSetDeletionProtection() {
    // Construct request
    const request = {
      project,
      resource,
      zone,
    };

    // Run request
    const response = await computeClient.setDeletionProtection(request);
    console.log(response);
  }

  callSetDeletionProtection();

setDeletionProtection(request, options, callback)

setDeletionProtection(request: protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setDeletionProtection(request, callback)

setDeletionProtection(request: protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setDiskAutoDelete(request, options)

setDiskAutoDelete(request?: protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Whether to auto-delete the disk when the instance is deleted.
   */
  // const autoDelete = true
  /**
   *  The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names.
   */
  // const deviceName = 'abc123'
  /**
   *  The instance name for this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSetDiskAutoDelete() {
    // Construct request
    const request = {
      autoDelete,
      deviceName,
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.setDiskAutoDelete(request);
    console.log(response);
  }

  callSetDiskAutoDelete();

setDiskAutoDelete(request, options, callback)

setDiskAutoDelete(request: protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setDiskAutoDelete(request, callback)

setDiskAutoDelete(request: protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setIamPolicy(request, options)

setIamPolicy(request?: protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IPolicy,
        protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Policy]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  Name or id of the resource for this request.
   */
  // const resource = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'
  /**
   *  The body resource for this request
   */
  // const zoneSetPolicyRequestResource = {}

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSetIamPolicy() {
    // Construct request
    const request = {
      project,
      resource,
      zone,
      zoneSetPolicyRequestResource,
    };

    // Run request
    const response = await computeClient.setIamPolicy(request);
    console.log(response);
  }

  callSetIamPolicy();

setIamPolicy(request, options, callback)

setIamPolicy(request: protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setIamPolicy(request, callback)

setIamPolicy(request: protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setLabels(request, options)

setLabels(request?: protos.google.cloud.compute.v1.ISetLabelsInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetLabelsInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  The body resource for this request
   */
  // const instancesSetLabelsRequestResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSetLabels() {
    // Construct request
    const request = {
      instance,
      instancesSetLabelsRequestResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.setLabels(request);
    console.log(response);
  }

  callSetLabels();

setLabels(request, options, callback)

setLabels(request: protos.google.cloud.compute.v1.ISetLabelsInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetLabelsInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetLabelsInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetLabelsInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setLabels(request, callback)

setLabels(request: protos.google.cloud.compute.v1.ISetLabelsInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetLabelsInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetLabelsInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetLabelsInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setMachineResources(request, options)

setMachineResources(request?: protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  The body resource for this request
   */
  // const instancesSetMachineResourcesRequestResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSetMachineResources() {
    // Construct request
    const request = {
      instance,
      instancesSetMachineResourcesRequestResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.setMachineResources(request);
    console.log(response);
  }

  callSetMachineResources();

setMachineResources(request, options, callback)

setMachineResources(request: protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setMachineResources(request, callback)

setMachineResources(request: protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setMachineType(request, options)

setMachineType(request?: protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  The body resource for this request
   */
  // const instancesSetMachineTypeRequestResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSetMachineType() {
    // Construct request
    const request = {
      instance,
      instancesSetMachineTypeRequestResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.setMachineType(request);
    console.log(response);
  }

  callSetMachineType();

setMachineType(request, options, callback)

setMachineType(request: protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setMachineType(request, callback)

setMachineType(request: protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setMetadata(request, options)

setMetadata(request?: protos.google.cloud.compute.v1.ISetMetadataInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetMetadataInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  The body resource for this request
   */
  // const metadataResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSetMetadata() {
    // Construct request
    const request = {
      instance,
      metadataResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.setMetadata(request);
    console.log(response);
  }

  callSetMetadata();

setMetadata(request, options, callback)

setMetadata(request: protos.google.cloud.compute.v1.ISetMetadataInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMetadataInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetMetadataInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMetadataInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setMetadata(request, callback)

setMetadata(request: protos.google.cloud.compute.v1.ISetMetadataInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMetadataInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetMetadataInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMetadataInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setMinCpuPlatform(request, options)

setMinCpuPlatform(request?: protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  The body resource for this request
   */
  // const instancesSetMinCpuPlatformRequestResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSetMinCpuPlatform() {
    // Construct request
    const request = {
      instance,
      instancesSetMinCpuPlatformRequestResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.setMinCpuPlatform(request);
    console.log(response);
  }

  callSetMinCpuPlatform();

setMinCpuPlatform(request, options, callback)

setMinCpuPlatform(request: protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setMinCpuPlatform(request, callback)

setMinCpuPlatform(request: protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setScheduling(request, options)

setScheduling(request?: protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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 availability policies.

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Instance name for this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The body resource for this request
   */
  // const schedulingResource = {}
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSetScheduling() {
    // Construct request
    const request = {
      instance,
      project,
      schedulingResource,
      zone,
    };

    // Run request
    const response = await computeClient.setScheduling(request);
    console.log(response);
  }

  callSetScheduling();

setScheduling(request, options, callback)

setScheduling(request: protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setScheduling(request, callback)

setScheduling(request: protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setServiceAccount(request, options)

setServiceAccount(request?: protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance resource to start.
   */
  // const instance = 'abc123'
  /**
   *  The body resource for this request
   */
  // const instancesSetServiceAccountRequestResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSetServiceAccount() {
    // Construct request
    const request = {
      instance,
      instancesSetServiceAccountRequestResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.setServiceAccount(request);
    console.log(response);
  }

  callSetServiceAccount();

setServiceAccount(request, options, callback)

setServiceAccount(request: protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setServiceAccount(request, callback)

setServiceAccount(request: protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setShieldedInstanceIntegrityPolicy(request, options)

setShieldedInstanceIntegrityPolicy(request?: protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name or id of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The body resource for this request
   */
  // const shieldedInstanceIntegrityPolicyResource = {}
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSetShieldedInstanceIntegrityPolicy() {
    // Construct request
    const request = {
      instance,
      project,
      shieldedInstanceIntegrityPolicyResource,
      zone,
    };

    // Run request
    const response = await computeClient.setShieldedInstanceIntegrityPolicy(request);
    console.log(response);
  }

  callSetShieldedInstanceIntegrityPolicy();

setShieldedInstanceIntegrityPolicy(request, options, callback)

setShieldedInstanceIntegrityPolicy(request: protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setShieldedInstanceIntegrityPolicy(request, callback)

setShieldedInstanceIntegrityPolicy(request: protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setTags(request, options)

setTags(request?: protos.google.cloud.compute.v1.ISetTagsInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetTagsInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The body resource for this request
   */
  // const tagsResource = {}
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSetTags() {
    // Construct request
    const request = {
      instance,
      project,
      tagsResource,
      zone,
    };

    // Run request
    const response = await computeClient.setTags(request);
    console.log(response);
  }

  callSetTags();

setTags(request, options, callback)

setTags(request: protos.google.cloud.compute.v1.ISetTagsInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetTagsInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetTagsInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetTagsInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setTags(request, callback)

setTags(request: protos.google.cloud.compute.v1.ISetTagsInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetTagsInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetTagsInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetTagsInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

simulateMaintenanceEvent(request, options)

simulateMaintenanceEvent(request?: protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSimulateMaintenanceEvent() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.simulateMaintenanceEvent(request);
    console.log(response);
  }

  callSimulateMaintenanceEvent();

simulateMaintenanceEvent(request, options, callback)

simulateMaintenanceEvent(request: protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

simulateMaintenanceEvent(request, callback)

simulateMaintenanceEvent(request: protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

start(request, options)

start(request?: protos.google.cloud.compute.v1.IStartInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.IStartInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance resource to start.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callStart() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.start(request);
    console.log(response);
  }

  callStart();

start(request, options, callback)

start(request: protos.google.cloud.compute.v1.IStartInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IStartInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IStartInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IStartInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

start(request, callback)

start(request: protos.google.cloud.compute.v1.IStartInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IStartInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IStartInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IStartInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

startWithEncryptionKey(request, options)

startWithEncryptionKey(request?: protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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

Parameters
NameDescription
request protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance resource to start.
   */
  // const instance = 'abc123'
  /**
   *  The body resource for this request
   */
  // const instancesStartWithEncryptionKeyRequestResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callStartWithEncryptionKey() {
    // Construct request
    const request = {
      instance,
      instancesStartWithEncryptionKeyRequestResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.startWithEncryptionKey(request);
    console.log(response);
  }

  callStartWithEncryptionKey();

startWithEncryptionKey(request, options, callback)

startWithEncryptionKey(request: protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

startWithEncryptionKey(request, callback)

startWithEncryptionKey(request: protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

stop(request, options)

stop(request?: protos.google.cloud.compute.v1.IStopInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IStopInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance resource to stop.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callStop() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.stop(request);
    console.log(response);
  }

  callStop();

stop(request, options, callback)

stop(request: protos.google.cloud.compute.v1.IStopInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IStopInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IStopInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IStopInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

stop(request, callback)

stop(request: protos.google.cloud.compute.v1.IStopInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IStopInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IStopInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IStopInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

suspend(request, options)

suspend(request?: protos.google.cloud.compute.v1.ISuspendInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISuspendInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance resource to suspend.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callSuspend() {
    // Construct request
    const request = {
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.suspend(request);
    console.log(response);
  }

  callSuspend();

suspend(request, options, callback)

suspend(request: protos.google.cloud.compute.v1.ISuspendInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISuspendInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISuspendInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISuspendInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

suspend(request, callback)

suspend(request: protos.google.cloud.compute.v1.ISuspendInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISuspendInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISuspendInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISuspendInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

testIamPermissions(request, options)

testIamPermissions(request?: protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.ITestPermissionsResponse,
        (protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest | undefined),
        {} | undefined
    ]>;

Returns permissions that a caller has on the specified resource.

Parameters
NameDescription
request protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.ITestPermissionsResponse, (protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [TestPermissionsResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  Name or id of the resource for this request.
   */
  // const resource = 'abc123'
  /**
   *  The body resource for this request
   */
  // const testPermissionsRequestResource = {}
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callTestIamPermissions() {
    // Construct request
    const request = {
      project,
      resource,
      testPermissionsRequestResource,
      zone,
    };

    // Run request
    const response = await computeClient.testIamPermissions(request);
    console.log(response);
  }

  callTestIamPermissions();

testIamPermissions(request, options, callback)

testIamPermissions(request: protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.ITestPermissionsResponse, protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.ITestPermissionsResponse, protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

testIamPermissions(request, callback)

testIamPermissions(request: protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.ITestPermissionsResponse, protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest
callback Callback<protos.google.cloud.compute.v1.ITestPermissionsResponse, protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

update(request, options)

update(request?: protos.google.cloud.compute.v1.IUpdateInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the instance resource to update.
   */
  // const instance = 'abc123'
  /**
   *  The body resource for this request
   */
  // const instanceResource = {}
  /**
   *  Specifies the action to take when updating an instance even if the updated properties do not require it. If not specified, then Compute Engine acts based on the minimum action that the updated properties require.
   */
  // const minimalAction = 'abc123'
  /**
   *  Specifies the most disruptive action that can be taken on the instance as part of the update. Compute Engine returns an error if the instance properties require a more disruptive action as part of the instance update. Valid options from lowest to highest are NO_EFFECT, REFRESH, and RESTART.
   */
  // const mostDisruptiveAllowedAction = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callUpdate() {
    // Construct request
    const request = {
      instance,
      instanceResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.update(request);
    console.log(response);
  }

  callUpdate();

update(request, options, callback)

update(request: protos.google.cloud.compute.v1.IUpdateInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

update(request, callback)

update(request: protos.google.cloud.compute.v1.IUpdateInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateAccessConfig(request, options)

updateAccessConfig(request?: protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The body resource for this request
   */
  // const accessConfigResource = {}
  /**
   *  The instance name for this request.
   */
  // const instance = 'abc123'
  /**
   *  The name of the network interface where the access config is attached.
   */
  // const networkInterface = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callUpdateAccessConfig() {
    // Construct request
    const request = {
      accessConfigResource,
      instance,
      networkInterface,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.updateAccessConfig(request);
    console.log(response);
  }

  callUpdateAccessConfig();

updateAccessConfig(request, options, callback)

updateAccessConfig(request: protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateAccessConfig(request, callback)

updateAccessConfig(request: protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateDisplayDevice(request, options)

updateDisplayDevice(request?: protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The body resource for this request
   */
  // const displayDeviceResource = {}
  /**
   *  Name of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callUpdateDisplayDevice() {
    // Construct request
    const request = {
      displayDeviceResource,
      instance,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.updateDisplayDevice(request);
    console.log(response);
  }

  callUpdateDisplayDevice();

updateDisplayDevice(request, options, callback)

updateDisplayDevice(request: protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateDisplayDevice(request, callback)

updateDisplayDevice(request: protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateNetworkInterface(request, options)

updateNetworkInterface(request?: protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The instance name for this request.
   */
  // const instance = 'abc123'
  /**
   *  The name of the network interface to update.
   */
  // const networkInterface = 'abc123'
  /**
   *  The body resource for this request
   */
  // const networkInterfaceResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callUpdateNetworkInterface() {
    // Construct request
    const request = {
      instance,
      networkInterface,
      networkInterfaceResource,
      project,
      zone,
    };

    // Run request
    const response = await computeClient.updateNetworkInterface(request);
    console.log(response);
  }

  callUpdateNetworkInterface();

updateNetworkInterface(request, options, callback)

updateNetworkInterface(request: protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateNetworkInterface(request, callback)

updateNetworkInterface(request: protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateShieldedInstanceConfig(request, options)

updateShieldedInstanceConfig(request?: protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

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.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name or id of the instance scoping this request.
   */
  // const instance = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The body resource for this request
   */
  // const shieldedInstanceConfigResource = {}
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

  // Imports the Compute library
  const {InstancesClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new InstancesClient();

  async function callUpdateShieldedInstanceConfig() {
    // Construct request
    const request = {
      instance,
      project,
      shieldedInstanceConfigResource,
      zone,
    };

    // Run request
    const response = await computeClient.updateShieldedInstanceConfig(request);
    console.log(response);
  }

  callUpdateShieldedInstanceConfig();

updateShieldedInstanceConfig(request, options, callback)

updateShieldedInstanceConfig(request: protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateShieldedInstanceConfig(request, callback)

updateShieldedInstanceConfig(request: protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void