Method: projects.locations.functions.setupFunctionUpgradeConfig

Creates a 2nd Gen copy of the function configuration based on the 1st Gen function with the given name. This is the first step of the multi step process to upgrade 1st Gen functions to 2nd Gen. Only 2nd Gen configuration is setup as part of this request and traffic continues to be served by 1st Gen.

HTTP request

POST https://cloudfunctions.googleapis.com/v2alpha/{name}:setupFunctionUpgradeConfig

Path parameters

Parameters
name

string

Required. The name of the function which should have configuration copied for upgrade. It takes the form projects/{project}/locations/{location}/functions/{function}.

Authorization requires the following IAM permission on the specified resource name:

  • cloudfunctions.functions.generationUpgrade

Request body

The request body contains data with the following structure:

JSON representation
{
  "triggerServiceAccount": string,
  "buildConfigOverrides": {
    object (BuildConfigOverrides)
  },
  "serviceConfigOverrides": {
    object (ServiceConfigOverrides)
  }
}
Fields
triggerServiceAccount

string

Optional. The trigger's service account. The service account must have permission to invoke Cloud Run services, the permission is run.routes.invoke. If empty, defaults to the Compute Engine default service account: {project_number}-compute@developer.gserviceaccount.com.

buildConfigOverrides

object (BuildConfigOverrides)

Optional. Specifies overrides for the build process.

serviceConfigOverrides

object (ServiceConfigOverrides)

Optional. Specifies overrides for the service configuration.

Response body

If successful, the response body contains an instance of Operation.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

BuildConfigOverrides

Contains overrides related to the function's build configuration.

JSON representation
{
  "runtime": string
}
Fields
runtime

string

Optional. Specifies the desired runtime for the new Cloud Run function. (e.g., "nodejs20", "python312").

Constraints: 1. This field CANNOT be used to change the runtime language (e.g., from NODEJS to PYTHON). The backend will enforce this. 2. This field can ONLY be used to upgrade the runtime version (e.g., nodejs18 to nodejs20). Downgrading the version is not permitted. The backend will validate the version change.

If provided and valid, this overrides the runtime of the Gen1 function.

ServiceConfigOverrides

Contains overrides related to the function's service configuration.

JSON representation
{
  "maxInstanceCount": integer
}
Fields
maxInstanceCount

integer

Optional. Specifies the maximum number of instances for the new Cloud Run function. If provided, this overrides the maxInstanceCount setting of the Gen1 function.