Class v1.RoutersClient (3.0.0)

The Routers API. v1

Package

@google-cloud/compute

Constructors

(constructor)(opts)

constructor(opts?:ClientOptions);

Construct an instance of RoutersClient.

Parameter
NameDescription
optsClientOptions

Properties

apiEndpoint

staticgetapiEndpoint():string;

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

auth

auth:gax.GoogleAuth;

descriptors

descriptors:Descriptors;

innerApiCalls

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

port

staticgetport():number;

The port for this API service.

routersStub

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

scopes

staticgetscopes():string[];

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

servicePath

staticgetservicePath():string;

The DNS address for this API service.

warn

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

Methods

aggregatedListAsync(request, options)

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

Equivalent toaggregatedList, but returns an iterable object.

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

Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IAggregatedListRoutersRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

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

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

Example
constiterable=client.aggregatedListAsync(request);forawait(const[key,value]ofiterable){// process response}

close()

close():Promise<void>;

Terminate the gRPC channel and close the client.

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

Returns
TypeDescription
Promise<void>

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

delete(request, options)

delete(request?:protos.google.cloud.compute.v1.IDeleteRouterRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IDeleteRouterRequest
optionsCallOptions
Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

delete(request, options, callback)

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

delete(request, callback)

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

get(request, options)

get(request?:protos.google.cloud.compute.v1.IGetRouterRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IRouter,protos.google.cloud.compute.v1.IGetRouterRequest|undefined,{}|undefined]>;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IGetRouterRequest
optionsCallOptions
Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IRouter, protos.google.cloud.compute.v1.IGetRouterRequest | undefined, {} | undefined ]>

get(request, options, callback)

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

get(request, callback)

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

getNatMappingInfo(request, options)

getNatMappingInfo(request?:protos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IVmEndpointNatMappings[],protos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest|null,protos.google.cloud.compute.v1.IVmEndpointNatMappingsList]>;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest
optionsCallOptions
Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IVmEndpointNatMappings[], protos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest | null, protos.google.cloud.compute.v1.IVmEndpointNatMappingsList ]>

getNatMappingInfo(request, options, callback)

getNatMappingInfo(request:protos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest,options:CallOptions,callback:PaginationCallback<protos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest,protos.google.cloud.compute.v1.IVmEndpointNatMappingsList|null|undefined,protos.google.cloud.compute.v1.IVmEndpointNatMappings>):void;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest
optionsCallOptions
callbackPaginationCallback<protos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest, protos.google.cloud.compute.v1.IVmEndpointNatMappingsList | null | undefined, protos.google.cloud.compute.v1.IVmEndpointNatMappings>
Returns
TypeDescription
void

getNatMappingInfo(request, callback)

getNatMappingInfo(request:protos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest,callback:PaginationCallback<protos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest,protos.google.cloud.compute.v1.IVmEndpointNatMappingsList|null|undefined,protos.google.cloud.compute.v1.IVmEndpointNatMappings>):void;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest
callbackPaginationCallback<protos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest, protos.google.cloud.compute.v1.IVmEndpointNatMappingsList | null | undefined, protos.google.cloud.compute.v1.IVmEndpointNatMappings>
Returns
TypeDescription
void

getNatMappingInfoAsync(request, options)

getNatMappingInfoAsync(request?:protos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest,options?:CallOptions):AsyncIterable<protos.google.cloud.compute.v1.IVmEndpointNatMappings>;

Equivalent togetNatMappingInfo, but returns an iterable object.

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

Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

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

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

Example
constiterable=client.getNatMappingInfoAsync(request);forawait(constresponseofiterable){// process response}

getNatMappingInfoStream(request, options)

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

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

Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IGetNatMappingInfoRoutersRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [VmEndpointNatMappings] 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 usinggetNatMappingInfoAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

getProjectId()

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

getProjectId(callback)

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

getRouterStatus(request, options)

getRouterStatus(request?:protos.google.cloud.compute.v1.IGetRouterStatusRouterRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IRouterStatusResponse,protos.google.cloud.compute.v1.IGetRouterStatusRouterRequest|undefined,{}|undefined]>;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IGetRouterStatusRouterRequest
optionsCallOptions
Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IRouterStatusResponse, protos.google.cloud.compute.v1.IGetRouterStatusRouterRequest | undefined, {} | undefined ]>

getRouterStatus(request, options, callback)

getRouterStatus(request:protos.google.cloud.compute.v1.IGetRouterStatusRouterRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IRouterStatusResponse,protos.google.cloud.compute.v1.IGetRouterStatusRouterRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IGetRouterStatusRouterRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1.IRouterStatusResponse, protos.google.cloud.compute.v1.IGetRouterStatusRouterRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getRouterStatus(request, callback)

getRouterStatus(request:protos.google.cloud.compute.v1.IGetRouterStatusRouterRequest,callback:Callback<protos.google.cloud.compute.v1.IRouterStatusResponse,protos.google.cloud.compute.v1.IGetRouterStatusRouterRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IGetRouterStatusRouterRequest
callbackCallback<protos.google.cloud.compute.v1.IRouterStatusResponse, protos.google.cloud.compute.v1.IGetRouterStatusRouterRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

initialize()

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

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

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

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

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

insert(request, options)

insert(request?:protos.google.cloud.compute.v1.IInsertRouterRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IInsertRouterRequest
optionsCallOptions
Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

insert(request, options, callback)

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

insert(request, callback)

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

list(request, options)

list(request?:protos.google.cloud.compute.v1.IListRoutersRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IRouter[],protos.google.cloud.compute.v1.IListRoutersRequest|null,protos.google.cloud.compute.v1.IRouterList]>;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IListRoutersRequest
optionsCallOptions
Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IRouter[], protos.google.cloud.compute.v1.IListRoutersRequest | null, protos.google.cloud.compute.v1.IRouterList ]>

list(request, options, callback)

list(request:protos.google.cloud.compute.v1.IListRoutersRequest,options:CallOptions,callback:PaginationCallback<protos.google.cloud.compute.v1.IListRoutersRequest,protos.google.cloud.compute.v1.IRouterList|null|undefined,protos.google.cloud.compute.v1.IRouter>):void;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IListRoutersRequest
optionsCallOptions
callbackPaginationCallback<protos.google.cloud.compute.v1.IListRoutersRequest, protos.google.cloud.compute.v1.IRouterList | null | undefined, protos.google.cloud.compute.v1.IRouter>
Returns
TypeDescription
void

list(request, callback)

list(request:protos.google.cloud.compute.v1.IListRoutersRequest,callback:PaginationCallback<protos.google.cloud.compute.v1.IListRoutersRequest,protos.google.cloud.compute.v1.IRouterList|null|undefined,protos.google.cloud.compute.v1.IRouter>):void;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IListRoutersRequest
callbackPaginationCallback<protos.google.cloud.compute.v1.IListRoutersRequest, protos.google.cloud.compute.v1.IRouterList | null | undefined, protos.google.cloud.compute.v1.IRouter>
Returns
TypeDescription
void

listAsync(request, options)

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

Equivalent tolist, but returns an iterable object.

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

Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IListRoutersRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

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

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

Example
constiterable=client.listAsync(request);forawait(constresponseofiterable){// process response}

listStream(request, options)

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

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

Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IListRoutersRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [Router] 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 usinglistAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

patch(request, options)

patch(request?:protos.google.cloud.compute.v1.IPatchRouterRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IPatchRouterRequest
optionsCallOptions
Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

patch(request, options, callback)

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

patch(request, callback)

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

preview(request, options)

preview(request?:protos.google.cloud.compute.v1.IPreviewRouterRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IRoutersPreviewResponse,protos.google.cloud.compute.v1.IPreviewRouterRequest|undefined,{}|undefined]>;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IPreviewRouterRequest
optionsCallOptions
Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IRoutersPreviewResponse, protos.google.cloud.compute.v1.IPreviewRouterRequest | undefined, {} | undefined ]>

preview(request, options, callback)

preview(request:protos.google.cloud.compute.v1.IPreviewRouterRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IRoutersPreviewResponse,protos.google.cloud.compute.v1.IPreviewRouterRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IPreviewRouterRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1.IRoutersPreviewResponse, protos.google.cloud.compute.v1.IPreviewRouterRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

preview(request, callback)

preview(request:protos.google.cloud.compute.v1.IPreviewRouterRequest,callback:Callback<protos.google.cloud.compute.v1.IRoutersPreviewResponse,protos.google.cloud.compute.v1.IPreviewRouterRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IPreviewRouterRequest
callbackCallback<protos.google.cloud.compute.v1.IRoutersPreviewResponse, protos.google.cloud.compute.v1.IPreviewRouterRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

update(request, options)

update(request?:protos.google.cloud.compute.v1.IUpdateRouterRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Parameters
NameDescription
requestprotos.google.cloud.compute.v1.IUpdateRouterRequest
optionsCallOptions
Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

update(request, options, callback)

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

update(request, callback)

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

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-03 UTC.