Class v2.FunctionServiceClient (3.6.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?: typeof gax | typeof gax.fallback);

Construct an instance of FunctionServiceClient.

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

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

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

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

servicePath

static get servicePath(): string;

The DNS address for this API service.

universeDomain

get universeDomain(): string;

warn

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

Methods

buildPath(project, location, build)

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

Return a fully-qualified build resource name string.

Parameters
Name Description
project string
location string
build 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
Promise<protos.google.protobuf.Empty>
Example

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

channelPath(project, location, channel)

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

Return a fully-qualified channel resource name string.

Parameters
Name Description
project string
location string
channel string
Returns
Type Description
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 by createFunction().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
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 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 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 library
  const {FunctionServiceClient} = require('@google-cloud/functions').v2;

  // Instantiates a client
  const functionsClient = new FunctionServiceClient();

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

    // Run request
    const [operation] = await functionsClient.createFunction(request);
    const [response] = await operation.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 by deleteFunction().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
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 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 function which should be deleted.
   */
  // const name = 'abc123'

  // Imports the Functions library
  const {FunctionServiceClient} = require('@google-cloud/functions').v2;

  // Instantiates a client
  const functionsClient = new FunctionServiceClient();

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

    // Run request
    const [operation] = await functionsClient.deleteFunction(request);
    const [response] = await operation.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 by updateFunction().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
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 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. 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 library
  const {FunctionServiceClient} = require('@google-cloud/functions').v2;

  // Instantiates a client
  const functionsClient = new FunctionServiceClient();

  async function callUpdateFunction() {
    // Construct request
    const request = {
      function1,
    };

    // Run request
    const [operation] = await functionsClient.updateFunction(request);
    const [response] = await operation.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
Type Description
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
Name Description
project string
location string
connector string
Returns
Type Description
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 return ALREADY_EXISTS error.

Parameters
Name Description
request ICreateFunctionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
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. 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 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 library
  const {FunctionServiceClient} = require('@google-cloud/functions').v2;

  // Instantiates a client
  const functionsClient = new FunctionServiceClient();

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

    // Run request
    const [operation] = await functionsClient.createFunction(request);
    const [response] = await operation.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
Name Description
request 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>
Returns
Type Description
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
Name Description
request ICreateFunctionRequest
callback Callback<LROperation<protos.google.cloud.functions.v2.IFunction, protos.google.cloud.functions.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
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
Name Description
project string
location string
keyRing string
cryptoKey string
Returns
Type Description
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
Name Description
request IDeleteFunctionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.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. 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 function which should be deleted.
   */
  // const name = 'abc123'

  // Imports the Functions library
  const {FunctionServiceClient} = require('@google-cloud/functions').v2;

  // Instantiates a client
  const functionsClient = new FunctionServiceClient();

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

    // Run request
    const [operation] = await functionsClient.deleteFunction(request);
    const [response] = await operation.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
Name Description
request IDeleteFunctionRequest
options CallOptions
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.functions.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
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
Name Description
request IDeleteFunctionRequest
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.functions.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
Promise<protos.google.protobuf.Empty>
Example

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

functionPath(project, location, functionParam)

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

Return a fully-qualified function resource name string.

Parameters
Name Description
project string
location string
functionParam string
Returns
Type Description
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
Name Description
request IGenerateDownloadUrlRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
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 representing GenerateDownloadUrlResponse. 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 function for which source code Google Cloud Storage
   *  signed URL should be generated.
   */
  // const name = 'abc123'

  // Imports the Functions library
  const {FunctionServiceClient} = require('@google-cloud/functions').v2;

  // Instantiates a client
  const functionsClient = new FunctionServiceClient();

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

    // Run request
    const response = await functionsClient.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
Name Description
request IGenerateDownloadUrlRequest
options CallOptions
callback Callback<protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest | null | undefined, {} | null | undefined>
Returns
Type Description
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
Name Description
request IGenerateDownloadUrlRequest
callback Callback<protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest | null | undefined, {} | null | undefined>
Returns
Type Description
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
Name Description
request IGenerateUploadUrlRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
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 representing GenerateUploadUrlResponse. 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 project and location in which the Google Cloud Storage signed
   *  URL should be generated, specified in the format `projects/* /locations/*`.
   */
  // const parent = 'abc123'
  /**
   *  Preview  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 library
  const {FunctionServiceClient} = require('@google-cloud/functions').v2;

  // Instantiates a client
  const functionsClient = new FunctionServiceClient();

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

    // Run request
    const response = await functionsClient.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
Name Description
request IGenerateUploadUrlRequest
options CallOptions
callback Callback<protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, protos.google.cloud.functions.v2.IGenerateUploadUrlRequest | null | undefined, {} | null | undefined>
Returns
Type Description
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
Name Description
request IGenerateUploadUrlRequest
callback Callback<protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, protos.google.cloud.functions.v2.IGenerateUploadUrlRequest | null | undefined, {} | null | undefined>
Returns
Type Description
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
Name Description
request IGetFunctionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
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 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 function which details should be obtained.
   */
  // const name = 'abc123'
  /**
   *  Optional. The 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 library
  const {FunctionServiceClient} = require('@google-cloud/functions').v2;

  // Instantiates a client
  const functionsClient = new FunctionServiceClient();

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

    // Run request
    const response = await functionsClient.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
Name Description
request IGetFunctionRequest
options CallOptions
callback Callback<protos.google.cloud.functions.v2.IFunction, protos.google.cloud.functions.v2.IGetFunctionRequest | null | undefined, {} | null | undefined>
Returns
Type Description
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
Name Description
request IGetFunctionRequest
callback Callback<protos.google.cloud.functions.v2.IFunction, protos.google.cloud.functions.v2.IGetFunctionRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getIamPolicy(request, options, callback)

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

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

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

The request object that will be sent.

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

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

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

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

The second parameter to the callback is an object representing .

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

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

getLocation(request, options, callback)

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

Gets information about a location.

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

The request object that will be sent.

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

Call options. See CallOptions for more details.

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

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

Example

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

getOperation(request, 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
Promise<[protos.google.longrunning.Operation]>
Example

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

getProjectId()

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

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
void

initialize()

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

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

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

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

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

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
Name Description
request IListFunctionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
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 using listFunctionsAsync() method described below for async iteration which you can stop as needed. Please see the documentation 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
Name Description
request 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>
Returns
Type Description
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
Name Description
request IListFunctionsRequest
callback PaginationCallback<protos.google.cloud.functions.v2.IListFunctionsRequest, protos.google.cloud.functions.v2.IListFunctionsResponse | null | undefined, protos.google.cloud.functions.v2.IFunction>
Returns
Type Description
void

listFunctionsAsync(request, options)

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

Equivalent to listFunctions, but returns an iterable object.

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

Parameters
Name Description
request IListFunctionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.functions.v2.IFunction>

{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 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 oder is ascending.
   *  See https://google.aip.dev/132#ordering.
   */
  // const orderBy = 'abc123'

  // Imports the Functions library
  const {FunctionServiceClient} = require('@google-cloud/functions').v2;

  // Instantiates a client
  const functionsClient = new FunctionServiceClient();

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

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

  callListFunctions();

listFunctionsStream(request, options)

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

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

Parameters
Name Description
request IListFunctionsRequest

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

listLocationsAsync(request, options)

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

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

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

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

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

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

listOperationsAsync(request, options)

listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.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
AsyncIterable<protos.google.longrunning.ListOperationsResponse>

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

Example

const client = longrunning.operationsClient();
for await (const response of client.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
Name Description
request IListRuntimesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
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 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 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 library
  const {FunctionServiceClient} = require('@google-cloud/functions').v2;

  // Instantiates a client
  const functionsClient = new FunctionServiceClient();

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

    // Run request
    const response = await functionsClient.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
Name Description
request IListRuntimesRequest
options CallOptions
callback Callback<protos.google.cloud.functions.v2.IListRuntimesResponse, protos.google.cloud.functions.v2.IListRuntimesRequest | null | undefined, {} | null | undefined>
Returns
Type Description
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
Name Description
request IListRuntimesRequest
callback Callback<protos.google.cloud.functions.v2.IListRuntimesResponse, protos.google.cloud.functions.v2.IListRuntimesRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

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.

matchBuildFromBuildName(buildName)

matchBuildFromBuildName(buildName: string): string | number;

Parse the build from Build resource.

Parameter
Name Description
buildName string

A fully-qualified path representing Build resource.

Returns
Type Description
string | number

{string} A string representing the build.

matchChannelFromChannelName(channelName)

matchChannelFromChannelName(channelName: string): string | number;

Parse the channel from Channel resource.

Parameter
Name Description
channelName string

A fully-qualified path representing Channel resource.

Returns
Type Description
string | number

{string} A string representing the channel.

matchConnectorFromConnectorName(connectorName)

matchConnectorFromConnectorName(connectorName: string): string | number;

Parse the connector from Connector resource.

Parameter
Name Description
connectorName string

A fully-qualified path representing Connector resource.

Returns
Type Description
string | number

{string} A string representing the connector.

matchCryptoKeyFromCryptoKeyName(cryptoKeyName)

matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the crypto_key from CryptoKey resource.

Parameter
Name Description
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
Type Description
string | number

{string} A string representing the crypto_key.

matchFunctionFromFunctionName(functionName)

matchFunctionFromFunctionName(functionName: string): string | number;

Parse the function from Function resource.

Parameter
Name Description
functionName string

A fully-qualified path representing Function resource.

Returns
Type Description
string | number

{string} A string representing the function.

matchKeyRingFromCryptoKeyName(cryptoKeyName)

matchKeyRingFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the key_ring from CryptoKey resource.

Parameter
Name Description
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
Type Description
string | number

{string} A string representing the key_ring.

matchLocationFromBuildName(buildName)

matchLocationFromBuildName(buildName: string): string | number;

Parse the location from Build resource.

Parameter
Name Description
buildName string

A fully-qualified path representing Build resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromChannelName(channelName)

matchLocationFromChannelName(channelName: string): string | number;

Parse the location from Channel resource.

Parameter
Name Description
channelName string

A fully-qualified path representing Channel resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromConnectorName(connectorName)

matchLocationFromConnectorName(connectorName: string): string | number;

Parse the location from Connector resource.

Parameter
Name Description
connectorName string

A fully-qualified path representing Connector resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromCryptoKeyName(cryptoKeyName)

matchLocationFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the location from CryptoKey resource.

Parameter
Name Description
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromFunctionName(functionName)

matchLocationFromFunctionName(functionName: string): string | number;

Parse the location from Function resource.

Parameter
Name Description
functionName string

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

matchLocationFromRepositoryName(repositoryName)

matchLocationFromRepositoryName(repositoryName: string): string | number;

Parse the location from Repository resource.

Parameter
Name Description
repositoryName string

A fully-qualified path representing Repository resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromServiceName(serviceName)

matchLocationFromServiceName(serviceName: string): string | number;

Parse the location from Service resource.

Parameter
Name Description
serviceName string

A fully-qualified path representing Service resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromTriggerName(triggerName)

matchLocationFromTriggerName(triggerName: string): string | number;

Parse the location from Trigger resource.

Parameter
Name Description
triggerName string

A fully-qualified path representing Trigger resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromWorkerPoolName(workerPoolName)

matchLocationFromWorkerPoolName(workerPoolName: string): string | number;

Parse the location from WorkerPool resource.

Parameter
Name Description
workerPoolName string

A fully-qualified path representing WorkerPool resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchProjectFromBuildName(buildName)

matchProjectFromBuildName(buildName: string): string | number;

Parse the project from Build resource.

Parameter
Name Description
buildName string

A fully-qualified path representing Build resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromChannelName(channelName)

matchProjectFromChannelName(channelName: string): string | number;

Parse the project from Channel resource.

Parameter
Name Description
channelName string

A fully-qualified path representing Channel resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromConnectorName(connectorName)

matchProjectFromConnectorName(connectorName: string): string | number;

Parse the project from Connector resource.

Parameter
Name Description
connectorName string

A fully-qualified path representing Connector resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromCryptoKeyName(cryptoKeyName)

matchProjectFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the project from CryptoKey resource.

Parameter
Name Description
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromFunctionName(functionName)

matchProjectFromFunctionName(functionName: string): string | number;

Parse the project from Function resource.

Parameter
Name Description
functionName string

A fully-qualified path representing Function resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromProjectName(projectName)

matchProjectFromProjectName(projectName: string): string | number;

Parse the project from Project resource.

Parameter
Name Description
projectName string

A fully-qualified path representing Project resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromRepositoryName(repositoryName)

matchProjectFromRepositoryName(repositoryName: string): string | number;

Parse the project from Repository resource.

Parameter
Name Description
repositoryName string

A fully-qualified path representing Repository resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromServiceName(serviceName)

matchProjectFromServiceName(serviceName: string): string | number;

Parse the project from Service resource.

Parameter
Name Description
serviceName string

A fully-qualified path representing Service resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromTopicName(topicName)

matchProjectFromTopicName(topicName: string): string | number;

Parse the project from Topic resource.

Parameter
Name Description
topicName string

A fully-qualified path representing Topic resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromTriggerName(triggerName)

matchProjectFromTriggerName(triggerName: string): string | number;

Parse the project from Trigger resource.

Parameter
Name Description
triggerName string

A fully-qualified path representing Trigger resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromWorkerPoolName(workerPoolName)

matchProjectFromWorkerPoolName(workerPoolName: string): string | number;

Parse the project from WorkerPool resource.

Parameter
Name Description
workerPoolName string

A fully-qualified path representing WorkerPool resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchRepositoryFromRepositoryName(repositoryName)

matchRepositoryFromRepositoryName(repositoryName: string): string | number;

Parse the repository from Repository resource.

Parameter
Name Description
repositoryName string

A fully-qualified path representing Repository resource.

Returns
Type Description
string | number

{string} A string representing the repository.

matchServiceFromServiceName(serviceName)

matchServiceFromServiceName(serviceName: string): string | number;

Parse the service from Service resource.

Parameter
Name Description
serviceName string

A fully-qualified path representing Service resource.

Returns
Type Description
string | number

{string} A string representing the service.

matchTopicFromTopicName(topicName)

matchTopicFromTopicName(topicName: string): string | number;

Parse the topic from Topic resource.

Parameter
Name Description
topicName string

A fully-qualified path representing Topic resource.

Returns
Type Description
string | number

{string} A string representing the topic.

matchTriggerFromTriggerName(triggerName)

matchTriggerFromTriggerName(triggerName: string): string | number;

Parse the trigger from Trigger resource.

Parameter
Name Description
triggerName string

A fully-qualified path representing Trigger resource.

Returns
Type Description
string | number

{string} A string representing the trigger.

matchWorkerPoolFromWorkerPoolName(workerPoolName)

matchWorkerPoolFromWorkerPoolName(workerPoolName: string): string | number;

Parse the worker_pool from WorkerPool resource.

Parameter
Name Description
workerPoolName string

A fully-qualified path representing WorkerPool resource.

Returns
Type Description
string | number

{string} A string representing the worker_pool.

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.

repositoryPath(project, location, repository)

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

Return a fully-qualified repository resource name string.

Parameters
Name Description
project string
location string
repository string
Returns
Type Description
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
Name Description
project string
location string
service string
Returns
Type Description
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
Name Description
request IamProtos.google.iam.v1.SetIamPolicyRequest

The request object that will be sent.

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

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

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

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

The second parameter to the callback is an object representing .

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

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

testIamPermissions(request, options, callback)

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

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

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

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

The request object that will be sent.

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

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

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

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

The second parameter to the callback is an object representing .

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

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

topicPath(project, topic)

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

Return a fully-qualified topic resource name string.

Parameters
Name Description
project string
topic string
Returns
Type Description
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
Name Description
project string
location string
trigger string
Returns
Type Description
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
Name Description
request IUpdateFunctionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
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. 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. 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 library
  const {FunctionServiceClient} = require('@google-cloud/functions').v2;

  // Instantiates a client
  const functionsClient = new FunctionServiceClient();

  async function callUpdateFunction() {
    // Construct request
    const request = {
      function1,
    };

    // Run request
    const [operation] = await functionsClient.updateFunction(request);
    const [response] = await operation.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
Name Description
request 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>
Returns
Type Description
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
Name Description
request IUpdateFunctionRequest
callback Callback<LROperation<protos.google.cloud.functions.v2.IFunction, protos.google.cloud.functions.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

workerPoolPath(project, location, workerPool)

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

Return a fully-qualified workerPool resource name string.

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

{string} Resource name string.