Class v2.NotebookServiceClient (4.1.0)

API v2 service for Workbench Notebooks Instances. v2

Package

@google-cloud/notebooks

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of NotebookServiceClient.

Parameters
Name Description
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 NotebookServiceClient({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;

iamClient

iamClient: IamClient;

innerApiCalls

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

locationsClient

locationsClient: LocationsClient;

notebookServiceStub

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

operationsClient

operationsClient: gax.OperationsClient;

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

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

cancelOperation(request, optionsOrCallback, callback)

cancelOperation(request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: gax.CallOptions | Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED.

Parameters
Name Description
request CancelOperationRequest

The request object that will be sent.

optionsOrCallback CallOptions | Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>
callback Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});

checkCreateInstanceProgress(name)

checkCreateInstanceProgress(name: string): Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>;

Check the status of the long running operation returned by createInstance().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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.
   */
  /**
   *  Required. Format:
   *  `parent=projects/{project_id}/locations/{location}`
   */
  // const parent = 'abc123'
  /**
   *  Required. User-defined unique ID of this instance.
   */
  // const instanceId = 'abc123'
  /**
   *  Required. The instance to be created.
   */
  // const instance = {}
  /**
   *  Optional. Idempotent request UUID.
   */
  // const requestId = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callCreateInstance() {
    // Construct request
    const request = {
      parent,
      instanceId,
      instance,
    };

    // Run request
    const [operation] = await notebooksClient.createInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateInstance();

checkDeleteInstanceProgress(name)

checkDeleteInstanceProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.notebooks.v2.OperationMetadata>>;

Check the status of the long running operation returned by deleteInstance().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.notebooks.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'
  /**
   *  Optional. Idempotent request UUID.
   */
  // const requestId = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callDeleteInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await notebooksClient.deleteInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteInstance();

checkDiagnoseInstanceProgress(name)

checkDiagnoseInstanceProgress(name: string): Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>;

Check the status of the long running operation returned by diagnoseInstance().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'
  /**
   *  Required. Defines flags that are used to run the diagnostic tool
   */
  // const diagnosticConfig = {}
  /**
   *  Optional. Maxmium amount of time in minutes before the operation times out.
   */
  // const timeoutMinutes = 1234

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callDiagnoseInstance() {
    // Construct request
    const request = {
      name,
      diagnosticConfig,
    };

    // Run request
    const [operation] = await notebooksClient.diagnoseInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDiagnoseInstance();

checkInstanceUpgradability(request, options)

checkInstanceUpgradability(request?: protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityRequest, options?: CallOptions): Promise<[
        protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityResponse,
        (protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityRequest | undefined),
        {} | undefined
    ]>;

Checks whether a notebook instance is upgradable.

Parameters
Name Description
request ICheckInstanceUpgradabilityRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityResponse, (protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing CheckInstanceUpgradabilityResponse. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const notebookInstance = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callCheckInstanceUpgradability() {
    // Construct request
    const request = {
      notebookInstance,
    };

    // Run request
    const response = await notebooksClient.checkInstanceUpgradability(request);
    console.log(response);
  }

  callCheckInstanceUpgradability();

checkInstanceUpgradability(request, options, callback)

checkInstanceUpgradability(request: protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityRequest, options: CallOptions, callback: Callback<protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityResponse, protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICheckInstanceUpgradabilityRequest
options CallOptions
callback Callback<protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityResponse, protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

checkInstanceUpgradability(request, callback)

checkInstanceUpgradability(request: protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityRequest, callback: Callback<protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityResponse, protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICheckInstanceUpgradabilityRequest
callback Callback<protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityResponse, protos.google.cloud.notebooks.v2.ICheckInstanceUpgradabilityRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

checkResetInstanceProgress(name)

checkResetInstanceProgress(name: string): Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>;

Check the status of the long running operation returned by resetInstance().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callResetInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await notebooksClient.resetInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callResetInstance();

checkRollbackInstanceProgress(name)

checkRollbackInstanceProgress(name: string): Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>;

Check the status of the long running operation returned by rollbackInstance().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'
  /**
   *  Required. The snapshot for rollback.
   *  Example: "projects/test-project/global/snapshots/krwlzipynril".
   */
  // const targetSnapshot = 'abc123'
  /**
   *  Required. Output only. Revision Id
   */
  // const revisionId = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callRollbackInstance() {
    // Construct request
    const request = {
      name,
      targetSnapshot,
      revisionId,
    };

    // Run request
    const [operation] = await notebooksClient.rollbackInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callRollbackInstance();

checkStartInstanceProgress(name)

checkStartInstanceProgress(name: string): Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>;

Check the status of the long running operation returned by startInstance().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callStartInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await notebooksClient.startInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callStartInstance();

checkStopInstanceProgress(name)

checkStopInstanceProgress(name: string): Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>;

Check the status of the long running operation returned by stopInstance().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callStopInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await notebooksClient.stopInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callStopInstance();

checkUpdateInstanceProgress(name)

checkUpdateInstanceProgress(name: string): Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>;

Check the status of the long running operation returned by updateInstance().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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.
   */
  /**
   *  Required. A representation of an instance.
   */
  // const instance = {}
  /**
   *  Required. Mask used to update an instance
   */
  // const updateMask = {}
  /**
   *  Optional. Idempotent request UUID.
   */
  // const requestId = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callUpdateInstance() {
    // Construct request
    const request = {
      instance,
      updateMask,
    };

    // Run request
    const [operation] = await notebooksClient.updateInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdateInstance();

checkUpgradeInstanceProgress(name)

checkUpgradeInstanceProgress(name: string): Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>;

Check the status of the long running operation returned by upgradeInstance().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.notebooks.v2.Instance, protos.google.cloud.notebooks.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callUpgradeInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await notebooksClient.upgradeInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpgradeInstance();

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
Type Description
Promise<void>

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

createInstance(request, options)

createInstance(request?: protos.google.cloud.notebooks.v2.ICreateInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Creates a new Instance in a given project and location.

Parameters
Name Description
request ICreateInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. 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.
   */
  /**
   *  Required. Format:
   *  `parent=projects/{project_id}/locations/{location}`
   */
  // const parent = 'abc123'
  /**
   *  Required. User-defined unique ID of this instance.
   */
  // const instanceId = 'abc123'
  /**
   *  Required. The instance to be created.
   */
  // const instance = {}
  /**
   *  Optional. Idempotent request UUID.
   */
  // const requestId = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callCreateInstance() {
    // Construct request
    const request = {
      parent,
      instanceId,
      instance,
    };

    // Run request
    const [operation] = await notebooksClient.createInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateInstance();

createInstance(request, options, callback)

createInstance(request: protos.google.cloud.notebooks.v2.ICreateInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateInstanceRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

createInstance(request, callback)

createInstance(request: protos.google.cloud.notebooks.v2.ICreateInstanceRequest, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateInstanceRequest
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteInstance(request, options)

deleteInstance(request?: protos.google.cloud.notebooks.v2.IDeleteInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.notebooks.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Deletes a single Instance.

Parameters
Name Description
request IDeleteInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'
  /**
   *  Optional. Idempotent request UUID.
   */
  // const requestId = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callDeleteInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await notebooksClient.deleteInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteInstance();

deleteInstance(request, options, callback)

deleteInstance(request: protos.google.cloud.notebooks.v2.IDeleteInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteInstanceRequest
options CallOptions
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteInstance(request, callback)

deleteInstance(request: protos.google.cloud.notebooks.v2.IDeleteInstanceRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteInstanceRequest
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteOperation(request, optionsOrCallback, callback)

deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, optionsOrCallback?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
Name Description
request DeleteOperationRequest

The request object that will be sent.

optionsOrCallback CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>
callback Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});

diagnoseInstance(request, options)

diagnoseInstance(request?: protos.google.cloud.notebooks.v2.IDiagnoseInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Creates a Diagnostic File and runs Diagnostic Tool given an Instance.

Parameters
Name Description
request IDiagnoseInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'
  /**
   *  Required. Defines flags that are used to run the diagnostic tool
   */
  // const diagnosticConfig = {}
  /**
   *  Optional. Maxmium amount of time in minutes before the operation times out.
   */
  // const timeoutMinutes = 1234

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callDiagnoseInstance() {
    // Construct request
    const request = {
      name,
      diagnosticConfig,
    };

    // Run request
    const [operation] = await notebooksClient.diagnoseInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDiagnoseInstance();

diagnoseInstance(request, options, callback)

diagnoseInstance(request: protos.google.cloud.notebooks.v2.IDiagnoseInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDiagnoseInstanceRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

diagnoseInstance(request, callback)

diagnoseInstance(request: protos.google.cloud.notebooks.v2.IDiagnoseInstanceRequest, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDiagnoseInstanceRequest
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

getIamPolicy(request, options, callback)

getIamPolicy(request: IamProtos.google.iam.v1.GetIamPolicyRequest, options?: gax.CallOptions | Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>, callback?: Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>): Promise<[IamProtos.google.iam.v1.Policy]>;

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
Name Description
request IamProtos.google.iam.v1.GetIamPolicyRequest

The request object that will be sent.

options CallOptions | Callback<google.iam.v1.Policy, google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<google.iam.v1.Policy, google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing .

Returns
Type Description
Promise<[google.iam.v1.Policy]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

getInstance(request, options)

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

Gets details of a single Instance.

Parameters
Name Description
request IGetInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.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 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callGetInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await notebooksClient.getInstance(request);
    console.log(response);
  }

  callGetInstance();

getInstance(request, options, callback)

getInstance(request: protos.google.cloud.notebooks.v2.IGetInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IGetInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IGetInstanceRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getInstance(request, callback)

getInstance(request: protos.google.cloud.notebooks.v2.IGetInstanceRequest, callback: Callback<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IGetInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetInstanceRequest
callback Callback<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IGetInstanceRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getLocation(request, options, callback)

getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;

Gets information about a location.

Parameters
Name Description
request LocationProtos.google.cloud.location.IGetLocationRequest

The request object that will be sent.

options CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>

Call options. See CallOptions for more details.

callback Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
Promise<google.cloud.location.ILocation>

{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

const [response] = await client.getLocation(request);

getOperation(request, optionsOrCallback, callback)

getOperation(request: protos.google.longrunning.GetOperationRequest, optionsOrCallback?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters
Name Description
request GetOperationRequest

The request object that will be sent.

optionsOrCallback CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>
callback Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<[protos.google.longrunning.Operation]>
Example

const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
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
Type Description
Promise<{ [name: string]: Function; }>

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

instancePath(project, location, instance)

instancePath(project: string, location: string, instance: string): string;

Return a fully-qualified instance resource name string.

Parameters
Name Description
project string
location string
instance string
Returns
Type Description
string

{string} Resource name string.

listInstances(request, options)

listInstances(request?: protos.google.cloud.notebooks.v2.IListInstancesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.notebooks.v2.IInstance[],
        protos.google.cloud.notebooks.v2.IListInstancesRequest | null,
        protos.google.cloud.notebooks.v2.IListInstancesResponse
    ]>;

Lists instances in a given project and location.

Parameters
Name Description
request IListInstancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.notebooks.v2.IInstance[], protos.google.cloud.notebooks.v2.IListInstancesRequest | null, protos.google.cloud.notebooks.v2.IListInstancesResponse ]>

{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 listInstancesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listInstances(request, options, callback)

listInstances(request: protos.google.cloud.notebooks.v2.IListInstancesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.notebooks.v2.IListInstancesRequest, protos.google.cloud.notebooks.v2.IListInstancesResponse | null | undefined, protos.google.cloud.notebooks.v2.IInstance>): void;
Parameters
Name Description
request IListInstancesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.notebooks.v2.IListInstancesRequest, protos.google.cloud.notebooks.v2.IListInstancesResponse | null | undefined, protos.google.cloud.notebooks.v2.IInstance>
Returns
Type Description
void

listInstances(request, callback)

listInstances(request: protos.google.cloud.notebooks.v2.IListInstancesRequest, callback: PaginationCallback<protos.google.cloud.notebooks.v2.IListInstancesRequest, protos.google.cloud.notebooks.v2.IListInstancesResponse | null | undefined, protos.google.cloud.notebooks.v2.IInstance>): void;
Parameters
Name Description
request IListInstancesRequest
callback PaginationCallback<protos.google.cloud.notebooks.v2.IListInstancesRequest, protos.google.cloud.notebooks.v2.IListInstancesResponse | null | undefined, protos.google.cloud.notebooks.v2.IInstance>
Returns
Type Description
void

listInstancesAsync(request, options)

listInstancesAsync(request?: protos.google.cloud.notebooks.v2.IListInstancesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.notebooks.v2.IInstance>;

Equivalent to listInstances, but returns an iterable object.

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

Parameters
Name Description
request IListInstancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.notebooks.v2.IInstance>

{Object} An iterable Object that allows async iteration. 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 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.
   */
  /**
   *  Required. Format:
   *  `parent=projects/{project_id}/locations/{location}`
   */
  // const parent = 'abc123'
  /**
   *  Optional. Maximum return size of the list call.
   */
  // const pageSize = 1234
  /**
   *  Optional. A previous returned page token that can be used to continue
   *  listing from the last result.
   */
  // const pageToken = 'abc123'
  /**
   *  Optional. Sort results. Supported values are "name", "name desc" or ""
   *  (unsorted).
   */
  // const orderBy = 'abc123'
  /**
   *  Optional. List filter.
   */
  // const filter = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callListInstances() {
    // Construct request
    const request = {
      parent,
    };

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

  callListInstances();

listInstancesStream(request, options)

listInstancesStream(request?: protos.google.cloud.notebooks.v2.IListInstancesRequest, options?: CallOptions): Transform;

Equivalent to listInstances, but returns a NodeJS Stream object.

Parameters
Name Description
request IListInstancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
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 listInstancesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listLocationsAsync(request, options)

listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;

Lists information about the supported locations for this service. Returns an iterable object.

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

Parameters
Name Description
request LocationProtos.google.cloud.location.IListLocationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<google.cloud.location.ILocation>

{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

const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
  // process response
}

listOperationsAsync(request, options)

listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.IOperation>;

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED. Returns an iterable object.

For-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters
Name Description
request ListOperationsRequest

The request object that will be sent.

options CallOptions

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

Returns
Type Description
AsyncIterable<protos.google.longrunning.IOperation>

{Object} An iterable Object that conforms to iteration protocols.

Example

const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
Name Description
project string
location string
Returns
Type Description
string

{string} Resource name string.

matchInstanceFromInstanceName(instanceName)

matchInstanceFromInstanceName(instanceName: string): string | number;

Parse the instance from Instance resource.

Parameter
Name Description
instanceName string

A fully-qualified path representing Instance resource.

Returns
Type Description
string | number

{string} A string representing the instance.

matchLocationFromInstanceName(instanceName)

matchLocationFromInstanceName(instanceName: string): string | number;

Parse the location from Instance resource.

Parameter
Name Description
instanceName string

A fully-qualified path representing Instance resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchProjectFromInstanceName(instanceName)

matchProjectFromInstanceName(instanceName: string): string | number;

Parse the project from Instance resource.

Parameter
Name Description
instanceName string

A fully-qualified path representing Instance resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromProjectName(projectName)

matchProjectFromProjectName(projectName: string): string | number;

Parse the project from Project resource.

Parameter
Name Description
projectName string

A fully-qualified path representing Project resource.

Returns
Type Description
string | number

{string} A string representing the project.

projectPath(project)

projectPath(project: string): string;

Return a fully-qualified project resource name string.

Parameter
Name Description
project string
Returns
Type Description
string

{string} Resource name string.

resetInstance(request, options)

resetInstance(request?: protos.google.cloud.notebooks.v2.IResetInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Resets a notebook instance.

Parameters
Name Description
request IResetInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callResetInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await notebooksClient.resetInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callResetInstance();

resetInstance(request, options, callback)

resetInstance(request: protos.google.cloud.notebooks.v2.IResetInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IResetInstanceRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

resetInstance(request, callback)

resetInstance(request: protos.google.cloud.notebooks.v2.IResetInstanceRequest, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IResetInstanceRequest
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

rollbackInstance(request, options)

rollbackInstance(request?: protos.google.cloud.notebooks.v2.IRollbackInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Rollbacks a notebook instance to the previous version.

Parameters
Name Description
request IRollbackInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'
  /**
   *  Required. The snapshot for rollback.
   *  Example: "projects/test-project/global/snapshots/krwlzipynril".
   */
  // const targetSnapshot = 'abc123'
  /**
   *  Required. Output only. Revision Id
   */
  // const revisionId = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callRollbackInstance() {
    // Construct request
    const request = {
      name,
      targetSnapshot,
      revisionId,
    };

    // Run request
    const [operation] = await notebooksClient.rollbackInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callRollbackInstance();

rollbackInstance(request, options, callback)

rollbackInstance(request: protos.google.cloud.notebooks.v2.IRollbackInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IRollbackInstanceRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

rollbackInstance(request, callback)

rollbackInstance(request: protos.google.cloud.notebooks.v2.IRollbackInstanceRequest, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IRollbackInstanceRequest
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

setIamPolicy(request, options, callback)

setIamPolicy(request: IamProtos.google.iam.v1.SetIamPolicyRequest, options?: gax.CallOptions | Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>, callback?: Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>): Promise<[IamProtos.google.iam.v1.Policy]>;

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request IamProtos.google.iam.v1.SetIamPolicyRequest

The request object that will be sent.

options CallOptions | Callback<google.iam.v1.Policy, google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<google.iam.v1.Policy, google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing .

Returns
Type Description
Promise<[google.iam.v1.Policy]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

startInstance(request, options)

startInstance(request?: protos.google.cloud.notebooks.v2.IStartInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Starts a notebook instance.

Parameters
Name Description
request IStartInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callStartInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await notebooksClient.startInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callStartInstance();

startInstance(request, options, callback)

startInstance(request: protos.google.cloud.notebooks.v2.IStartInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IStartInstanceRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

startInstance(request, callback)

startInstance(request: protos.google.cloud.notebooks.v2.IStartInstanceRequest, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IStartInstanceRequest
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

stopInstance(request, options)

stopInstance(request?: protos.google.cloud.notebooks.v2.IStopInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Stops a notebook instance.

Parameters
Name Description
request IStopInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callStopInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await notebooksClient.stopInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callStopInstance();

stopInstance(request, options, callback)

stopInstance(request: protos.google.cloud.notebooks.v2.IStopInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IStopInstanceRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

stopInstance(request, callback)

stopInstance(request: protos.google.cloud.notebooks.v2.IStopInstanceRequest, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IStopInstanceRequest
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

testIamPermissions(request, options, callback)

testIamPermissions(request: IamProtos.google.iam.v1.TestIamPermissionsRequest, options?: gax.CallOptions | Callback<IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>, callback?: Callback<IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]>;

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request IamProtos.google.iam.v1.TestIamPermissionsRequest

The request object that will be sent.

options CallOptions | Callback<google.iam.v1.TestIamPermissionsResponse, google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<google.iam.v1.TestIamPermissionsResponse, google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing .

Returns
Type Description
Promise<[google.iam.v1.TestIamPermissionsResponse]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

updateInstance(request, options)

updateInstance(request?: protos.google.cloud.notebooks.v2.IUpdateInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

UpdateInstance updates an Instance.

Parameters
Name Description
request IUpdateInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. 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.
   */
  /**
   *  Required. A representation of an instance.
   */
  // const instance = {}
  /**
   *  Required. Mask used to update an instance
   */
  // const updateMask = {}
  /**
   *  Optional. Idempotent request UUID.
   */
  // const requestId = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callUpdateInstance() {
    // Construct request
    const request = {
      instance,
      updateMask,
    };

    // Run request
    const [operation] = await notebooksClient.updateInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdateInstance();

updateInstance(request, options, callback)

updateInstance(request: protos.google.cloud.notebooks.v2.IUpdateInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateInstanceRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateInstance(request, callback)

updateInstance(request: protos.google.cloud.notebooks.v2.IUpdateInstanceRequest, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateInstanceRequest
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

upgradeInstance(request, options)

upgradeInstance(request?: protos.google.cloud.notebooks.v2.IUpgradeInstanceRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Upgrades a notebook instance to the latest version.

Parameters
Name Description
request IUpgradeInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. 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.
   */
  /**
   *  Required. Format:
   *  `projects/{project_id}/locations/{location}/instances/{instance_id}`
   */
  // const name = 'abc123'

  // Imports the Notebooks library
  const {NotebookServiceClient} = require('@google-cloud/notebooks').v2;

  // Instantiates a client
  const notebooksClient = new NotebookServiceClient();

  async function callUpgradeInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await notebooksClient.upgradeInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpgradeInstance();

upgradeInstance(request, options, callback)

upgradeInstance(request: protos.google.cloud.notebooks.v2.IUpgradeInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpgradeInstanceRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

upgradeInstance(request, callback)

upgradeInstance(request: protos.google.cloud.notebooks.v2.IUpgradeInstanceRequest, callback: Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpgradeInstanceRequest
callback Callback<LROperation<protos.google.cloud.notebooks.v2.IInstance, protos.google.cloud.notebooks.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void