Class v2.FunctionServiceClient (4.1.0)

Google Cloud Functions is used to deploy functions that are executed by Google in response to various events. Data connected with that event is passed to a function as the input data.

A **function** is a resource which describes a function that should be executed and how it is triggered. v2

Package

@google-cloud/functions

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of FunctionServiceClient.

Parameters
NameDescription
optsClientOptions
gaxInstancetypeofgax | typeoffallback

: loaded instance ofgoogle-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 FunctionServiceClient({fallback: true}, gax); ```

Properties

apiEndpoint

getapiEndpoint():string;

The DNS address for this API service.

apiEndpoint

staticgetapiEndpoint():string;

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

auth

auth:gax.GoogleAuth;

descriptors

descriptors:Descriptors;

functionServiceStub

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

iamClient

iamClient:IamClient;

innerApiCalls

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

locationsClient

locationsClient:LocationsClient;

operationsClient

operationsClient:gax.OperationsClient;

pathTemplates

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

port

staticgetport():number;

The port for this API service.

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.

universeDomain

getuniverseDomain():string;

warn

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

Methods

buildPath(project, location, build)

buildPath(project:string,location:string,build:string):string;

Return a fully-qualified build resource name string.

Parameters
NameDescription
projectstring
locationstring
buildstring
Returns
TypeDescription
string

{string} Resource name string.

cancelOperation(request, optionsOrCallback, callback)

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

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returnsgoogle.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 toCode.CANCELLED.

Parameters
NameDescription
requestCancelOperationRequest

The request object that will be sent.

optionsOrCallbackCallOptions |Callback<protos.google.longrunning.CancelOperationRequest,protos.google.protobuf.Empty, {} | undefined | null>
callbackCallback<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
TypeDescription
Promise<protos.google.protobuf.Empty>
Example
constclient=longrunning.operationsClient();awaitclient.cancelOperation({name:''});

channelPath(project, location, channel)

channelPath(project:string,location:string,channel:string):string;

Return a fully-qualified channel resource name string.

Parameters
NameDescription
projectstring
locationstring
channelstring
Returns
TypeDescription
string

{string} Resource name string.

checkCreateFunctionProgress(name)

checkCreateFunctionProgress(name:string):Promise<LROperation<protos.google.cloud.functions.v2.Function,protos.google.cloud.functions.v2.OperationMetadata>>;

Check the status of the long running operation returned bycreateFunction().

Parameter
NameDescription
namestring

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.functions.v2.Function,protos.google.cloud.functions.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see thedocumentation 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 project and location in which the function should be created,   *  specified in the format `projects/* /locations/*`   */// const parent = 'abc123'/**   *  Required. Function to be created.   */// const function = {}/**   *  The ID to use for the function, which will become the final component of   *  the function's resource name.   *  This value should be 4-63 characters, and valid characters   *  are /[a-z][0-9]-/.   */// const functionId = 'abc123'// Imports the Functions libraryconst{FunctionServiceClient}=require('@google-cloud/functions').v2;// Instantiates a clientconstfunctionsClient=newFunctionServiceClient();asyncfunctioncallCreateFunction(){// Construct requestconstrequest={parent,function1,};// Run requestconst[operation]=awaitfunctionsClient.createFunction(request);const[response]=awaitoperation.promise();console.log(response);}callCreateFunction();

checkDeleteFunctionProgress(name)

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

Check the status of the long running operation returned bydeleteFunction().

Parameter
NameDescription
namestring

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.protobuf.Empty,protos.google.cloud.functions.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see thedocumentation 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 function which should be deleted.   */// const name = 'abc123'// Imports the Functions libraryconst{FunctionServiceClient}=require('@google-cloud/functions').v2;// Instantiates a clientconstfunctionsClient=newFunctionServiceClient();asyncfunctioncallDeleteFunction(){// Construct requestconstrequest={name,};// Run requestconst[operation]=awaitfunctionsClient.deleteFunction(request);const[response]=awaitoperation.promise();console.log(response);}callDeleteFunction();

checkUpdateFunctionProgress(name)

checkUpdateFunctionProgress(name:string):Promise<LROperation<protos.google.cloud.functions.v2.Function,protos.google.cloud.functions.v2.OperationMetadata>>;

Check the status of the long running operation returned byupdateFunction().

Parameter
NameDescription
namestring

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.functions.v2.Function,protos.google.cloud.functions.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see thedocumentation 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. New version of the function.   */// const function = {}/**   *  The list of fields to be updated.   *  If no field mask is provided, all fields will be updated.   */// const updateMask = {}// Imports the Functions libraryconst{FunctionServiceClient}=require('@google-cloud/functions').v2;// Instantiates a clientconstfunctionsClient=newFunctionServiceClient();asyncfunctioncallUpdateFunction(){// Construct requestconstrequest={function1,};// Run requestconst[operation]=awaitfunctionsClient.updateFunction(request);const[response]=awaitoperation.promise();console.log(response);}callUpdateFunction();

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.

connectorPath(project, location, connector)

connectorPath(project:string,location:string,connector:string):string;

Return a fully-qualified connector resource name string.

Parameters
NameDescription
projectstring
locationstring
connectorstring
Returns
TypeDescription
string

{string} Resource name string.

createFunction(request, options)

createFunction(request?:protos.google.cloud.functions.v2.ICreateFunctionRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation|undefined,{}|undefined]>;

Creates a new function. If a function with the given name already exists in the specified project, the long running operation will returnALREADY_EXISTS error.

Parameters
NameDescription
requestICreateFunctionRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Itspromise() method returns a promise you canawait for. Please see thedocumentation 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 project and location in which the function should be created,   *  specified in the format `projects/* /locations/*`   */// const parent = 'abc123'/**   *  Required. Function to be created.   */// const function = {}/**   *  The ID to use for the function, which will become the final component of   *  the function's resource name.   *  This value should be 4-63 characters, and valid characters   *  are /[a-z][0-9]-/.   */// const functionId = 'abc123'// Imports the Functions libraryconst{FunctionServiceClient}=require('@google-cloud/functions').v2;// Instantiates a clientconstfunctionsClient=newFunctionServiceClient();asyncfunctioncallCreateFunction(){// Construct requestconstrequest={parent,function1,};// Run requestconst[operation]=awaitfunctionsClient.createFunction(request);const[response]=awaitoperation.promise();console.log(response);}callCreateFunction();

createFunction(request, options, callback)

createFunction(request:protos.google.cloud.functions.v2.ICreateFunctionRequest,options:CallOptions,callback:Callback<LROperation<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestICreateFunctionRequest
optionsCallOptions
callbackCallback<LROperation<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createFunction(request, callback)

createFunction(request:protos.google.cloud.functions.v2.ICreateFunctionRequest,callback:Callback<LROperation<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestICreateFunctionRequest
callbackCallback<LROperation<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

cryptoKeyPath(project, location, keyRing, cryptoKey)

cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string):string;

Return a fully-qualified cryptoKey resource name string.

Parameters
NameDescription
projectstring
locationstring
keyRingstring
cryptoKeystring
Returns
TypeDescription
string

{string} Resource name string.

deleteFunction(request, options)

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

Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.

Parameters
NameDescription
requestIDeleteFunctionRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.protobuf.IEmpty,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Itspromise() method returns a promise you canawait for. Please see thedocumentation 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 function which should be deleted.   */// const name = 'abc123'// Imports the Functions libraryconst{FunctionServiceClient}=require('@google-cloud/functions').v2;// Instantiates a clientconstfunctionsClient=newFunctionServiceClient();asyncfunctioncallDeleteFunction(){// Construct requestconstrequest={name,};// Run requestconst[operation]=awaitfunctionsClient.deleteFunction(request);const[response]=awaitoperation.promise();console.log(response);}callDeleteFunction();

deleteFunction(request, options, callback)

deleteFunction(request:protos.google.cloud.functions.v2.IDeleteFunctionRequest,options:CallOptions,callback:Callback<LROperation<protos.google.protobuf.IEmpty,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIDeleteFunctionRequest
optionsCallOptions
callbackCallback<LROperation<protos.google.protobuf.IEmpty,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteFunction(request, callback)

deleteFunction(request:protos.google.cloud.functions.v2.IDeleteFunctionRequest,callback:Callback<LROperation<protos.google.protobuf.IEmpty,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIDeleteFunctionRequest
callbackCallback<LROperation<protos.google.protobuf.IEmpty,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteOperation(request, optionsOrCallback, callback)

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

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

Parameters
NameDescription
requestDeleteOperationRequest

The request object that will be sent.

optionsOrCallbackCallOptions |Callback<protos.google.protobuf.Empty,protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>
callbackCallback<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
TypeDescription
Promise<protos.google.protobuf.Empty>
Example
constclient=longrunning.operationsClient();awaitclient.deleteOperation({name:''});

functionPath(project, location, functionParam)

functionPath(project:string,location:string,functionParam:string):string;

Return a fully-qualified function resource name string.

Parameters
NameDescription
projectstring
locationstring
functionParamstring
Returns
TypeDescription
string

{string} Resource name string.

generateDownloadUrl(request, options)

generateDownloadUrl(request?:protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest,options?:CallOptions):Promise<[protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse,protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|undefined,{}|undefined]>;

Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see:https://cloud.google.com/storage/docs/access-control/signed-urls

Parameters
NameDescription
requestIGenerateDownloadUrlRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse,protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representingGenerateDownloadUrlResponse. Please see thedocumentation 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 function for which source code Google Cloud Storage   *  signed URL should be generated.   */// const name = 'abc123'// Imports the Functions libraryconst{FunctionServiceClient}=require('@google-cloud/functions').v2;// Instantiates a clientconstfunctionsClient=newFunctionServiceClient();asyncfunctioncallGenerateDownloadUrl(){// Construct requestconstrequest={name,};// Run requestconstresponse=awaitfunctionsClient.generateDownloadUrl(request);console.log(response);}callGenerateDownloadUrl();

generateDownloadUrl(request, options, callback)

generateDownloadUrl(request:protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest,options:CallOptions,callback:Callback<protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse,protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGenerateDownloadUrlRequest
optionsCallOptions
callbackCallback<protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse,protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

generateDownloadUrl(request, callback)

generateDownloadUrl(request:protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest,callback:Callback<protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse,protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGenerateDownloadUrlRequest
callbackCallback<protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse,protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

generateUploadUrl(request, options)

generateUploadUrl(request?:protos.google.cloud.functions.v2.IGenerateUploadUrlRequest,options?:CallOptions):Promise<[protos.google.cloud.functions.v2.IGenerateUploadUrlResponse,protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|undefined,{}|undefined]>;

Returns a signed URL for uploading a function source code. For more information about the signed URL usage see:https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code.

When uploading source code to the generated signed URL, please follow these restrictions:

* Source file type should be a zip file. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL.

When making a HTTP PUT request, specify this header:

*content-type: application/zip

Do not specify this header:

*Authorization: Bearer YOUR_TOKEN

Parameters
NameDescription
requestIGenerateUploadUrlRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.functions.v2.IGenerateUploadUrlResponse,protos.google.cloud.functions.v2.IGenerateUploadUrlRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representingGenerateUploadUrlResponse. Please see thedocumentation 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 project and location in which the Google Cloud Storage signed   *  URL should be generated, specified in the format `projects/* /locations/*`.   */// const parent = 'abc123'/**   *  Resource name of a KMS crypto key (managed by the user) used to   *  encrypt/decrypt function source code objects in intermediate Cloud Storage   *  buckets. When you generate an upload url and upload your source code, it   *  gets copied to an intermediate Cloud Storage bucket. The source code is   *  then copied to a versioned directory in the sources bucket in the consumer   *  project during the function deployment.   *  It must match the pattern   *  `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.   *  The Google Cloud Functions service account   *  (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be   *  granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter   *  (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the   *  Key/KeyRing/Project/Organization (least access preferred).   */// const kmsKeyName = 'abc123'/**   *  The function environment the generated upload url will be used for.   *  The upload url for 2nd Gen functions can also be used for 1st gen   *  functions, but not vice versa. If not specified, 2nd generation-style   *  upload URLs are generated.   */// const environment = {}// Imports the Functions libraryconst{FunctionServiceClient}=require('@google-cloud/functions').v2;// Instantiates a clientconstfunctionsClient=newFunctionServiceClient();asyncfunctioncallGenerateUploadUrl(){// Construct requestconstrequest={parent,};// Run requestconstresponse=awaitfunctionsClient.generateUploadUrl(request);console.log(response);}callGenerateUploadUrl();

generateUploadUrl(request, options, callback)

generateUploadUrl(request:protos.google.cloud.functions.v2.IGenerateUploadUrlRequest,options:CallOptions,callback:Callback<protos.google.cloud.functions.v2.IGenerateUploadUrlResponse,protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGenerateUploadUrlRequest
optionsCallOptions
callbackCallback<protos.google.cloud.functions.v2.IGenerateUploadUrlResponse,protos.google.cloud.functions.v2.IGenerateUploadUrlRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

generateUploadUrl(request, callback)

generateUploadUrl(request:protos.google.cloud.functions.v2.IGenerateUploadUrlRequest,callback:Callback<protos.google.cloud.functions.v2.IGenerateUploadUrlResponse,protos.google.cloud.functions.v2.IGenerateUploadUrlRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGenerateUploadUrlRequest
callbackCallback<protos.google.cloud.functions.v2.IGenerateUploadUrlResponse,protos.google.cloud.functions.v2.IGenerateUploadUrlRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getFunction(request, options)

getFunction(request?:protos.google.cloud.functions.v2.IGetFunctionRequest,options?:CallOptions):Promise<[protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IGetFunctionRequest|undefined,{}|undefined]>;

Returns a function with the given name from the requested project.

Parameters
NameDescription
requestIGetFunctionRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IGetFunctionRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see thedocumentation 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 function which details should be obtained.   */// const name = 'abc123'/**   *  Optional. The optional version of the 1st gen function whose details should   *  be obtained. The version of a 1st gen function is an integer that starts   *  from 1 and gets incremented on redeployments. GCF may keep historical   *  configs for old versions of 1st gen function. This field can be specified   *  to fetch the historical configs. This field is valid only for GCF 1st gen   *  function.   */// const revision = 'abc123'// Imports the Functions libraryconst{FunctionServiceClient}=require('@google-cloud/functions').v2;// Instantiates a clientconstfunctionsClient=newFunctionServiceClient();asyncfunctioncallGetFunction(){// Construct requestconstrequest={name,};// Run requestconstresponse=awaitfunctionsClient.getFunction(request);console.log(response);}callGetFunction();

getFunction(request, options, callback)

getFunction(request:protos.google.cloud.functions.v2.IGetFunctionRequest,options:CallOptions,callback:Callback<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IGetFunctionRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGetFunctionRequest
optionsCallOptions
callbackCallback<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IGetFunctionRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getFunction(request, callback)

getFunction(request:protos.google.cloud.functions.v2.IGetFunctionRequest,callback:Callback<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IGetFunctionRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGetFunctionRequest
callbackCallback<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IGetFunctionRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getIamPolicy(request, options, callback)

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

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

Parameters
NameDescription
requestIamProtos.google.iam.v1.GetIamPolicyRequest

The request object that will be sent.

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

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

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

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

The second parameter to the callback is an object representing .

Returns
TypeDescription
Promise<[google.iam.v1.Policy]>

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

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
NameDescription
requestLocationProtos.google.cloud.location.IGetLocationRequest

The request object that will be sent.

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

Call options. SeeCallOptions for more details.

callbackCallback<google.cloud.location.ILocation,google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
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 thedocumentation for more details and examples.

Example
const[response]=awaitclient.getLocation(request);

getOperation(request, optionsOrCallback, callback)

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

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

Parameters
NameDescription
requestGetOperationRequest

The request object that will be sent.

optionsOrCallbackCallOptions |Callback<protos.google.longrunning.Operation,protos.google.longrunning.GetOperationRequest, {} | null | undefined>
callbackCallback<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
TypeDescription
Promise<[protos.google.longrunning.Operation]>
Example
constclient=longrunning.operationsClient();constname='';const[response]=awaitclient.getOperation({name});// doThingsWith(response)

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

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.

listFunctions(request, options)

listFunctions(request?:protos.google.cloud.functions.v2.IListFunctionsRequest,options?:CallOptions):Promise<[protos.google.cloud.functions.v2.IFunction[],protos.google.cloud.functions.v2.IListFunctionsRequest|null,protos.google.cloud.functions.v2.IListFunctionsResponse]>;

Returns a list of functions that belong to the requested project.

Parameters
NameDescription
requestIListFunctionsRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.functions.v2.IFunction[],protos.google.cloud.functions.v2.IListFunctionsRequest | null,protos.google.cloud.functions.v2.IListFunctionsResponse ]>

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

listFunctions(request, options, callback)

listFunctions(request:protos.google.cloud.functions.v2.IListFunctionsRequest,options:CallOptions,callback:PaginationCallback<protos.google.cloud.functions.v2.IListFunctionsRequest,protos.google.cloud.functions.v2.IListFunctionsResponse|null|undefined,protos.google.cloud.functions.v2.IFunction>):void;
Parameters
NameDescription
requestIListFunctionsRequest
optionsCallOptions
callbackPaginationCallback<protos.google.cloud.functions.v2.IListFunctionsRequest,protos.google.cloud.functions.v2.IListFunctionsResponse | null | undefined,protos.google.cloud.functions.v2.IFunction>
Returns
TypeDescription
void

listFunctions(request, callback)

listFunctions(request:protos.google.cloud.functions.v2.IListFunctionsRequest,callback:PaginationCallback<protos.google.cloud.functions.v2.IListFunctionsRequest,protos.google.cloud.functions.v2.IListFunctionsResponse|null|undefined,protos.google.cloud.functions.v2.IFunction>):void;
Parameters
NameDescription
requestIListFunctionsRequest
callbackPaginationCallback<protos.google.cloud.functions.v2.IListFunctionsRequest,protos.google.cloud.functions.v2.IListFunctionsResponse | null | undefined,protos.google.cloud.functions.v2.IFunction>
Returns
TypeDescription
void

listFunctionsAsync(request, options)

listFunctionsAsync(request?:protos.google.cloud.functions.v2.IListFunctionsRequest,options?:CallOptions):AsyncIterable<protos.google.cloud.functions.v2.IFunction>;

Equivalent tolistFunctions, but returns an iterable object.

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

Parameters
NameDescription
requestIListFunctionsRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.functions.v2.IFunction>

{Object} An iterable Object that allowsasync 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 thedocumentation 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 project and location from which the function should be   *  listed, specified in the format `projects/* /locations/*` If you want to   *  list functions in all locations, use "-" in place of a location. When   *  listing functions in all locations, if one or more location(s) are   *  unreachable, the response will contain functions from all reachable   *  locations along with the names of any unreachable locations.   */// const parent = 'abc123'/**   *  Maximum number of functions to return per call. The largest allowed   *  page_size is 1,000, if the page_size is omitted or specified as greater   *  than 1,000 then it will be replaced as 1,000. The size of the list   *  response can be less than specified when used with filters.   */// const pageSize = 1234/**   *  The value returned by the last   *  `ListFunctionsResponse`; indicates that   *  this is a continuation of a prior `ListFunctions` call, and that the   *  system should return the next page of data.   */// const pageToken = 'abc123'/**   *  The filter for Functions that match the filter expression,   *  following the syntax outlined in https://google.aip.dev/160.   */// const filter = 'abc123'/**   *  The sorting order of the resources returned. Value should be a comma   *  separated list of fields. The default sorting order is ascending.   *  See https://google.aip.dev/132#ordering.   */// const orderBy = 'abc123'// Imports the Functions libraryconst{FunctionServiceClient}=require('@google-cloud/functions').v2;// Instantiates a clientconstfunctionsClient=newFunctionServiceClient();asyncfunctioncallListFunctions(){// Construct requestconstrequest={parent,};// Run requestconstiterable=functionsClient.listFunctionsAsync(request);forawait(constresponseofiterable){console.log(response);}}callListFunctions();

listFunctionsStream(request, options)

listFunctionsStream(request?:protos.google.cloud.functions.v2.IListFunctionsRequest,options?:CallOptions):Transform;

Equivalent tolistFunctions, but returns a NodeJS Stream object.

Parameters
NameDescription
requestIListFunctionsRequest

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 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 usinglistFunctionsAsync() method described below for async iteration which you can stop as needed. Please see thedocumentation 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
NameDescription
requestLocationProtos.google.cloud.location.IListLocationsRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
AsyncIterable<google.cloud.location.ILocation>

{Object} An iterable Object that allowsasync 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 thedocumentation for more details and examples.

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

listOperationsAsync(request, options)

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

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

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

Parameters
NameDescription
requestListOperationsRequest

The request object that will be sent.

optionsCallOptions

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

Returns
TypeDescription
AsyncIterable<protos.google.longrunning.IOperation>

{Object} An iterable Object that conforms toiteration protocols.

Example
constclient=longrunning.operationsClient();forawait(constresponseofclient.listOperationsAsync(request));// doThingsWith(response)

listRuntimes(request, options)

listRuntimes(request?:protos.google.cloud.functions.v2.IListRuntimesRequest,options?:CallOptions):Promise<[protos.google.cloud.functions.v2.IListRuntimesResponse,protos.google.cloud.functions.v2.IListRuntimesRequest|undefined,{}|undefined]>;

Returns a list of runtimes that are supported for the requested project.

Parameters
NameDescription
requestIListRuntimesRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.functions.v2.IListRuntimesResponse,protos.google.cloud.functions.v2.IListRuntimesRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see thedocumentation 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 project and location from which the runtimes should be   *  listed, specified in the format `projects/* /locations/*`   */// const parent = 'abc123'/**   *  The filter for Runtimes that match the filter expression,   *  following the syntax outlined in https://google.aip.dev/160.   */// const filter = 'abc123'// Imports the Functions libraryconst{FunctionServiceClient}=require('@google-cloud/functions').v2;// Instantiates a clientconstfunctionsClient=newFunctionServiceClient();asyncfunctioncallListRuntimes(){// Construct requestconstrequest={parent,};// Run requestconstresponse=awaitfunctionsClient.listRuntimes(request);console.log(response);}callListRuntimes();

listRuntimes(request, options, callback)

listRuntimes(request:protos.google.cloud.functions.v2.IListRuntimesRequest,options:CallOptions,callback:Callback<protos.google.cloud.functions.v2.IListRuntimesResponse,protos.google.cloud.functions.v2.IListRuntimesRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIListRuntimesRequest
optionsCallOptions
callbackCallback<protos.google.cloud.functions.v2.IListRuntimesResponse,protos.google.cloud.functions.v2.IListRuntimesRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

listRuntimes(request, callback)

listRuntimes(request:protos.google.cloud.functions.v2.IListRuntimesRequest,callback:Callback<protos.google.cloud.functions.v2.IListRuntimesResponse,protos.google.cloud.functions.v2.IListRuntimesRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIListRuntimesRequest
callbackCallback<protos.google.cloud.functions.v2.IListRuntimesResponse,protos.google.cloud.functions.v2.IListRuntimesRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

locationPath(project, location)

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

Return a fully-qualified location resource name string.

Parameters
NameDescription
projectstring
locationstring
Returns
TypeDescription
string

{string} Resource name string.

matchBuildFromBuildName(buildName)

matchBuildFromBuildName(buildName:string):string|number;

Parse the build from Build resource.

Parameter
NameDescription
buildNamestring

A fully-qualified path representing Build resource.

Returns
TypeDescription
string | number

{string} A string representing the build.

matchChannelFromChannelName(channelName)

matchChannelFromChannelName(channelName:string):string|number;

Parse the channel from Channel resource.

Parameter
NameDescription
channelNamestring

A fully-qualified path representing Channel resource.

Returns
TypeDescription
string | number

{string} A string representing the channel.

matchConnectorFromConnectorName(connectorName)

matchConnectorFromConnectorName(connectorName:string):string|number;

Parse the connector from Connector resource.

Parameter
NameDescription
connectorNamestring

A fully-qualified path representing Connector resource.

Returns
TypeDescription
string | number

{string} A string representing the connector.

matchCryptoKeyFromCryptoKeyName(cryptoKeyName)

matchCryptoKeyFromCryptoKeyName(cryptoKeyName:string):string|number;

Parse the crypto_key from CryptoKey resource.

Parameter
NameDescription
cryptoKeyNamestring

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the crypto_key.

matchFunctionFromFunctionName(functionName)

matchFunctionFromFunctionName(functionName:string):string|number;

Parse the function from Function resource.

Parameter
NameDescription
functionNamestring

A fully-qualified path representing Function resource.

Returns
TypeDescription
string | number

{string} A string representing the function.

matchKeyRingFromCryptoKeyName(cryptoKeyName)

matchKeyRingFromCryptoKeyName(cryptoKeyName:string):string|number;

Parse the key_ring from CryptoKey resource.

Parameter
NameDescription
cryptoKeyNamestring

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the key_ring.

matchLocationFromBuildName(buildName)

matchLocationFromBuildName(buildName:string):string|number;

Parse the location from Build resource.

Parameter
NameDescription
buildNamestring

A fully-qualified path representing Build resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromChannelName(channelName)

matchLocationFromChannelName(channelName:string):string|number;

Parse the location from Channel resource.

Parameter
NameDescription
channelNamestring

A fully-qualified path representing Channel resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromConnectorName(connectorName)

matchLocationFromConnectorName(connectorName:string):string|number;

Parse the location from Connector resource.

Parameter
NameDescription
connectorNamestring

A fully-qualified path representing Connector resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromCryptoKeyName(cryptoKeyName)

matchLocationFromCryptoKeyName(cryptoKeyName:string):string|number;

Parse the location from CryptoKey resource.

Parameter
NameDescription
cryptoKeyNamestring

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromFunctionName(functionName)

matchLocationFromFunctionName(functionName:string):string|number;

Parse the location from Function resource.

Parameter
NameDescription
functionNamestring

A fully-qualified path representing Function resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName:string):string|number;

Parse the location from Location resource.

Parameter
NameDescription
locationNamestring

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromRepositoryName(repositoryName)

matchLocationFromRepositoryName(repositoryName:string):string|number;

Parse the location from Repository resource.

Parameter
NameDescription
repositoryNamestring

A fully-qualified path representing Repository resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromServiceName(serviceName)

matchLocationFromServiceName(serviceName:string):string|number;

Parse the location from Service resource.

Parameter
NameDescription
serviceNamestring

A fully-qualified path representing Service resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromTriggerName(triggerName)

matchLocationFromTriggerName(triggerName:string):string|number;

Parse the location from Trigger resource.

Parameter
NameDescription
triggerNamestring

A fully-qualified path representing Trigger resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromWorkerPoolName(workerPoolName)

matchLocationFromWorkerPoolName(workerPoolName:string):string|number;

Parse the location from WorkerPool resource.

Parameter
NameDescription
workerPoolNamestring

A fully-qualified path representing WorkerPool resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchProjectFromBuildName(buildName)

matchProjectFromBuildName(buildName:string):string|number;

Parse the project from Build resource.

Parameter
NameDescription
buildNamestring

A fully-qualified path representing Build resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromChannelName(channelName)

matchProjectFromChannelName(channelName:string):string|number;

Parse the project from Channel resource.

Parameter
NameDescription
channelNamestring

A fully-qualified path representing Channel resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromConnectorName(connectorName)

matchProjectFromConnectorName(connectorName:string):string|number;

Parse the project from Connector resource.

Parameter
NameDescription
connectorNamestring

A fully-qualified path representing Connector resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromCryptoKeyName(cryptoKeyName)

matchProjectFromCryptoKeyName(cryptoKeyName:string):string|number;

Parse the project from CryptoKey resource.

Parameter
NameDescription
cryptoKeyNamestring

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromFunctionName(functionName)

matchProjectFromFunctionName(functionName:string):string|number;

Parse the project from Function resource.

Parameter
NameDescription
functionNamestring

A fully-qualified path representing Function resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName:string):string|number;

Parse the project from Location resource.

Parameter
NameDescription
locationNamestring

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectName(projectName)

matchProjectFromProjectName(projectName:string):string|number;

Parse the project from Project resource.

Parameter
NameDescription
projectNamestring

A fully-qualified path representing Project resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromRepositoryName(repositoryName)

matchProjectFromRepositoryName(repositoryName:string):string|number;

Parse the project from Repository resource.

Parameter
NameDescription
repositoryNamestring

A fully-qualified path representing Repository resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromServiceName(serviceName)

matchProjectFromServiceName(serviceName:string):string|number;

Parse the project from Service resource.

Parameter
NameDescription
serviceNamestring

A fully-qualified path representing Service resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromTopicName(topicName)

matchProjectFromTopicName(topicName:string):string|number;

Parse the project from Topic resource.

Parameter
NameDescription
topicNamestring

A fully-qualified path representing Topic resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromTriggerName(triggerName)

matchProjectFromTriggerName(triggerName:string):string|number;

Parse the project from Trigger resource.

Parameter
NameDescription
triggerNamestring

A fully-qualified path representing Trigger resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromWorkerPoolName(workerPoolName)

matchProjectFromWorkerPoolName(workerPoolName:string):string|number;

Parse the project from WorkerPool resource.

Parameter
NameDescription
workerPoolNamestring

A fully-qualified path representing WorkerPool resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchRepositoryFromRepositoryName(repositoryName)

matchRepositoryFromRepositoryName(repositoryName:string):string|number;

Parse the repository from Repository resource.

Parameter
NameDescription
repositoryNamestring

A fully-qualified path representing Repository resource.

Returns
TypeDescription
string | number

{string} A string representing the repository.

matchServiceFromServiceName(serviceName)

matchServiceFromServiceName(serviceName:string):string|number;

Parse the service from Service resource.

Parameter
NameDescription
serviceNamestring

A fully-qualified path representing Service resource.

Returns
TypeDescription
string | number

{string} A string representing the service.

matchTopicFromTopicName(topicName)

matchTopicFromTopicName(topicName:string):string|number;

Parse the topic from Topic resource.

Parameter
NameDescription
topicNamestring

A fully-qualified path representing Topic resource.

Returns
TypeDescription
string | number

{string} A string representing the topic.

matchTriggerFromTriggerName(triggerName)

matchTriggerFromTriggerName(triggerName:string):string|number;

Parse the trigger from Trigger resource.

Parameter
NameDescription
triggerNamestring

A fully-qualified path representing Trigger resource.

Returns
TypeDescription
string | number

{string} A string representing the trigger.

matchWorkerPoolFromWorkerPoolName(workerPoolName)

matchWorkerPoolFromWorkerPoolName(workerPoolName:string):string|number;

Parse the worker_pool from WorkerPool resource.

Parameter
NameDescription
workerPoolNamestring

A fully-qualified path representing WorkerPool resource.

Returns
TypeDescription
string | number

{string} A string representing the worker_pool.

projectPath(project)

projectPath(project:string):string;

Return a fully-qualified project resource name string.

Parameter
NameDescription
projectstring
Returns
TypeDescription
string

{string} Resource name string.

repositoryPath(project, location, repository)

repositoryPath(project:string,location:string,repository:string):string;

Return a fully-qualified repository resource name string.

Parameters
NameDescription
projectstring
locationstring
repositorystring
Returns
TypeDescription
string

{string} Resource name string.

servicePath(project, location, service)

servicePath(project:string,location:string,service:string):string;

Return a fully-qualified service resource name string.

Parameters
NameDescription
projectstring
locationstring
servicestring
Returns
TypeDescription
string

{string} Resource name string.

setIamPolicy(request, options, callback)

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

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

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

Parameters
NameDescription
requestIamProtos.google.iam.v1.SetIamPolicyRequest

The request object that will be sent.

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

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

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

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

The second parameter to the callback is an object representing .

Returns
TypeDescription
Promise<[google.iam.v1.Policy]>

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

testIamPermissions(request, options, callback)

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

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

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

Parameters
NameDescription
requestIamProtos.google.iam.v1.TestIamPermissionsRequest

The request object that will be sent.

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

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

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

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

The second parameter to the callback is an object representing .

Returns
TypeDescription
Promise<[google.iam.v1.TestIamPermissionsResponse]>

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

topicPath(project, topic)

topicPath(project:string,topic:string):string;

Return a fully-qualified topic resource name string.

Parameters
NameDescription
projectstring
topicstring
Returns
TypeDescription
string

{string} Resource name string.

triggerPath(project, location, trigger)

triggerPath(project:string,location:string,trigger:string):string;

Return a fully-qualified trigger resource name string.

Parameters
NameDescription
projectstring
locationstring
triggerstring
Returns
TypeDescription
string

{string} Resource name string.

updateFunction(request, options)

updateFunction(request?:protos.google.cloud.functions.v2.IUpdateFunctionRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation|undefined,{}|undefined]>;

Updates existing function.

Parameters
NameDescription
requestIUpdateFunctionRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Itspromise() method returns a promise you canawait for. Please see thedocumentation 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. New version of the function.   */// const function = {}/**   *  The list of fields to be updated.   *  If no field mask is provided, all fields will be updated.   */// const updateMask = {}// Imports the Functions libraryconst{FunctionServiceClient}=require('@google-cloud/functions').v2;// Instantiates a clientconstfunctionsClient=newFunctionServiceClient();asyncfunctioncallUpdateFunction(){// Construct requestconstrequest={function1,};// Run requestconst[operation]=awaitfunctionsClient.updateFunction(request);const[response]=awaitoperation.promise();console.log(response);}callUpdateFunction();

updateFunction(request, options, callback)

updateFunction(request:protos.google.cloud.functions.v2.IUpdateFunctionRequest,options:CallOptions,callback:Callback<LROperation<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIUpdateFunctionRequest
optionsCallOptions
callbackCallback<LROperation<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateFunction(request, callback)

updateFunction(request:protos.google.cloud.functions.v2.IUpdateFunctionRequest,callback:Callback<LROperation<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIUpdateFunctionRequest
callbackCallback<LROperation<protos.google.cloud.functions.v2.IFunction,protos.google.cloud.functions.v2.IOperationMetadata>,protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

workerPoolPath(project, location, workerPool)

workerPoolPath(project:string,location:string,workerPool:string):string;

Return a fully-qualified workerPool resource name string.

Parameters
NameDescription
projectstring
locationstring
workerPoolstring
Returns
TypeDescription
string

{string} Resource name string.

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-10-30 UTC.