- [HTTP request](https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#body.aspect)
- [BuildConfigOverrides](https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#BuildConfigOverrides)
  - [JSON representation](https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#BuildConfigOverrides.SCHEMA_REPRESENTATION)
- [ServiceConfigOverrides](https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#ServiceConfigOverrides)
  - [JSON representation](https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#ServiceConfigOverrides.SCHEMA_REPRESENTATION)
- [Try it!](https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#try-it)

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/v2/{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](https://cloud.google.com/iam/docs/) 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 (`https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#BuildConfigOverrides`) }, "serviceConfigOverrides": { object (`https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#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 (`https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#BuildConfigOverrides`)`` Optional. Specifies overrides for the build process. |
| `serviceConfigOverrides` | ``object (`https://docs.cloud.google.com/functions/docs/reference/rest/v2/projects.locations.functions/setupFunctionUpgradeConfig#ServiceConfigOverrides`)`` Optional. Specifies overrides for the service configuration. |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/functions/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation`.

### Authorization scopes

Requires the following OAuth scope:

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

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

## 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. |