Class v2.TpuClient (3.8.0)

Manages TPU nodes and other resources

TPU API v2 v2

Package

@google-cloud/tpu

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of TpuClient.

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 TpuClient({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 
 ; 
 

innerApiCalls

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

locationsClient

  locationsClient 
 : 
  
 LocationsClient 
 ; 
 

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.

tpuStub

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

universeDomain

  get 
  
 universeDomain 
 () 
 : 
  
 string 
 ; 
 

warn

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

Methods

acceleratorTypePath(project, location, acceleratorType)

  acceleratorTypePath 
 ( 
 project 
 : 
  
 string 
 , 
  
 location 
 : 
  
 string 
 , 
  
 acceleratorType 
 : 
  
 string 
 ) 
 : 
  
 string 
 ; 
 

Return a fully-qualified acceleratorType resource name string.

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

{string} Resource name string.

cancelOperation(request, options, callback)

  cancelOperation 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 CancelOperationRequest 
 , 
  
 options 
 ?: 
  
 gax 
 . 
 CallOptions 
  
 | 
  
 Callback<protos 
 . 
 google 
 . 
 protobuf 
 . 
 Empty 
 , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 CancelOperationRequest 
 , 
  
 {} 
  
 | 
  
 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.

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

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 < 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
Example
  const 
  
 client 
  
 = 
  
 longrunning 
 . 
 operationsClient 
 (); 
 await 
  
 client 
 . 
 cancelOperation 
 ({ 
 name 
 : 
  
 '' 
 }); 
 

checkCreateNodeProgress(name)

  checkCreateNodeProgress 
 ( 
 name 
 : 
  
 string 
 ) 
 : 
  
 Promise<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 Node 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 OperationMetadata 
>> ; 
 

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

Parameter
Name
Description
name
string

The operation name that will be passed.

Returns
Type
Description

{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. The parent resource name. 
 */ 
  
 // const parent = 'abc123' 
  
 /** 
 *  The unqualified resource name. 
 */ 
  
 // const nodeId = 'abc123' 
  
 /** 
 *  Required. The node. 
 */ 
  
 // const node = {} 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callCreateNode 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 parent 
 , 
  
 node 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 createNode 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callCreateNode 
 (); 
 

checkCreateQueuedResourceProgress(name)

  checkCreateQueuedResourceProgress 
 ( 
 name 
 : 
  
 string 
 ) 
 : 
  
 Promise<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 QueuedResource 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 OperationMetadata 
>> ; 
 

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

Parameter
Name
Description
name
string

The operation name that will be passed.

Returns
Type
Description

{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. The parent resource name. 
 */ 
  
 // const parent = 'abc123' 
  
 /** 
 *  Optional. The unqualified resource name. Should follow the 
 *  `^[A-Za-z0-9_.~+%-]+$` regex format. 
 */ 
  
 // const queuedResourceId = 'abc123' 
  
 /** 
 *  Required. The queued resource. 
 */ 
  
 // const queuedResource = {} 
  
 /** 
 *  Optional. Idempotent request UUID. 
 */ 
  
 // const requestId = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callCreateQueuedResource 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 parent 
 , 
  
 queuedResource 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 createQueuedResource 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callCreateQueuedResource 
 (); 
 

checkDeleteNodeProgress(name)

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

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

Parameter
Name
Description
name
string

The operation name that will be passed.

Returns
Type
Description

{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. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callDeleteNode 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 deleteNode 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callDeleteNode 
 (); 
 

checkDeleteQueuedResourceProgress(name)

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

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

Parameter
Name
Description
name
string

The operation name that will be passed.

Returns
Type
Description

{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. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 /** 
 *  Optional. Idempotent request UUID. 
 */ 
  
 // const requestId = 'abc123' 
  
 /** 
 *  Optional. If set to true, all running nodes belonging to this queued 
 *  resource will be deleted first and then the queued resource will be 
 *  deleted. Otherwise (i.e. force=false), the queued resource will only be 
 *  deleted if its nodes have already been deleted or the queued resource is in 
 *  the ACCEPTED, FAILED, or SUSPENDED state. 
 */ 
  
 // const force = true 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callDeleteQueuedResource 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 deleteQueuedResource 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callDeleteQueuedResource 
 (); 
 

checkResetQueuedResourceProgress(name)

  checkResetQueuedResourceProgress 
 ( 
 name 
 : 
  
 string 
 ) 
 : 
  
 Promise<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 QueuedResource 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 OperationMetadata 
>> ; 
 

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

Parameter
Name
Description
name
string

The operation name that will be passed.

Returns
Type
Description

{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. The name of the queued resource. 
 */ 
  
 // const name = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callResetQueuedResource 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 resetQueuedResource 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callResetQueuedResource 
 (); 
 

checkStartNodeProgress(name)

  checkStartNodeProgress 
 ( 
 name 
 : 
  
 string 
 ) 
 : 
  
 Promise<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 Node 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 OperationMetadata 
>> ; 
 

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

Parameter
Name
Description
name
string

The operation name that will be passed.

Returns
Type
Description

{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. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callStartNode 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 startNode 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callStartNode 
 (); 
 

checkStopNodeProgress(name)

  checkStopNodeProgress 
 ( 
 name 
 : 
  
 string 
 ) 
 : 
  
 Promise<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 Node 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 OperationMetadata 
>> ; 
 

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

Parameter
Name
Description
name
string

The operation name that will be passed.

Returns
Type
Description

{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. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callStopNode 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 stopNode 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callStopNode 
 (); 
 

checkUpdateNodeProgress(name)

  checkUpdateNodeProgress 
 ( 
 name 
 : 
  
 string 
 ) 
 : 
  
 Promise<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 Node 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 OperationMetadata 
>> ; 
 

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

Parameter
Name
Description
name
string

The operation name that will be passed.

Returns
Type
Description

{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. Mask of fields from Node Tpu.Node  to update. 
 *  Supported fields: description, tags, labels, metadata, 
 *  network_config.enable_external_ips. 
 */ 
  
 // const updateMask = {} 
  
 /** 
 *  Required. The node. Only fields specified in update_mask are updated. 
 */ 
  
 // const node = {} 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callUpdateNode 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 updateMask 
 , 
  
 node 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 updateNode 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callUpdateNode 
 (); 
 

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.

createNode(request, options)

  createNode 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 ICreateNodeRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IOperationMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Creates a node.

Parameters
Name
Description
request
ICreateNodeRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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. The parent resource name. 
 */ 
  
 // const parent = 'abc123' 
  
 /** 
 *  The unqualified resource name. 
 */ 
  
 // const nodeId = 'abc123' 
  
 /** 
 *  Required. The node. 
 */ 
  
 // const node = {} 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callCreateNode 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 parent 
 , 
  
 node 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 createNode 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callCreateNode 
 (); 
 

createNode(request, options, callback)

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

createNode(request, callback)

  createNode 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 ICreateNodeRequest 
 , 
  
 callback 
 : 
  
 Callback<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IOperationMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
callback
Callback < LROperation < protos.google.cloud.tpu.v2.INode , protos.google.cloud.tpu.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type
Description
void

createQueuedResource(request, options)

  createQueuedResource 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 ICreateQueuedResourceRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IQueuedResource 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IOperationMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Creates a QueuedResource TPU instance.

Parameters
Name
Description
request
ICreateQueuedResourceRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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. The parent resource name. 
 */ 
  
 // const parent = 'abc123' 
  
 /** 
 *  Optional. The unqualified resource name. Should follow the 
 *  `^[A-Za-z0-9_.~+%-]+$` regex format. 
 */ 
  
 // const queuedResourceId = 'abc123' 
  
 /** 
 *  Required. The queued resource. 
 */ 
  
 // const queuedResource = {} 
  
 /** 
 *  Optional. Idempotent request UUID. 
 */ 
  
 // const requestId = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callCreateQueuedResource 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 parent 
 , 
  
 queuedResource 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 createQueuedResource 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callCreateQueuedResource 
 (); 
 

createQueuedResource(request, options, callback)

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

createQueuedResource(request, callback)

  createQueuedResource 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 ICreateQueuedResourceRequest 
 , 
  
 callback 
 : 
  
 Callback<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IQueuedResource 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IOperationMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
callback
Returns
Type
Description
void

deleteNode(request, options)

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

Deletes a node.

Parameters
Name
Description
request
IDeleteNodeRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callDeleteNode 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 deleteNode 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callDeleteNode 
 (); 
 

deleteNode(request, options, callback)

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

deleteNode(request, callback)

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

deleteOperation(request, options, callback)

  deleteOperation 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 DeleteOperationRequest 
 , 
  
 options 
 ?: 
  
 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.

options
CallOptions | Callback < protos.google.protobuf.Empty , protos.google.longrunning.DeleteOperationRequest , {} | 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 < 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
Example
  const 
  
 client 
  
 = 
  
 longrunning 
 . 
 operationsClient 
 (); 
 await 
  
 client 
 . 
 deleteOperation 
 ({ 
 name 
 : 
  
 '' 
 }); 
 

deleteQueuedResource(request, options)

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

Deletes a QueuedResource TPU instance.

Parameters
Name
Description
request
IDeleteQueuedResourceRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 /** 
 *  Optional. Idempotent request UUID. 
 */ 
  
 // const requestId = 'abc123' 
  
 /** 
 *  Optional. If set to true, all running nodes belonging to this queued 
 *  resource will be deleted first and then the queued resource will be 
 *  deleted. Otherwise (i.e. force=false), the queued resource will only be 
 *  deleted if its nodes have already been deleted or the queued resource is in 
 *  the ACCEPTED, FAILED, or SUSPENDED state. 
 */ 
  
 // const force = true 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callDeleteQueuedResource 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 deleteQueuedResource 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callDeleteQueuedResource 
 (); 
 

deleteQueuedResource(request, options, callback)

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

deleteQueuedResource(request, callback)

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

generateServiceIdentity(request, options)

  generateServiceIdentity 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGenerateServiceIdentityRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGenerateServiceIdentityResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGenerateServiceIdentityRequest 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Generates the Cloud TPU service identity for the project.

Parameters
Name
Description
request
IGenerateServiceIdentityRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{Promise} - The promise which resolves to an array. The first element of the array is an object representing GenerateServiceIdentityResponse . 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. The parent resource name. 
 */ 
  
 // const parent = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callGenerateServiceIdentity 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 parent 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 response 
  
 = 
  
 await 
  
 tpuClient 
 . 
 generateServiceIdentity 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callGenerateServiceIdentity 
 (); 
 

generateServiceIdentity(request, options, callback)

  generateServiceIdentity 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGenerateServiceIdentityRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGenerateServiceIdentityResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGenerateServiceIdentityRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
options
CallOptions
Returns
Type
Description
void

generateServiceIdentity(request, callback)

  generateServiceIdentity 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGenerateServiceIdentityRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGenerateServiceIdentityResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGenerateServiceIdentityRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
Returns
Type
Description
void

getAcceleratorType(request, options)

  getAcceleratorType 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetAcceleratorTypeRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IAcceleratorType 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetAcceleratorTypeRequest 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Gets AcceleratorType.

Parameters
Name
Description
request
IGetAcceleratorTypeRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{Promise} - The promise which resolves to an array. The first element of the array is an object representing AcceleratorType . 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. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callGetAcceleratorType 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 response 
  
 = 
  
 await 
  
 tpuClient 
 . 
 getAcceleratorType 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callGetAcceleratorType 
 (); 
 

getAcceleratorType(request, options, callback)

  getAcceleratorType 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetAcceleratorTypeRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IAcceleratorType 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetAcceleratorTypeRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
options
CallOptions
callback
Returns
Type
Description
void

getAcceleratorType(request, callback)

  getAcceleratorType 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetAcceleratorTypeRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IAcceleratorType 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetAcceleratorTypeRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
callback
Returns
Type
Description
void

getGuestAttributes(request, options)

  getGuestAttributes 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetGuestAttributesRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetGuestAttributesResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetGuestAttributesRequest 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Retrieves the guest attributes for the node.

Parameters
Name
Description
request
IGetGuestAttributesRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{Promise} - The promise which resolves to an array. The first element of the array is an object representing GetGuestAttributesResponse . 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. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 /** 
 *  The guest attributes path to be queried. 
 */ 
  
 // const queryPath = 'abc123' 
  
 /** 
 *  The 0-based worker ID. If it is empty, all workers' GuestAttributes will be 
 *  returned. 
 */ 
  
 // const workerIds = ['abc','def'] 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callGetGuestAttributes 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 response 
  
 = 
  
 await 
  
 tpuClient 
 . 
 getGuestAttributes 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callGetGuestAttributes 
 (); 
 

getGuestAttributes(request, options, callback)

  getGuestAttributes 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetGuestAttributesRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetGuestAttributesResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetGuestAttributesRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
options
CallOptions
Returns
Type
Description
void

getGuestAttributes(request, callback)

  getGuestAttributes 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetGuestAttributesRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetGuestAttributesResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetGuestAttributesRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
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 
 ); 
 

getNode(request, options)

  getNode 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetNodeRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetNodeRequest 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Gets the details of a node.

Parameters
Name
Description
request
IGetNodeRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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. 
 */ 
  
 /** 
 *  Required. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callGetNode 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 response 
  
 = 
  
 await 
  
 tpuClient 
 . 
 getNode 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callGetNode 
 (); 
 

getNode(request, options, callback)

  getNode 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetNodeRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetNodeRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
request
options
CallOptions
callback
Callback < protos.google.cloud.tpu.v2.INode , protos.google.cloud.tpu.v2.IGetNodeRequest | null | undefined, {} | null | undefined>
Returns
Type
Description
void

getNode(request, callback)

  getNode 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetNodeRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetNodeRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
request
callback
Callback < protos.google.cloud.tpu.v2.INode , protos.google.cloud.tpu.v2.IGetNodeRequest | null | undefined, {} | null | undefined>
Returns
Type
Description
void

getOperation(request, options, callback)

  getOperation 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 GetOperationRequest 
 , 
  
 options 
 ?: 
  
 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.

options
CallOptions | Callback < protos.google.longrunning.Operation , protos.google.longrunning.GetOperationRequest , {} | 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 < 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
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

getQueuedResource(request, options)

  getQueuedResource 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetQueuedResourceRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IQueuedResource 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetQueuedResourceRequest 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Gets details of a queued resource.

Parameters
Name
Description
request
IGetQueuedResourceRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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. 
 */ 
  
 /** 
 *  Required. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callGetQueuedResource 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 response 
  
 = 
  
 await 
  
 tpuClient 
 . 
 getQueuedResource 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callGetQueuedResource 
 (); 
 

getQueuedResource(request, options, callback)

  getQueuedResource 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetQueuedResourceRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IQueuedResource 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetQueuedResourceRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
options
CallOptions
callback
Returns
Type
Description
void

getQueuedResource(request, callback)

  getQueuedResource 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetQueuedResourceRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IQueuedResource 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetQueuedResourceRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
callback
Returns
Type
Description
void

getRuntimeVersion(request, options)

  getRuntimeVersion 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetRuntimeVersionRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IRuntimeVersion 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetRuntimeVersionRequest 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Gets a runtime version.

Parameters
Name
Description
request
IGetRuntimeVersionRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{Promise} - The promise which resolves to an array. The first element of the array is an object representing RuntimeVersion . 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. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callGetRuntimeVersion 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 response 
  
 = 
  
 await 
  
 tpuClient 
 . 
 getRuntimeVersion 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callGetRuntimeVersion 
 (); 
 

getRuntimeVersion(request, options, callback)

  getRuntimeVersion 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetRuntimeVersionRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IRuntimeVersion 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetRuntimeVersionRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
options
CallOptions
callback
Returns
Type
Description
void

getRuntimeVersion(request, callback)

  getRuntimeVersion 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetRuntimeVersionRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IRuntimeVersion 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IGetRuntimeVersionRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
callback
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.

listAcceleratorTypes(request, options)

  listAcceleratorTypes 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListAcceleratorTypesRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IAcceleratorType 
 [], 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListAcceleratorTypesRequest 
  
 | 
  
 null 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListAcceleratorTypesResponse 
  
 ]>; 
 

Lists accelerator types supported by this API.

Parameters
Name
Description
request
IListAcceleratorTypesRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{Promise} - The promise which resolves to an array. The first element of the array is Array of AcceleratorType . 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 listAcceleratorTypesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listAcceleratorTypes(request, options, callback)

  listAcceleratorTypes 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListAcceleratorTypesRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 PaginationCallback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListAcceleratorTypesRequest 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListAcceleratorTypesResponse 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IAcceleratorType 
> ) 
 : 
  
 void 
 ; 
 
Returns
Type
Description
void

listAcceleratorTypes(request, callback)

  listAcceleratorTypes 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListAcceleratorTypesRequest 
 , 
  
 callback 
 : 
  
 PaginationCallback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListAcceleratorTypesRequest 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListAcceleratorTypesResponse 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IAcceleratorType 
> ) 
 : 
  
 void 
 ; 
 
Returns
Type
Description
void

listAcceleratorTypesAsync(request, options)

  listAcceleratorTypesAsync 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListAcceleratorTypesRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 AsyncIterable<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IAcceleratorType 
> ; 
 

Equivalent to listAcceleratorTypes , but returns an iterable object.

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

Parameters
Name
Description
request
IListAcceleratorTypesRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{Object} An iterable Object that allows async iteration . When you iterate the returned iterable, each element will be an object representing AcceleratorType . 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. The parent resource name. 
 */ 
  
 // const parent = 'abc123' 
  
 /** 
 *  The maximum number of items to return. 
 */ 
  
 // const pageSize = 1234 
  
 /** 
 *  The next_page_token value returned from a previous List request, if any. 
 */ 
  
 // const pageToken = 'abc123' 
  
 /** 
 *  List filter. 
 */ 
  
 // const filter = 'abc123' 
  
 /** 
 *  Sort results. 
 */ 
  
 // const orderBy = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callListAcceleratorTypes 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 parent 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 iterable 
  
 = 
  
 tpuClient 
 . 
 listAcceleratorTypesAsync 
 ( 
 request 
 ); 
  
 for 
  
 await 
  
 ( 
 const 
  
 response 
  
 of 
  
 iterable 
 ) 
  
 { 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 } 
  
 callListAcceleratorTypes 
 (); 
 

listAcceleratorTypesStream(request, options)

  listAcceleratorTypesStream 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListAcceleratorTypesRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Transform 
 ; 
 

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

Parameters
Name
Description
request
IListAcceleratorTypesRequest

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 AcceleratorType 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 listAcceleratorTypesAsync() 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 
 } 
 

listNodes(request, options)

  listNodes 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListNodesRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
 [], 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListNodesRequest 
  
 | 
  
 null 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListNodesResponse 
  
 ]>; 
 

Lists nodes.

Parameters
Name
Description
request
IListNodesRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

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

listNodes(request, options, callback)

  listNodes 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListNodesRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 PaginationCallback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListNodesRequest 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListNodesResponse 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
options
CallOptions
Returns
Type
Description
void

listNodes(request, callback)

  listNodes 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListNodesRequest 
 , 
  
 callback 
 : 
  
 PaginationCallback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListNodesRequest 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListNodesResponse 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
Returns
Type
Description
void

listNodesAsync(request, options)

  listNodesAsync 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListNodesRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 AsyncIterable<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
> ; 
 

Equivalent to listNodes , but returns an iterable object.

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

Parameters
Name
Description
request
IListNodesRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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. 
 */ 
  
 /** 
 *  Required. The parent resource name. 
 */ 
  
 // const parent = 'abc123' 
  
 /** 
 *  The maximum number of items to return. 
 */ 
  
 // const pageSize = 1234 
  
 /** 
 *  The next_page_token value returned from a previous List request, if any. 
 */ 
  
 // const pageToken = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callListNodes 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 parent 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 iterable 
  
 = 
  
 tpuClient 
 . 
 listNodesAsync 
 ( 
 request 
 ); 
  
 for 
  
 await 
  
 ( 
 const 
  
 response 
  
 of 
  
 iterable 
 ) 
  
 { 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 } 
  
 callListNodes 
 (); 
 

listNodesStream(request, options)

  listNodesStream 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListNodesRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Transform 
 ; 
 

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

Parameters
Name
Description
request
IListNodesRequest

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

listOperationsAsync(request, options)

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

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

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

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

listQueuedResources(request, options)

  listQueuedResources 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListQueuedResourcesRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IQueuedResource 
 [], 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListQueuedResourcesRequest 
  
 | 
  
 null 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListQueuedResourcesResponse 
  
 ]>; 
 

Lists queued resources.

Parameters
Name
Description
request
IListQueuedResourcesRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

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

listQueuedResources(request, options, callback)

  listQueuedResources 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListQueuedResourcesRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 PaginationCallback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListQueuedResourcesRequest 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListQueuedResourcesResponse 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IQueuedResource 
> ) 
 : 
  
 void 
 ; 
 
Returns
Type
Description
void

listQueuedResources(request, callback)

  listQueuedResources 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListQueuedResourcesRequest 
 , 
  
 callback 
 : 
  
 PaginationCallback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListQueuedResourcesRequest 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListQueuedResourcesResponse 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IQueuedResource 
> ) 
 : 
  
 void 
 ; 
 
Returns
Type
Description
void

listQueuedResourcesAsync(request, options)

  listQueuedResourcesAsync 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListQueuedResourcesRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 AsyncIterable<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IQueuedResource 
> ; 
 

Equivalent to listQueuedResources , but returns an iterable object.

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

Parameters
Name
Description
request
IListQueuedResourcesRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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. 
 */ 
  
 /** 
 *  Required. The parent resource name. 
 */ 
  
 // const parent = 'abc123' 
  
 /** 
 *  Optional. The maximum number of items to return. 
 */ 
  
 // const pageSize = 1234 
  
 /** 
 *  Optional. The next_page_token value returned from a previous List request, 
 *  if any. 
 */ 
  
 // const pageToken = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callListQueuedResources 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 parent 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 iterable 
  
 = 
  
 tpuClient 
 . 
 listQueuedResourcesAsync 
 ( 
 request 
 ); 
  
 for 
  
 await 
  
 ( 
 const 
  
 response 
  
 of 
  
 iterable 
 ) 
  
 { 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 } 
  
 callListQueuedResources 
 (); 
 

listQueuedResourcesStream(request, options)

  listQueuedResourcesStream 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListQueuedResourcesRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Transform 
 ; 
 

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

Parameters
Name
Description
request
IListQueuedResourcesRequest

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

listRuntimeVersions(request, options)

  listRuntimeVersions 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListRuntimeVersionsRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IRuntimeVersion 
 [], 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListRuntimeVersionsRequest 
  
 | 
  
 null 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListRuntimeVersionsResponse 
  
 ]>; 
 

Lists runtime versions supported by this API.

Parameters
Name
Description
request
IListRuntimeVersionsRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{Promise} - The promise which resolves to an array. The first element of the array is Array of RuntimeVersion . 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 listRuntimeVersionsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listRuntimeVersions(request, options, callback)

  listRuntimeVersions 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListRuntimeVersionsRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 PaginationCallback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListRuntimeVersionsRequest 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListRuntimeVersionsResponse 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IRuntimeVersion 
> ) 
 : 
  
 void 
 ; 
 
Returns
Type
Description
void

listRuntimeVersions(request, callback)

  listRuntimeVersions 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListRuntimeVersionsRequest 
 , 
  
 callback 
 : 
  
 PaginationCallback<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListRuntimeVersionsRequest 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListRuntimeVersionsResponse 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IRuntimeVersion 
> ) 
 : 
  
 void 
 ; 
 
Returns
Type
Description
void

listRuntimeVersionsAsync(request, options)

  listRuntimeVersionsAsync 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListRuntimeVersionsRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 AsyncIterable<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IRuntimeVersion 
> ; 
 

Equivalent to listRuntimeVersions , but returns an iterable object.

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

Parameters
Name
Description
request
IListRuntimeVersionsRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{Object} An iterable Object that allows async iteration . When you iterate the returned iterable, each element will be an object representing RuntimeVersion . 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. The parent resource name. 
 */ 
  
 // const parent = 'abc123' 
  
 /** 
 *  The maximum number of items to return. 
 */ 
  
 // const pageSize = 1234 
  
 /** 
 *  The next_page_token value returned from a previous List request, if any. 
 */ 
  
 // const pageToken = 'abc123' 
  
 /** 
 *  List filter. 
 */ 
  
 // const filter = 'abc123' 
  
 /** 
 *  Sort results. 
 */ 
  
 // const orderBy = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callListRuntimeVersions 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 parent 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 iterable 
  
 = 
  
 tpuClient 
 . 
 listRuntimeVersionsAsync 
 ( 
 request 
 ); 
  
 for 
  
 await 
  
 ( 
 const 
  
 response 
  
 of 
  
 iterable 
 ) 
  
 { 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 } 
  
 callListRuntimeVersions 
 (); 
 

listRuntimeVersionsStream(request, options)

  listRuntimeVersionsStream 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IListRuntimeVersionsRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Transform 
 ; 
 

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

Parameters
Name
Description
request
IListRuntimeVersionsRequest

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

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.

matchAcceleratorTypeFromAcceleratorTypeName(acceleratorTypeName)

  matchAcceleratorTypeFromAcceleratorTypeName 
 ( 
 acceleratorTypeName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the accelerator_type from AcceleratorType resource.

Parameter
Name
Description
acceleratorTypeName
string

A fully-qualified path representing AcceleratorType resource.

Returns
Type
Description
string | number

{string} A string representing the accelerator_type.

matchLocationFromAcceleratorTypeName(acceleratorTypeName)

  matchLocationFromAcceleratorTypeName 
 ( 
 acceleratorTypeName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from AcceleratorType resource.

Parameter
Name
Description
acceleratorTypeName
string

A fully-qualified path representing AcceleratorType 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.

matchLocationFromNodeName(nodeName)

  matchLocationFromNodeName 
 ( 
 nodeName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from Node resource.

Parameter
Name
Description
nodeName
string

A fully-qualified path representing Node resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchLocationFromQueuedResourceName(queuedResourceName)

  matchLocationFromQueuedResourceName 
 ( 
 queuedResourceName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from QueuedResource resource.

Parameter
Name
Description
queuedResourceName
string

A fully-qualified path representing QueuedResource resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchLocationFromRuntimeVersionName(runtimeVersionName)

  matchLocationFromRuntimeVersionName 
 ( 
 runtimeVersionName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from RuntimeVersion resource.

Parameter
Name
Description
runtimeVersionName
string

A fully-qualified path representing RuntimeVersion resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchNodeFromNodeName(nodeName)

  matchNodeFromNodeName 
 ( 
 nodeName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the node from Node resource.

Parameter
Name
Description
nodeName
string

A fully-qualified path representing Node resource.

Returns
Type
Description
string | number

{string} A string representing the node.

matchProjectFromAcceleratorTypeName(acceleratorTypeName)

  matchProjectFromAcceleratorTypeName 
 ( 
 acceleratorTypeName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from AcceleratorType resource.

Parameter
Name
Description
acceleratorTypeName
string

A fully-qualified path representing AcceleratorType 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.

matchProjectFromNodeName(nodeName)

  matchProjectFromNodeName 
 ( 
 nodeName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from Node resource.

Parameter
Name
Description
nodeName
string

A fully-qualified path representing Node 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.

matchProjectFromQueuedResourceName(queuedResourceName)

  matchProjectFromQueuedResourceName 
 ( 
 queuedResourceName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from QueuedResource resource.

Parameter
Name
Description
queuedResourceName
string

A fully-qualified path representing QueuedResource resource.

Returns
Type
Description
string | number

{string} A string representing the project.

matchProjectFromRuntimeVersionName(runtimeVersionName)

  matchProjectFromRuntimeVersionName 
 ( 
 runtimeVersionName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from RuntimeVersion resource.

Parameter
Name
Description
runtimeVersionName
string

A fully-qualified path representing RuntimeVersion resource.

Returns
Type
Description
string | number

{string} A string representing the project.

matchQueuedResourceFromQueuedResourceName(queuedResourceName)

  matchQueuedResourceFromQueuedResourceName 
 ( 
 queuedResourceName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the queued_resource from QueuedResource resource.

Parameter
Name
Description
queuedResourceName
string

A fully-qualified path representing QueuedResource resource.

Returns
Type
Description
string | number

{string} A string representing the queued_resource.

matchRuntimeVersionFromRuntimeVersionName(runtimeVersionName)

  matchRuntimeVersionFromRuntimeVersionName 
 ( 
 runtimeVersionName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the runtime_version from RuntimeVersion resource.

Parameter
Name
Description
runtimeVersionName
string

A fully-qualified path representing RuntimeVersion resource.

Returns
Type
Description
string | number

{string} A string representing the runtime_version.

nodePath(project, location, node)

  nodePath 
 ( 
 project 
 : 
  
 string 
 , 
  
 location 
 : 
  
 string 
 , 
  
 node 
 : 
  
 string 
 ) 
 : 
  
 string 
 ; 
 

Return a fully-qualified node resource name string.

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

{string} Resource name string.

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.

queuedResourcePath(project, location, queuedResource)

  queuedResourcePath 
 ( 
 project 
 : 
  
 string 
 , 
  
 location 
 : 
  
 string 
 , 
  
 queuedResource 
 : 
  
 string 
 ) 
 : 
  
 string 
 ; 
 

Return a fully-qualified queuedResource resource name string.

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

{string} Resource name string.

resetQueuedResource(request, options)

  resetQueuedResource 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IResetQueuedResourceRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IQueuedResource 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IOperationMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Resets a QueuedResource TPU instance

Parameters
Name
Description
request
IResetQueuedResourceRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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. The name of the queued resource. 
 */ 
  
 // const name = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callResetQueuedResource 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 resetQueuedResource 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callResetQueuedResource 
 (); 
 

resetQueuedResource(request, options, callback)

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

resetQueuedResource(request, callback)

  resetQueuedResource 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IResetQueuedResourceRequest 
 , 
  
 callback 
 : 
  
 Callback<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IQueuedResource 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IOperationMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
callback
Returns
Type
Description
void

runtimeVersionPath(project, location, runtimeVersion)

  runtimeVersionPath 
 ( 
 project 
 : 
  
 string 
 , 
  
 location 
 : 
  
 string 
 , 
  
 runtimeVersion 
 : 
  
 string 
 ) 
 : 
  
 string 
 ; 
 

Return a fully-qualified runtimeVersion resource name string.

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

{string} Resource name string.

startNode(request, options)

  startNode 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IStartNodeRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IOperationMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Starts a node.

Parameters
Name
Description
request
IStartNodeRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callStartNode 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 startNode 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callStartNode 
 (); 
 

startNode(request, options, callback)

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

startNode(request, callback)

  startNode 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IStartNodeRequest 
 , 
  
 callback 
 : 
  
 Callback<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IOperationMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
callback
Callback < LROperation < protos.google.cloud.tpu.v2.INode , protos.google.cloud.tpu.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type
Description
void

stopNode(request, options)

  stopNode 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IStopNodeRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IOperationMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Stops a node. This operation is only available with single TPU nodes.

Parameters
Name
Description
request
IStopNodeRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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. The resource name. 
 */ 
  
 // const name = 'abc123' 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callStopNode 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 stopNode 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callStopNode 
 (); 
 

stopNode(request, options, callback)

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

stopNode(request, callback)

  stopNode 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IStopNodeRequest 
 , 
  
 callback 
 : 
  
 Callback<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IOperationMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
callback
Callback < LROperation < protos.google.cloud.tpu.v2.INode , protos.google.cloud.tpu.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type
Description
void

updateNode(request, options)

  updateNode 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IUpdateNodeRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IOperationMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Updates the configurations of a node.

Parameters
Name
Description
request
IUpdateNodeRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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. Mask of fields from Node Tpu.Node  to update. 
 *  Supported fields: description, tags, labels, metadata, 
 *  network_config.enable_external_ips. 
 */ 
  
 // const updateMask = {} 
  
 /** 
 *  Required. The node. Only fields specified in update_mask are updated. 
 */ 
  
 // const node = {} 
  
 // Imports the Tpu library 
  
 const 
  
 { 
 TpuClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/tpu 
' 
 ). 
 v2 
 ; 
  
 // Instantiates a client 
  
 const 
  
 tpuClient 
  
 = 
  
 new 
  
  TpuClient 
 
 (); 
  
 async 
  
 function 
  
 callUpdateNode 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 updateMask 
 , 
  
 node 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 tpuClient 
 . 
 updateNode 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callUpdateNode 
 (); 
 

updateNode(request, options, callback)

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

updateNode(request, callback)

  updateNode 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IUpdateNodeRequest 
 , 
  
 callback 
 : 
  
 Callback<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 INode 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 tpu 
 . 
 v2 
 . 
 IOperationMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
callback
Callback < LROperation < protos.google.cloud.tpu.v2.INode , protos.google.cloud.tpu.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type
Description
void
Create a Mobile Website
View Site in Mobile | Classic
Share by: