Class v1.DisksClient (4.3.0)

The Disks API. v1

Package

@google-cloud/compute

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of DisksClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new DisksClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

disksStub

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

innerApiCalls

innerApiCalls: {
        [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.

universeDomain

get universeDomain(): string;

warn

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

Methods

addResourcePolicies(request, options)

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

Adds existing resource policies to a disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation.

Parameters
NameDescription
request IAddResourcePoliciesDiskRequest

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 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The disk name for this request.
   */
  // const disk = 'abc123'
  /**
   *  The body resource for this request
   */
  // const disksAddResourcePoliciesRequestResource = {}
  /**
   *  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 {DisksClient} = require('@google-cloud/compute').v1;

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

  async function callAddResourcePolicies() {
    // Construct request
    const request = {
      disk,
      disksAddResourcePoliciesRequestResource,
      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.IAddResourcePoliciesDiskRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAddResourcePoliciesDiskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IAddResourcePoliciesDiskRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IAddResourcePoliciesDiskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

addResourcePolicies(request, callback)

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

aggregatedListAsync(request, options)

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

Retrieves an aggregated list of persistent disks. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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

Parameters
NameDescription
request IAggregatedListDisksRequest

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.IDisksScopedList]>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing as tuple [string, DisksScopedList]. 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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your 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 `:*` 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) 
If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.

/ // 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. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. / // const returnPartialSuccess = true /*
  • The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. */ // const serviceProjectNumber = 1234

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

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

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

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

    callAggregatedList();

bulkInsert(request, options)

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

Bulk create a set of disks.

Parameters
NameDescription
request IBulkInsertDiskRequest

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 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The body resource for this request
   */
  // const bulkInsertDiskResourceResource = {}
  /**
   *  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 {DisksClient} = require('@google-cloud/compute').v1;

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

  async function callBulkInsert() {
    // Construct request
    const request = {
      bulkInsertDiskResourceResource,
      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.IBulkInsertDiskRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IBulkInsertDiskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IBulkInsertDiskRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IBulkInsertDiskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

bulkInsert(request, callback)

bulkInsert(request: protos.google.cloud.compute.v1.IBulkInsertDiskRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IBulkInsertDiskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IBulkInsertDiskRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IBulkInsertDiskRequest | 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.

createSnapshot(request, options)

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

Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project.

Parameters
NameDescription
request ICreateSnapshotDiskRequest

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 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the persistent disk to snapshot.
   */
  // const disk = 'abc123'
  /**
   *  Input Only  Whether to attempt an application consistent snapshot by informing the OS to prepare for the snapshot process.
   */
  // const guestFlush = 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'
  /**
   *  The body resource for this request
   */
  // const snapshotResource = {}
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

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

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

  async function callCreateSnapshot() {
    // Construct request
    const request = {
      disk,
      project,
      snapshotResource,
      zone,
    };

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

  callCreateSnapshot();

createSnapshot(request, options, callback)

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

createSnapshot(request, callback)

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

delete(request, options)

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

Deletes the specified persistent disk. Deleting a disk removes its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots.

Parameters
NameDescription
request IDeleteDiskRequest

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 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the persistent disk to delete.
   */
  // const disk = '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 {DisksClient} = require('@google-cloud/compute').v1;

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

  async function callDelete() {
    // Construct request
    const request = {
      disk,
      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.IDeleteDiskRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDeleteDiskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IDeleteDiskRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDeleteDiskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

delete(request, callback)

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

get(request, options)

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

Returns the specified persistent disk.

Parameters
NameDescription
request IGetDiskRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Name of the persistent disk to return.
   */
  // const disk = '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 {DisksClient} = require('@google-cloud/compute').v1;

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

  async function callGet() {
    // Construct request
    const request = {
      disk,
      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.IGetDiskRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IDisk, protos.google.cloud.compute.v1.IGetDiskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetDiskRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IDisk, protos.google.cloud.compute.v1.IGetDiskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

get(request, callback)

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

getIamPolicy(request, options)

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

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

Parameters
NameDescription
request IGetIamPolicyDiskRequest

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.IGetIamPolicyDiskRequest | 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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * 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 {DisksClient} = require('@google-cloud/compute').v1;

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

  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.IGetIamPolicyDiskRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.IGetIamPolicyDiskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetIamPolicyDiskRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.IGetIamPolicyDiskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getIamPolicy(request, callback)

getIamPolicy(request: protos.google.cloud.compute.v1.IGetIamPolicyDiskRequest, callback: Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.IGetIamPolicyDiskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetIamPolicyDiskRequest
callback Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.IGetIamPolicyDiskRequest | 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

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.IInsertDiskRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Creates a persistent disk in the specified project using the data in the request. You can create a disk from a source (sourceImage, sourceSnapshot, or sourceDisk) or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property.

Parameters
NameDescription
request IInsertDiskRequest

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 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The body resource for this request
   */
  // const diskResource = {}
  /**
   *  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'
  /**
   *  Source image to restore onto a disk. This field is optional.
   */
  // const sourceImage = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

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

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

  async function callInsert() {
    // Construct request
    const request = {
      diskResource,
      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.IInsertDiskRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IInsertDiskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IInsertDiskRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IInsertDiskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

insert(request, callback)

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

list(request, options)

list(request?: protos.google.cloud.compute.v1.IListDisksRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IDisk[],
        protos.google.cloud.compute.v1.IListDisksRequest | null,
        protos.google.cloud.compute.v1.IDiskList
    ]>;

Retrieves a list of persistent disks contained within the specified zone.

Parameters
NameDescription
request IListDisksRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IDisk[], protos.google.cloud.compute.v1.IListDisksRequest | null, protos.google.cloud.compute.v1.IDiskList ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . 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 for more details and examples.

list(request, options, callback)

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

list(request, callback)

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

listAsync(request, options)

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

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 IListDisksRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your 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 `:*` 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) 
If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.

/ // 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. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. / // const returnPartialSuccess = true /*
  • The name of the zone for this request. */ // const zone = 'abc123'

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

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

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

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

    callList();

listStream(request, options)

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

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

Parameters
NameDescription
request IListDisksRequest

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 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 for more details and examples.

removeResourcePolicies(request, options)

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

Removes resource policies from a disk.

Parameters
NameDescription
request IRemoveResourcePoliciesDiskRequest

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 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The disk name for this request.
   */
  // const disk = 'abc123'
  /**
   *  The body resource for this request
   */
  // const disksRemoveResourcePoliciesRequestResource = {}
  /**
   *  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 {DisksClient} = require('@google-cloud/compute').v1;

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

  async function callRemoveResourcePolicies() {
    // Construct request
    const request = {
      disk,
      disksRemoveResourcePoliciesRequestResource,
      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.IRemoveResourcePoliciesDiskRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IRemoveResourcePoliciesDiskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IRemoveResourcePoliciesDiskRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IRemoveResourcePoliciesDiskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

removeResourcePolicies(request, callback)

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

resize(request, options)

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

Resizes the specified persistent disk. You can only increase the size of the disk.

Parameters
NameDescription
request IResizeDiskRequest

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 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the persistent disk.
   */
  // const disk = 'abc123'
  /**
   *  The body resource for this request
   */
  // const disksResizeRequestResource = {}
  /**
   *  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 {DisksClient} = require('@google-cloud/compute').v1;

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

  async function callResize() {
    // Construct request
    const request = {
      disk,
      disksResizeRequestResource,
      project,
      zone,
    };

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

  callResize();

resize(request, options, callback)

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

resize(request, callback)

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

setIamPolicy(request, options)

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

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

Parameters
NameDescription
request ISetIamPolicyDiskRequest

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.ISetIamPolicyDiskRequest | 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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * 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 {DisksClient} = require('@google-cloud/compute').v1;

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

  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.ISetIamPolicyDiskRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.ISetIamPolicyDiskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ISetIamPolicyDiskRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IPolicy, protos.google.cloud.compute.v1.ISetIamPolicyDiskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setIamPolicy(request, callback)

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

setLabels(request, options)

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

Sets the labels on a disk. To learn more about labels, read the Labeling Resources documentation.

Parameters
NameDescription
request ISetLabelsDiskRequest

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 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  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'
  /**
   *  The body resource for this request
   */
  // const zoneSetLabelsRequestResource = {}

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

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

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

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

  callSetLabels();

setLabels(request, options, callback)

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

setLabels(request, callback)

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

startAsyncReplication(request, options)

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

Starts asynchronous replication. Must be invoked on the primary disk.

Parameters
NameDescription
request IStartAsyncReplicationDiskRequest

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 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the persistent disk.
   */
  // const disk = 'abc123'
  /**
   *  The body resource for this request
   */
  // const disksStartAsyncReplicationRequestResource = {}
  /**
   *  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 {DisksClient} = require('@google-cloud/compute').v1;

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

  async function callStartAsyncReplication() {
    // Construct request
    const request = {
      disk,
      disksStartAsyncReplicationRequestResource,
      project,
      zone,
    };

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

  callStartAsyncReplication();

startAsyncReplication(request, options, callback)

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

startAsyncReplication(request, callback)

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

stopAsyncReplication(request, options)

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

Stops asynchronous replication. Can be invoked either on the primary or on the secondary disk.

Parameters
NameDescription
request IStopAsyncReplicationDiskRequest

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 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The name of the persistent disk.
   */
  // const disk = '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 {DisksClient} = require('@google-cloud/compute').v1;

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

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

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

  callStopAsyncReplication();

stopAsyncReplication(request, options, callback)

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

stopAsyncReplication(request, callback)

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

stopGroupAsyncReplication(request, options)

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

Stops asynchronous replication for a consistency group of disks. Can be invoked either in the primary or secondary scope.

Parameters
NameDescription
request IStopGroupAsyncReplicationDiskRequest

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 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The body resource for this request
   */
  // const disksStopGroupAsyncReplicationResourceResource = {}
  /**
   *  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. This must be the zone of the primary or secondary disks in the consistency group.
   */
  // const zone = 'abc123'

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

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

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

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

  callStopGroupAsyncReplication();

stopGroupAsyncReplication(request, options, callback)

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

stopGroupAsyncReplication(request, callback)

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

testIamPermissions(request, options)

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

Returns permissions that a caller has on the specified resource.

Parameters
NameDescription
request ITestIamPermissionsDiskRequest

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.ITestIamPermissionsDiskRequest | 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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * 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 {DisksClient} = require('@google-cloud/compute').v1;

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

  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.ITestIamPermissionsDiskRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.ITestPermissionsResponse, protos.google.cloud.compute.v1.ITestIamPermissionsDiskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ITestIamPermissionsDiskRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.ITestPermissionsResponse, protos.google.cloud.compute.v1.ITestIamPermissionsDiskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

testIamPermissions(request, callback)

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

update(request, options)

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

Updates the specified disk with the data included in the request. The update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: user_license.

Parameters
NameDescription
request IUpdateDiskRequest

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 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The disk name for this request.
   */
  // const disk = 'abc123'
  /**
   *  The body resource for this request
   */
  // const diskResource = {}
  /**
   */
  // const paths = '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'
  /**
   *  update_mask indicates fields to be updated as part of this request.
   */
  // const updateMask = 'abc123'
  /**
   *  The name of the zone for this request.
   */
  // const zone = 'abc123'

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

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

  async function callUpdate() {
    // Construct request
    const request = {
      disk,
      diskResource,
      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.IUpdateDiskRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateDiskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateDiskRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IUpdateDiskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

update(request, callback)

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