application-integration-authoring
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseApplication Integration Authoring
Application Integration 编排
Google Cloud Application Integration workflows are authored, versioned, published, and executed programmatically through the REST API () or the discovery-based Google API Python client ().
https://integrations.googleapis.com/v1/...googleapiclient.discovery.build("integrations", "v1")There is no command group, no Google-managed MCP server for Application Integration, and no documented Terraform resource for integrations or versions. Use only for authentication, enabling APIs, and IAM bindings. Use Terraform only for region provisioning (), authentication profiles (), and Integration Connectors ().
gcloud integrationsgcloudgoogle_integrations_clientgoogle_integrations_auth_configgoogle_integration_connectors_connectionFor initial project setup, region provisioning, and IAM role definitions, use the skill. For diagnosing failed or stuck runs, execution logs, and quota errors, use the skill.
application-integration-basicsapplication-integration-troubleshootingGoogle Cloud Application Integration 工作流可通过 REST API()或基于 discovery 的 Google API Python 客户端()进行编程式编排、版本管理、发布和执行。
https://integrations.googleapis.com/v1/...googleapiclient.discovery.build("integrations", "v1")不存在 命令组,也不存在 Google 托管的 Application Integration MCP server,并且没有针对 integration 或 version 的已文档化 Terraform resource。仅将 用于身份验证、启用 API 和绑定 IAM。仅将 Terraform 用于区域预配()、身份验证配置文件()和 Integration Connectors()。
gcloud integrationsgcloudgoogle_integrations_clientgoogle_integrations_auth_configgoogle_integration_connectors_connection对于初始项目设置、区域预配和 IAM 角色定义,请使用 skill。对于诊断失败或卡住的运行、执行日志和配额错误,请使用 skill。
application-integration-basicsapplication-integration-troubleshootingSafety and Confirmation Rules
安全与确认规则
- Read-only operations run freely: ,
integrations.list,integrations:search,versions.list,versions.get,versions:download, andauthConfigs.list.executions.list - Confirm before any state change or execution: Before creating, uploading, patching, publishing, unpublishing, testing, executing, scheduling, or deleting an integration or version, or modifying IAM or auth configs, show the exact command and payload to the user and get explicit confirmation.
- Ask the user before installing packages () or changing global gcloud settings such as
pip install; show the exact command first.gcloud config set auth/impersonate_service_account - Never store secrets in config variables: Config variables () are stored and exported in plain text. Always use authentication profiles (
CONFIG_*) or the Secret Manager access task for credentials.projects.locations.authConfigs
- 只读操作可直接执行:、
integrations.list、integrations:search、versions.list、versions.get、versions:download和authConfigs.list。executions.list - 任何状态变更或执行前均需确认:在创建、上传、修补、发布、取消发布、测试、执行、调度或删除 integration 或 version,或者修改 IAM 或 auth config 之前,向用户展示确切的命令和 payload,并获得明确确认。
- 安装软件包()或更改全局 gcloud 设置(例如
pip install)之前,须询问用户;先展示确切的命令。gcloud config set auth/impersonate_service_account - 切勿在配置变量中存储机密:配置变量()以明文形式存储和导出。始终使用身份验证配置文件(
CONFIG_*)或 Secret Manager access task 存储凭据。projects.locations.authConfigs
Prerequisites Checklist
前提条件检查清单
- Install Google Cloud SDK: Follow Install the gcloud CLI if is not installed.
gcloud - Billing and project: Ensure the Google Cloud project has an active billing account attached (required even when usage stays within the free tier), then set the target project:
bash
gcloud config set project PROJECT_ID - Enable required APIs:
bash
gcloud services enable integrations.googleapis.com connectors.googleapis.com secretmanager.googleapis.com - Provision the region: Application Integration is regional: confirm the target region is supported on Application Integration locations and use as a well-supported default when the user has no preference. The region is the
us-central1in every REST path; noLOCATIONdefault-region setting applies to Application Integration. The targetgcloudmust be provisioned via the Cloud console orLOCATIONbefore authoring integrations (seePOST .../clients:provision).application-integration-basics - Authenticate:
- For : run
curland passgcloud auth login.-H "Authorization: Bearer $(gcloud auth print-access-token)" - For the Python client (install with ): run
pip install "google-api-python-client>=2.100.0,<3" "google-auth>=2.20.0,<3"(or setgcloud auth application-default loginfor a service account).GOOGLE_APPLICATION_CREDENTIALS - For service account impersonation: run (requires
gcloud config set auth/impersonate_service_account SA_EMAIL).roles/iam.serviceAccountTokenCreator
- For
- Verify IAM roles:
- Create, upload, or edit drafts: (covers
roles/integrations.integrationEditor, which needsversions:upload, andintegrations.integrationVersions.create)versions:publish - Publish or unpublish: or
roles/integrations.integrationDeployer(roles/integrations.integrationEditoralone can publish an existing version but cannot upload viaroles/integrations.integrationDeployer), plusversions:uploadgranted to the Application Integration service agent (roles/integrations.serviceAgent)service-PROJECT_NUMBER@gcp-sa-integrations.iam.gserviceaccount.com - Invoke integrations:
roles/integrations.integrationInvoker - Act as the run-as service account: integrations created on or after October 15, 2026 with any trigger other than an API or Private trigger (for example Schedule, Cloud Scheduler, Cloud Pub/Sub, Salesforce, or Connector Event; Private triggers are exempt like API triggers, so a sub-integration whose only trigger is Private can be published without ) cannot be tested or published unless
runAsServiceAccountis set (and region governance requires it for all integrations); wheneverrunAsServiceAccountis set, the user publishing or testing the version needsrunAsServiceAccounton it (and at runtime, the invoking caller or trigger service account needsroles/iam.serviceAccountUseron it).roles/iam.serviceAccountUser
- Create, upload, or edit drafts:
- 安装 Google Cloud SDK:如果尚未安装 ,请按照安装 gcloud CLI中的说明操作。
gcloud - 计费与项目:确保 Google Cloud 项目已关联有效计费账户(即使使用量保持在免费额度内也必须关联),然后设置目标项目:
bash
gcloud config set project PROJECT_ID - 启用所需 API:
bash
gcloud services enable integrations.googleapis.com connectors.googleapis.com secretmanager.googleapis.com - 预配区域:Application Integration 是区域性的:在 Application Integration locations 上确认目标区域受支持;如果用户没有偏好,可使用支持较完善的默认区域 。每条 REST 路径中的
us-central1都是该区域;Application Integration 不适用LOCATION的默认区域设置。在编排 integration 之前,必须通过 Cloud console 或gcloud预配目标POST .../clients:provision(参见LOCATION)。application-integration-basics - 进行身份验证:
- 对于 :运行
curl,并传入gcloud auth login。-H "Authorization: Bearer $(gcloud auth print-access-token)" - 对于 Python 客户端(使用 安装):运行
pip install "google-api-python-client>=2.100.0,<3" "google-auth>=2.20.0,<3"(或者为 service account 设置gcloud auth application-default login)。GOOGLE_APPLICATION_CREDENTIALS - 对于 service account 模拟:运行 (需要
gcloud config set auth/impersonate_service_account SA_EMAIL)。roles/iam.serviceAccountTokenCreator
- 对于
- 验证 IAM 角色:
- 创建、上传或编辑草稿:(涵盖需要
roles/integrations.integrationEditor权限的integrations.integrationVersions.create,以及versions:upload)。versions:publish - 发布或取消发布:或
roles/integrations.integrationDeployer(roles/integrations.integrationEditor单独可以发布现有 version,但无法通过roles/integrations.integrationDeployer上传),并且需要将versions:upload授予 Application Integration service agent(roles/integrations.serviceAgent)。service-PROJECT_NUMBER@gcp-sa-integrations.iam.gserviceaccount.com - 调用 integration:。
roles/integrations.integrationInvoker - 以 run-as service account 身份运行:对于 2026 年 10 月 15 日及之后创建、且触发器不是 API 或 Private 的 integration(例如 Schedule、Cloud Scheduler、Cloud Pub/Sub、Salesforce 或 Connector Event;Private trigger 与 API trigger 一样豁免,因此仅以 Private 为触发器的 sub-integration 无需设置 即可发布),如果未设置
runAsServiceAccount,则无法测试或发布(区域治理还要求所有 integration 都设置该账户);只要设置了runAsServiceAccount,发布或测试该 version 的用户就需要拥有该账户的runAsServiceAccount(运行时,调用方或 trigger service account 也需要拥有该权限)。roles/iam.serviceAccountUser
- 创建、上传或编辑草稿:
Decision Flow
决策流程
| Goal | Action | Endpoint / Method |
|---|---|---|
| Inspect existing integrations in a region | List integrations, then list versions | |
| Export an integration version to source control | Download version JSON | |
Create an integration or add a new | Upload version JSON (creates the integration if it does not exist, or adds a new | |
| Create a brand-new integration and fail on a name clash | Create first | |
Edit an existing | Check | |
Edit an | Upload or create a new | |
| Externalize environment-specific URLs or IDs | Define | |
| Store API keys, OAuth credentials, or certs | Create an authentication profile | |
| Test an integration before production | Publish to a non-production project and invoke | |
Deploy a | Publish version with | |
| Invoke a published integration synchronously | Call | |
| Invoke a published integration asynchronously | Call | |
| Promote a version across projects (CI/CD) | Download JSON -> Upload to target -> Publish | |
See references/rest-api-cheatsheet.md for full request parameters, query filters, and IAM permissions for each method.
| 目标 | 操作 | 端点/方法 |
|---|---|---|
| 检查某个区域中现有的 integration | 列出 integration,然后列出 version | |
| 将 integration version 导出到源代码管理 | 下载 version JSON | |
根据 JSON 创建 integration 或添加新的 | 上传 version JSON(如果 integration 不存在则创建;如果已存在则添加新的 | |
| 创建一个全新的 integration,并在名称冲突时失败 | 使用 | |
编辑现有的 | 检查 | |
编辑现有的 | 上传 version 或创建新的 | |
| 将环境特定的 URL 或 ID 外部化 | 定义 | |
| 存储 API key、OAuth 凭据或证书 | 创建身份验证配置文件 | |
| 在生产环境之前测试 integration | 发布到非生产项目,然后调用 | |
部署 | 使用 | |
| 同步调用已发布的 integration | 使用 | |
| 异步调用已发布的 integration | 使用 | |
| 在项目之间提升 version(CI/CD) | 下载 JSON -> 上传到目标项目 -> 发布 | |
有关每个方法的完整请求参数、查询过滤器和 IAM 权限,请参阅 references/rest-api-cheatsheet.md。
Core Authoring Workflow
核心编排工作流
1. List Integrations and Download a Version
1. 列出 Integration 并下载 Version
List integrations in and list versions for a specific :
LOCATIONINTEGRATION_NAMEbash
TOKEN="$(gcloud auth print-access-token)"在 中列出 integration,并列出特定 的 version:
LOCATIONINTEGRATION_NAMEbash
TOKEN="$(gcloud auth print-access-token)"List integrations in the region
List integrations in the region
curl -sS -H "Authorization: Bearer ${TOKEN}"
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations?pageSize=50"
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations?pageSize=50"
curl -sS -H "Authorization: Bearer ${TOKEN}"
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations?pageSize=50"
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations?pageSize=50"
List versions (ordered by most recently modified)
List versions (ordered by most recently modified)
curl -sS -H "Authorization: Bearer ${TOKEN}"
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions?orderBy=last_modified_time%20desc"
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions?orderBy=last_modified_time%20desc"
Download a specific version (`VERSION_ID` is the UUID at the end of the version's `name` field) as portable JSON:
```bash
curl -sS -H "Authorization: Bearer ${TOKEN}" \
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions/VERSION_ID:download?fileFormat=JSON" \
| jq -r '.content' > integration-version.jsoncurl -sS -H "Authorization: Bearer ${TOKEN}"
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions?orderBy=last_modified_time%20desc"
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions?orderBy=last_modified_time%20desc"
将特定 version(`VERSION_ID` 是该 version 的 `name` 字段末尾的 UUID)下载为可移植 JSON:
```bash
curl -sS -H "Authorization: Bearer ${TOKEN}" \
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions/VERSION_ID:download?fileFormat=JSON" \
| jq -r '.content' > integration-version.json2. Understand the IntegrationVersion
Structure
IntegrationVersion2. 理解 IntegrationVersion
结构
IntegrationVersionAn JSON object contains four primary arrays and version-level settings:
IntegrationVersion- : Entry points that start the workflow. Each entry requires a unique
triggerConfigs, plustriggerNumber(such astriggerTypeorAPI), optionalPRIVATE_TRIGGER(auto-generated fromtriggerIdif omitted; for API triggers:properties), andapi_trigger/TRIGGER_NAMEpointing to the firststartTasks.taskId - : Units of work. Each entry needs
taskConfigs(the task type, such astaskin the public upload sample, orEmailTaskin a discovery enum description), a uniqueFieldMappingTask,taskId,parameters, and optionalnextTasksorfailurePolicy.errorCatcherId - : Input, output, and transient variables (
integrationParameters,keysuch asdataTypeorSTRING_VALUE,JSON_VALUEofinputOutputType,IN,OUT, orIN_OUT, andIN_OUT_TYPE_UNSPECIFIED).defaultValue - : Environment-specific config variable definitions (
integrationConfigParameterswith keyparameterand`CONFIG_<NAME>`; a top-levelparameter.defaultValuein uploaded or created draft JSON is discarded, so per-environment values go invalueat publish).configParameters - : Dedicated user-managed service account email. When set and no authentication profile (
runAsServiceAccount) is configured on the task, it is used to generate the auth token for Connector (authConfig), REST (Connectors), and Cloud Function tasks; an authentication profile configured on the task takes precedence overCall REST Endpoint.runAsServiceAccount
Always use , , and . Never use , , or because they are deprecated. See references/integration-version-json.md for field schemas, shapes, and a minimal JSON template.
triggerConfigstaskConfigsintegrationParameterstriggerConfigsInternaltaskConfigsInternalintegrationParametersInternalValueTypeIntegrationVersion一个 JSON 对象包含四个主要数组和 version 级设置:
IntegrationVersion- :启动工作流的入口点。每个入口都需要唯一的
triggerConfigs、triggerNumber(例如triggerType或API)、可选的PRIVATE_TRIGGER(如果省略,则根据triggerId自动生成;对于 API trigger:properties),以及指向首个api_trigger/TRIGGER_NAME的taskId。startTasks - :工作单元。每个条目都需要
taskConfigs(任务类型,例如公共上传示例中的task,或 discovery 枚举描述中的EmailTask)、唯一的FieldMappingTask、taskId、parameters,以及可选的nextTasks或failurePolicy。errorCatcherId - :输入、输出和瞬态变量(
integrationParameters、key,例如dataType或STRING_VALUE;JSON_VALUE,即inputOutputType、IN、OUT或IN_OUT;以及IN_OUT_TYPE_UNSPECIFIED)。defaultValue - :环境特定的配置变量定义(
integrationConfigParameters的键为parameter,并包含`CONFIG_<NAME>`;上传或创建的 draft JSON 中,顶层parameter.defaultValue会被丢弃,因此各环境的值应在发布时通过value提供)。configParameters - :专用的用户管理型 service account 邮箱地址。设置该字段且任务未配置身份验证配置文件(
runAsServiceAccount)时,将使用它为 Connector(authConfig)、REST(Connectors)和 Cloud Function 任务生成 auth token;任务上配置的身份验证配置文件优先于Call REST Endpoint。runAsServiceAccount
始终使用 、 和 。切勿使用 、 或 ,因为它们已经弃用。有关字段 schema、 结构以及最小化的 JSON 模板,请参阅 references/integration-version-json.md。
triggerConfigstaskConfigsintegrationParameterstriggerConfigsInternaltaskConfigsInternalintegrationParametersInternalValueTypeIntegrationVersion3. Create or Upload a DRAFT
Version
DRAFT3. 创建或上传 DRAFT
Version
DRAFTEach integration allows up to 100 versions and 100 tasks, and can be at most 64 characters. Calling creates a new version—creating the integration automatically if does not exist yet, or adding the next version if it already exists (for example, uploading onto version 5 creates version 6). The uploaded version is in state and still requires to serve traffic. Use (passing an JSON body) only when you explicitly want the call to fail with if already exists.
INTEGRATION_NAMEversions:uploadDRAFTINTEGRATION_NAMEDRAFTDRAFTversions:publishPOST .../versions?newIntegration=trueIntegrationVersionALREADY_EXISTSINTEGRATION_NAMEbash
undefined每个 integration 最多允许 100 个 version 和 100 个 task,且 最长为 64 个字符。调用 会创建一个新的 version——如果 尚不存在,则自动创建 integration;如果已经存在,则添加下一个 version(例如,在 version 5 基础上上传会创建 version 6)。上传后的 version 处于 状态,仍需执行 才能承载流量。仅当明确希望调用在 已存在时返回 ,才使用 (请求体为 JSON)。
INTEGRATION_NAMEversions:uploadDRAFTINTEGRATION_NAMEDRAFTDRAFTversions:publishINTEGRATION_NAMEALREADY_EXISTSPOST .../versions?newIntegration=trueIntegrationVersionbash
undefinedUpload integration-version.json as a new DRAFT version
Upload integration-version.json as a new DRAFT version
PAYLOAD="$(jq -n --rawfile content integration-version.json '{content: $content, fileFormat: "JSON"}')"
curl -sS --fail-with-body -X POST
-H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
-d "${PAYLOAD}"
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions:upload"
-H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
-d "${PAYLOAD}"
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions:upload"
Capture the new `VERSION_ID` from `.integrationVersion.name` in the response (`projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions/VERSION_ID`).PAYLOAD="$(jq -n --rawfile content integration-version.json '{content: $content, fileFormat: "JSON"}')"
curl -sS --fail-with-body -X POST
-H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
-d "${PAYLOAD}"
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions:upload"
-H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
-d "${PAYLOAD}"
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions:upload"
从响应中的 `.integrationVersion.name` 获取新的 `VERSION_ID`(`projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions/VERSION_ID`)。4. Version States and Edit-Lock Rules
4. Version 状态与编辑锁规则
| State | Meaning | Editable? | Can Serve Triggers? |
|---|---|---|---|
| Version actively being edited; its edit lock is held by its author ( | Yes (only by | No |
| Published version serving live traffic | No | Yes |
| Prior draft (when another author takes over in the console) or unpublished version ( | No | No |
| Soft-deleted via | No | No |
- Edit-lock enforcement: A version's edit lock is held by its author (
DRAFT). CallinglockHolderorversions:publishon aversions.deletefails if the caller is not theDRAFT(lockHolderandversions:publishrelease any existing lock when they succeed).versions.delete - No v1 lock-takeover API: does not exist on
takeoverEditLockin the v1 REST API (it only exists onprojects.locations.integrations.versions). If aversions.testCasesis locked by another user, wait 15 minutes fromDRAFTfor the lock to expire automatically, or click Take Over in the Cloud console (which converts the existing draft toupdateTimeand creates a newSNAPSHOT).DRAFT
| 状态 | 含义 | 是否可编辑 | 是否可承载 Trigger |
|---|---|---|---|
| 正在主动编辑的 version;其编辑锁由作者( | 是(仅限 | 否 |
| 已发布并承载线上流量的 version | 否 | 是 |
| 先前的 draft(当另一位作者在 console 中接手时),或未发布的 version( | 否 | 否 |
| 通过 | 否 | 否 |
- 编辑锁强制执行:version 的编辑锁由其作者(
DRAFT)持有。如果调用方不是lockHolder,则对该lockHolder调用DRAFT或versions:publish会失败(versions:delete和versions:publish成功后都会释放现有锁)。versions:delete - v1 不提供锁接管 API:在 v1 REST API 的 上不存在
projects.locations.integrations.versions(它仅存在于takeoverEditLock上)。如果一个versions.testCases被其他用户锁定,请等待从DRAFT起 15 分钟让锁自动过期,或者在 Cloud console 中单击 Take Over(这会将现有 draft 转换为updateTime,并创建一个新的SNAPSHOT)。DRAFT
5. Config Variables vs Authentication Profiles
5. 配置变量与身份验证配置文件
- Config variables (): Use for non-secret environment values (backend hostnames, Pub/Sub topics, connection names). Define them in
CONFIG_<NAME>on the draft (putting any default inintegrationConfigParameters, because a top-levelparameter.defaultValueon a draft is discarded) and pass their per-environment values invaluewhen callingconfigParameters. Gotcha: Keys inversions:publishat publish must exactly match a key inconfigParameters, backticks included (for example,integrationConfigParameters); unknown keys are silently ignored, not rejected ("`CONFIG_target_url`"returns 200 and the default stays). Config variables cannot configure Integration Connectors entity operations or actions.versions:publish - Authentication profiles (): Use for API keys, OAuth 2.0 credentials, JWTs, OIDC tokens, SSL/TLS certificates, and service accounts. Auth profiles are regional resources (
authConfigs) and are not included when you download an integration version. Create them in each target project viaprojects/PROJECT_ID/locations/LOCATION/authConfigs/AUTH_CONFIG_IDor TerraformPOST .../authConfigs.google_integrations_auth_config
- 配置变量():用于非机密的环境值(后端主机名、Pub/Sub topic、连接名称)。在 draft 中通过
CONFIG_<NAME>定义(默认值放在integrationConfigParameters中,因为 draft 顶层的parameter.defaultValue会被丢弃),并在调用value时通过versions:publish传入各环境的值。注意:发布时configParameters中的键必须与configParameters中的键完全一致,包括反引号(例如integrationConfigParameters);未知键会被静默忽略,而不是被拒绝("`CONFIG_target_url`"返回 200,并继续使用默认值)。配置变量无法配置 Integration Connectors 的实体操作或 action。versions:publish - 身份验证配置文件():用于 API key、OAuth 2.0 凭据、JWT、OIDC token、SSL/TLS 证书和 service account。身份验证配置文件是区域资源(
authConfigs),下载 integration version 时不会包含它们。通过projects/PROJECT_ID/locations/LOCATION/authConfigs/AUTH_CONFIG_ID或 TerraformPOST .../authConfigs在每个目标项目中分别创建。google_integrations_auth_config
6. Test, Publish, and Unpublish
6. 测试、发布与取消发布
- Recommended testing path: Test integrations by publishing the version in a non-production project () and invoking
versions:publishthere.integrations:execute- Note on : The v1 REST API includes
integrations:testfor testing aPOST .../integrations/INTEGRATION_NAME:test, which requiresDRAFT("Required. This is used to identify the client on whose behalf the event will be executed."), but the public documentation does not specify what value to pass. Do not invent aTestIntegrationsRequest.clientIdvalue; publish to a non-production project and callclientIdinstead. (Draft testing also cannot run:execute,Approval, orSuspendtasks, and Call REST Endpoint authentication profile changes only take effect after publishing.)Timer
- Note on
- Publish (): Deploys the version as
versions:publishand releases any edit lock (fails if the version is alreadyACTIVEorACTIVE, or if it is aARCHIVEDwhoseDRAFTdiffers from the caller). Any previouslylockHolderversion is automatically unpublished, and dependent services switch to the newly published version.ACTIVE- Gotcha: Publishing a new version automatically cancels all suspended executions of the previous version.
- Gotcha: Due to eventual consistency, the previous version can continue running for up to 10 minutes after a new version is published.
- Unpublish (): Moves the
versions:unpublishversion toACTIVE(taggedSNAPSHOT; fails if the version is notPREVIOUSLY_PUBLISHED) and stops triggers and dependent services.ACTIVE
bash
undefined- 推荐测试路径:通过在非生产项目中发布 version(),并在该项目中调用
versions:publish来测试 integration。integrations:execute- 关于 的说明:v1 REST API 包含用于测试
integrations:test的DRAFT,该接口要求提供POST .../integrations/INTEGRATION_NAME:test(“必需。用于标识代表其执行事件的客户端。”),但公开文档未说明应传入什么值。不要自行编造TestIntegrationsRequest.clientId;应改为发布到非生产项目并调用clientId。(Draft 测试也无法运行:execute、Approval或Suspend任务,并且 Call REST Endpoint 的身份验证配置文件更改只有在发布后才会生效。)Timer
- 关于
- 发布():将 version 部署为
versions:publish并释放任何编辑锁(如果 version 已经是ACTIVE或ACTIVE,或者该ARCHIVED的DRAFT与调用方不同,则会失败)。之前处于lockHolder状态的 version 会自动取消发布,依赖服务也会切换到新发布的 version。ACTIVE- 注意:发布新 version 会自动取消上一个 version 中所有已暂停的 execution。
- 注意:由于最终一致性,新 version 发布后,旧 version 仍可能继续运行最多 10 分钟。
- 取消发布():将
versions:unpublishversion 转换为ACTIVE(标记为SNAPSHOT;如果该 version 不是PREVIOUSLY_PUBLISHED,则失败),并停止 trigger 和依赖服务。ACTIVE
bash
undefinedPublish VERSION_ID and supply config variable values (keys must exactly match integrationConfigParameters keys, backticks included; unknown keys are silently ignored)
Publish VERSION_ID and supply config variable values (keys must exactly match integrationConfigParameters keys, backticks included; unknown keys are silently ignored)
curl -sS --fail-with-body -X POST
-H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
-d '{"configParameters": {"": "https://api.example.com"}}'
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions/VERSION_ID:publish"
-H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
-d '{"configParameters": {"
CONFIG_backend_url"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions/VERSION_ID:publish"
undefinedcurl -sS --fail-with-body -X POST
-H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
-d '{"configParameters": {"": "https://api.example.com"}}'
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions/VERSION_ID:publish"
-H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
-d '{"configParameters": {"
CONFIG_backend_url"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions/VERSION_ID:publish"
undefined7. Execute (Sync) vs Schedule (Async)
7. 同步执行与异步调度
Only an (published) version can be invoked via or . For API triggers, is always (where is at most 64 characters). Passing as in runs all published integrations in that region that share the .
ACTIVEexecutescheduletriggerIdapi_trigger/TRIGGER_NAMETRIGGER_NAME-INTEGRATION_NAMEexecutetriggerId| Method | Mode | Max Timeout | Max API Input | Key Request Fields | Key Response Fields |
|---|---|---|---|---|---|
| Sync | 2 minutes | 8 MB | | |
| Async | 10 minutes | Not documented | | |
- Reading and
outputParameters: InexecutionId,ExecuteIntegrationsResponseidentifies the run, andexecutionIdis a JSON object of output variables (system-generated keys such asoutputParametersare wrapped in backticks).`ExecutionId` - HTTP 200 does not prove every task succeeded: If is
doNotPropagateError, or a task uses failure policytrueorIGNOREwith an alternate path, the HTTP call returnsNONEeven when a task failed. Always verify the execution record via200 OK(checkingexecutions.list?filter=execution_id="EXECUTION_ID", each task'sexecutionDetails.state, andtaskExecutionStateinErrorInfo; whenExecution.responseParametersisdoNotPropagateError, errors are also returned in event parameters astrue). Do not rely on the legacy/deprecatedPostWithTriggerIdExecutionExceptionfield.executionFailed
See references/triggers-and-execution.md for all trigger types, input formatting, OpenAPI spec generation, and suspension lifting and approval resolution.
ValueType只有 (已发布)version 才能通过 或 调用。对于 API trigger, 始终为 (其中 最长为 64 个字符)。在 中将 作为 传入,会运行该区域中共享同一 的所有已发布 integration。
ACTIVEexecutescheduletriggerIdapi_trigger/TRIGGER_NAMETRIGGER_NAMEexecute-INTEGRATION_NAMEtriggerId| 方法 | 模式 | 最大超时时间 | 最大 API 输入 | 关键请求字段 | 关键响应字段 |
|---|---|---|---|---|---|
| 同步 | 2 分钟 | 8 MB | | |
| 异步 | 10 分钟 | 未文档化 | | |
- 读取 和
outputParameters:在executionId中,ExecuteIntegrationsResponse用于标识运行,executionId是由输出变量组成的 JSON 对象(系统生成的键,例如outputParameters,会包含在反引号中)。`ExecutionId` - HTTP 200 不代表每个任务都成功:如果 为
doNotPropagateError,或者任务使用 failure policytrue或IGNORE并配置了备用路径,即使任务失败,HTTP 调用也会返回NONE。始终通过200 OK验证 execution 记录(检查executions.list?filter=execution_id="EXECUTION_ID"、每个任务的executionDetails.state,以及taskExecutionState中的Execution.responseParameters;当ErrorInfo为doNotPropagateError时,错误还会作为 event parameter 以true的形式返回)。不要依赖已弃用的旧版PostWithTriggerIdExecutionException字段。executionFailed
有关所有 trigger 类型、 输入格式、OpenAPI spec 生成,以及暂停解除和审批处理,请参阅 references/triggers-and-execution.md。
ValueTypeEnd-to-End Version and API Workflow Examples
端到端 Version 与 API 工作流示例
In downloaded and uploaded JSON, an uses four customer-visible parameter keys inside : ( of recipient addresses), (), (, such as ), and (). Both runnable examples below also set (replace with your dedicated service account email, such as ; projects with governance require a run-as service account to publish, and the caller needs on it). Executing an sends a real email, so always confirm the recipient address () and each state-changing command (upload, publish, and execute) with the user before running.
IntegrationVersionEmailTasktaskConfigs[].parameters"To"stringArray"Subject"stringValue"BodyFormat"stringValue"PLAIN_TEXT""TextBody"stringValue"runAsServiceAccount": "RUN_AS_SA"RUN_AS_SAorder-workflow-sa@PROJECT_ID.iam.gserviceaccount.comroles/iam.serviceAccountUserEmailTaskRECIPIENT_EMAIL在下载和上传的 JSON 中, 会在 内部使用四个对用户可见的参数键:(收件人地址的 )、()、(,例如 )和 ()。下面两个可运行示例也都设置了 (将 替换为专用的 service account 邮箱,例如 ;受治理策略约束的项目必须设置 run-as service account 才能发布,并且调用方需要拥有该账户的 )。执行 会发送真实电子邮件,因此运行前务必向用户确认收件人地址()以及每个会改变状态的命令(上传、发布和执行)。
IntegrationVersionEmailTasktaskConfigs[].parameters"To"stringArray"Subject"stringValue"BodyFormat"stringValue"PLAIN_TEXT""TextBody"stringValue"runAsServiceAccount": "RUN_AS_SA"RUN_AS_SAorder-workflow-sa@PROJECT_ID.iam.gserviceaccount.comroles/iam.serviceAccountUserEmailTaskRECIPIENT_EMAILExample 1: Upload, Publish, and Invoke Workflow with curl
curl示例 1:使用 curl
上传、发布并调用 Workflow
curlThis example uploads a runnable JSON ( creates automatically if it does not exist yet, or adds a new version if it does), publishes the draft, and invokes . The caller must hold on (projects with governance require a run-as service account to publish). Because sends real email, confirm and get user confirmation before running the upload, publish, and execute calls.
IntegrationVersionversions:uploadINTEGRATION_NAMEDRAFT:executeroles/iam.serviceAccountUserRUN_AS_SAEmailTaskRECIPIENT_EMAILbash
set -euo pipefail
export PROJECT_ID="my-project"
export LOCATION="us-central1"
export INTEGRATION_NAME="order-webhook"
export TRIGGER_NAME="order_api"
TOKEN="$(gcloud auth print-access-token)"
BASE_URL="https://integrations.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}"此示例上传一个可运行的 JSON(如果 尚不存在, 会自动创建该 integration;如果已经存在,则添加新的 version),发布该 draft,然后调用 。调用方必须拥有 的 (受治理策略约束的项目必须设置 run-as service account 才能发布)。由于 会发送真实电子邮件,请在运行 upload、publish 和 execute 调用之前确认 并获得用户确认。
IntegrationVersionINTEGRATION_NAMEversions:uploadDRAFT:executeRUN_AS_SAroles/iam.serviceAccountUserEmailTaskRECIPIENT_EMAILbash
set -euo pipefail
export PROJECT_ID="my-project"
export LOCATION="us-central1"
export INTEGRATION_NAME="order-webhook"
export TRIGGER_NAME="order_api"
TOKEN="$(gcloud auth print-access-token)"
BASE_URL="https://integrations.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}"1. Write an IntegrationVersion JSON file (set RUN_AS_SA and confirm RECIPIENT_EMAIL with user first; caller needs roles/iam.serviceAccountUser on RUN_AS_SA)
1. Write an IntegrationVersion JSON file (set RUN_AS_SA and confirm RECIPIENT_EMAIL with user first; caller needs roles/iam.serviceAccountUser on RUN_AS_SA)
cat <<'EOF' > /tmp/version.json
{
"description": "API-triggered order notification integration",
"runAsServiceAccount": "RUN_AS_SA",
"triggerConfigs": [
{
"label": "API Trigger",
"triggerType": "API",
"triggerNumber": "1",
"triggerId": "api_trigger/order_api",
"properties": {"Trigger name": "order_api"},
"startTasks": [{"taskId": "1"}]
}
],
"taskConfigs": [
{
"task": "EmailTask",
"taskId": "1",
"displayName": "Send Email",
"taskExecutionStrategy": "WHEN_ALL_SUCCEED",
"parameters": {
"To": {"key": "To", "value": {"stringArray": {"stringValues": ["RECIPIENT_EMAIL"]}}},
"Subject": {"key": "Subject", "value": {"stringValue": "Order notification for $orderId$"}},
"BodyFormat": {"key": "BodyFormat", "value": {"stringValue": "PLAIN_TEXT"}},
"TextBody": {"key": "TextBody", "value": {"stringValue": "Processing order $orderId$."}}
}
}
],
"integrationParameters": [
{
"key": "orderId",
"dataType": "STRING_VALUE",
"inputOutputType": "IN_OUT",
"defaultValue": {"stringValue": "ORD-0000"}
}
]
}
EOF
cat <<'EOF' > /tmp/version.json
{
"description": "API-triggered order notification integration",
"runAsServiceAccount": "RUN_AS_SA",
"triggerConfigs": [
{
"label": "API Trigger",
"triggerType": "API",
"triggerNumber": "1",
"triggerId": "api_trigger/order_api",
"properties": {"Trigger name": "order_api"},
"startTasks": [{"taskId": "1"}]
}
],
"taskConfigs": [
{
"task": "EmailTask",
"taskId": "1",
"displayName": "Send Email",
"taskExecutionStrategy": "WHEN_ALL_SUCCEED",
"parameters": {
"To": {"key": "To", "value": {"stringArray": {"stringValues": ["RECIPIENT_EMAIL"]}}},
"Subject": {"key": "Subject", "value": {"stringValue": "Order notification for $orderId$"}},
"BodyFormat": {"key": "BodyFormat", "value": {"stringValue": "PLAIN_TEXT"}},
"TextBody": {"key": "TextBody", "value": {"stringValue": "Processing order $orderId$."}}
}
}
],
"integrationParameters": [
{
"key": "orderId",
"dataType": "STRING_VALUE",
"inputOutputType": "IN_OUT",
"defaultValue": {"stringValue": "ORD-0000"}
}
]
}
EOF
2. Upload as a new DRAFT version — creates INTEGRATION_NAME if it does not exist yet (confirm with user first)
2. Upload as a new DRAFT version — creates INTEGRATION_NAME if it does not exist yet (confirm with user first)
UPLOAD_BODY="$(jq -n --rawfile content /tmp/version.json '{content: $content, fileFormat: "JSON"}')"
VERSION_NAME="$(curl -sS --fail-with-body -X POST
-H "Authorization: Bearer ${TOKEN}"
-H "Content-Type: application/json"
-d "${UPLOAD_BODY}"
"${BASE_URL}/integrations/${INTEGRATION_NAME}/versions:upload"
| jq -r '.integrationVersion.name')" VERSION_ID="${VERSION_NAME##*/}" [[ -n "${VERSION_ID}" && "${VERSION_ID}" != "null" ]] || { echo "upload failed: ${VERSION_NAME}" >&2; exit 1; }
-H "Authorization: Bearer ${TOKEN}"
-H "Content-Type: application/json"
-d "${UPLOAD_BODY}"
"${BASE_URL}/integrations/${INTEGRATION_NAME}/versions:upload"
| jq -r '.integrationVersion.name')" VERSION_ID="${VERSION_NAME##*/}" [[ -n "${VERSION_ID}" && "${VERSION_ID}" != "null" ]] || { echo "upload failed: ${VERSION_NAME}" >&2; exit 1; }
UPLOAD_BODY="$(jq -n --rawfile content /tmp/version.json '{content: $content, fileFormat: "JSON"}')"
VERSION_NAME="$(curl -sS --fail-with-body -X POST
-H "Authorization: Bearer ${TOKEN}"
-H "Content-Type: application/json"
-d "${UPLOAD_BODY}"
"${BASE_URL}/integrations/${INTEGRATION_NAME}/versions:upload"
| jq -r '.integrationVersion.name')" VERSION_ID="${VERSION_NAME##*/}" [[ -n "${VERSION_ID}" && "${VERSION_ID}" != "null" ]] || { echo "upload failed: ${VERSION_NAME}" >&2; exit 1; }
-H "Authorization: Bearer ${TOKEN}"
-H "Content-Type: application/json"
-d "${UPLOAD_BODY}"
"${BASE_URL}/integrations/${INTEGRATION_NAME}/versions:upload"
| jq -r '.integrationVersion.name')" VERSION_ID="${VERSION_NAME##*/}" [[ -n "${VERSION_ID}" && "${VERSION_ID}" != "null" ]] || { echo "upload failed: ${VERSION_NAME}" >&2; exit 1; }
3. Publish the DRAFT version (confirm with user first)
3. Publish the DRAFT version (confirm with user first)
curl -sS --fail-with-body -X POST
-H "Authorization: Bearer ${TOKEN}"
-H "Content-Type: application/json"
-d '{}'
"${BASE_URL}/integrations/${INTEGRATION_NAME}/versions/${VERSION_ID}:publish"
-H "Authorization: Bearer ${TOKEN}"
-H "Content-Type: application/json"
-d '{}'
"${BASE_URL}/integrations/${INTEGRATION_NAME}/versions/${VERSION_ID}:publish"
curl -sS --fail-with-body -X POST
-H "Authorization: Bearer ${TOKEN}"
-H "Content-Type: application/json"
-d '{}'
"${BASE_URL}/integrations/${INTEGRATION_NAME}/versions/${VERSION_ID}:publish"
-H "Authorization: Bearer ${TOKEN}"
-H "Content-Type: application/json"
-d '{}'
"${BASE_URL}/integrations/${INTEGRATION_NAME}/versions/${VERSION_ID}:publish"
4. Invoke the published version synchronously — sends a real email to RECIPIENT_EMAIL (confirm with user first)
4. Invoke the published version synchronously — sends a real email to RECIPIENT_EMAIL (confirm with user first)
curl -sS --fail-with-body -X POST
-H "Authorization: Bearer ${TOKEN}"
-H "Content-Type: application/json"
-H "X-Server-Timeout: 120"
-d "{ "triggerId": "api_trigger/${TRIGGER_NAME}", "inputParameters": { "orderId": {"stringValue": "ORD-1001"} } }"
"${BASE_URL}/integrations/${INTEGRATION_NAME}:execute"
| jq '{executionId, outputParameters}'
-H "Authorization: Bearer ${TOKEN}"
-H "Content-Type: application/json"
-H "X-Server-Timeout: 120"
-d "{ "triggerId": "api_trigger/${TRIGGER_NAME}", "inputParameters": { "orderId": {"stringValue": "ORD-1001"} } }"
"${BASE_URL}/integrations/${INTEGRATION_NAME}:execute"
| jq '{executionId, outputParameters}'
undefinedcurl -sS --fail-with-body -X POST
-H "Authorization: Bearer ${TOKEN}"
-H "Content-Type: application/json"
-H "X-Server-Timeout: 120"
-d "{ "triggerId": "api_trigger/${TRIGGER_NAME}", "inputParameters": { "orderId": {"stringValue": "ORD-1001"} } }"
"${BASE_URL}/integrations/${INTEGRATION_NAME}:execute"
| jq '{executionId, outputParameters}'
-H "Authorization: Bearer ${TOKEN}"
-H "Content-Type: application/json"
-H "X-Server-Timeout: 120"
-d "{ "triggerId": "api_trigger/${TRIGGER_NAME}", "inputParameters": { "orderId": {"stringValue": "ORD-1001"} } }"
"${BASE_URL}/integrations/${INTEGRATION_NAME}:execute"
| jq '{executionId, outputParameters}'
undefinedExample 2: Python Discovery Client Workflow (Built from the API Reference)
示例 2:Python Discovery Client 工作流(基于 API Reference 构建)
No official Python sample is published on ; the following workflow is built from the v1 API discovery document (). The caller must hold on (projects with governance require a run-as service account to publish). Because sends real email, confirm and each state-changing call (, , ) with the user before running. Install dependencies first with .
docs.cloud.google.comgoogle-api-python-clientroles/iam.serviceAccountUserRUN_AS_SAEmailTaskRECIPIENT_EMAILuploadpublishexecutepip install "google-api-python-client>=2.100.0,<3" "google-auth>=2.20.0,<3"python
import json
from googleapiclient.discovery import build
PROJECT_ID = "PROJECT_ID"
LOCATION = "LOCATION"
INTEGRATION_NAME = "INTEGRATION_NAME"
TRIGGER_NAME = "TRIGGER_NAME"
RECIPIENT_EMAIL = "RECIPIENT_EMAIL"
parent = f"projects/{PROJECT_ID}/locations/{LOCATION}"
integration_path = f"{parent}/integrations/{INTEGRATION_NAME}"
service = build("integrations", "v1")
integrations_api = service.projects().locations().integrations()
versions_api = integrations_api.versions()docs.cloud.google.comgoogle-api-python-clientRUN_AS_SAroles/iam.serviceAccountUserEmailTaskuploadpublishexecuteRECIPIENT_EMAILpip install "google-api-python-client>=2.100.0,<3" "google-auth>=2.20.0,<3"python
import json
from googleapiclient.discovery import build
PROJECT_ID = "PROJECT_ID"
LOCATION = "LOCATION"
INTEGRATION_NAME = "INTEGRATION_NAME"
TRIGGER_NAME = "TRIGGER_NAME"
RECIPIENT_EMAIL = "RECIPIENT_EMAIL"
parent = f"projects/{PROJECT_ID}/locations/{LOCATION}"
integration_path = f"{parent}/integrations/{INTEGRATION_NAME}"
service = build("integrations", "v1")
integrations_api = service.projects().locations().integrations()
versions_api = integrations_api.versions()1. List existing integrations (read-only)
1. List existing integrations (read-only)
listed = integrations_api.list(parent=parent, pageSize=20).execute()
for item in listed.get("integrations", []):
print(item["name"], "active=", item.get("active"))
listed = integrations_api.list(parent=parent, pageSize=20).execute()
for item in listed.get("integrations", []):
print(item["name"], "active=", item.get("active"))
2. Upload a DRAFT version — creates INTEGRATION_NAME if it does not exist yet (set RUN_AS_SA and confirm RECIPIENT_EMAIL and action with user before running; caller needs roles/iam.serviceAccountUser on RUN_AS_SA)
2. Upload a DRAFT version — creates INTEGRATION_NAME if it does not exist yet (set RUN_AS_SA and confirm RECIPIENT_EMAIL and action with user before running; caller needs roles/iam.serviceAccountUser on RUN_AS_SA)
version_dict = {
"description": "API-triggered order notification integration",
"runAsServiceAccount": "RUN_AS_SA",
"triggerConfigs": [{
"label": "API Trigger",
"triggerType": "API",
"triggerNumber": "1",
"triggerId": f"api_trigger/{TRIGGER_NAME}",
"properties": {"Trigger name": TRIGGER_NAME},
"startTasks": [{"taskId": "1"}],
}],
"taskConfigs": [{
"task": "EmailTask",
"taskId": "1",
"displayName": "Send Email",
"taskExecutionStrategy": "WHEN_ALL_SUCCEED",
"parameters": {
"To": {"key": "To", "value": {"stringArray": {"stringValues": [RECIPIENT_EMAIL]}}},
"Subject": {"key": "Subject", "value": {"stringValue": "Order notification for $orderId$"}},
"BodyFormat": {"key": "BodyFormat", "value": {"stringValue": "PLAIN_TEXT"}},
"TextBody": {"key": "TextBody", "value": {"stringValue": "Processing order $orderId$."}},
},
}],
"integrationParameters": [{
"key": "orderId",
"dataType": "STRING_VALUE",
"inputOutputType": "IN_OUT",
"defaultValue": {"stringValue": "ORD-0000"},
}],
}
upload_resp = versions_api.upload(
parent=integration_path,
body={"content": json.dumps(version_dict), "fileFormat": "JSON"},
).execute()
version_name = upload_resp["integrationVersion"]["name"]
version_dict = {
"description": "API-triggered order notification integration",
"runAsServiceAccount": "RUN_AS_SA",
"triggerConfigs": [{
"label": "API Trigger",
"triggerType": "API",
"triggerNumber": "1",
"triggerId": f"api_trigger/{TRIGGER_NAME}",
"properties": {"Trigger name": TRIGGER_NAME},
"startTasks": [{"taskId": "1"}],
}],
"taskConfigs": [{
"task": "EmailTask",
"taskId": "1",
"displayName": "Send Email",
"taskExecutionStrategy": "WHEN_ALL_SUCCEED",
"parameters": {
"To": {"key": "To", "value": {"stringArray": {"stringValues": [RECIPIENT_EMAIL]}}},
"Subject": {"key": "Subject", "value": {"stringValue": "Order notification for $orderId$"}},
"BodyFormat": {"key": "BodyFormat", "value": {"stringValue": "PLAIN_TEXT"}},
"TextBody": {"key": "TextBody", "value": {"stringValue": "Processing order $orderId$."}},
},
}],
"integrationParameters": [{
"key": "orderId",
"dataType": "STRING_VALUE",
"inputOutputType": "IN_OUT",
"defaultValue": {"stringValue": "ORD-0000"},
}],
}
upload_resp = versions_api.upload(
parent=integration_path,
body={"content": json.dumps(version_dict), "fileFormat": "JSON"},
).execute()
version_name = upload_resp["integrationVersion"]["name"]
3. Publish the DRAFT version (confirm with user before running)
3. Publish the DRAFT version (confirm with user before running)
versions_api.publish(
name=version_name,
body={"configParameters": {}},
).execute()
versions_api.publish(
name=version_name,
body={"configParameters": {}},
).execute()
4. Invoke the published version synchronously — sends a real email to RECIPIENT_EMAIL (confirm with user before running)
4. Invoke the published version synchronously — sends a real email to RECIPIENT_EMAIL (confirm with user before running)
exec_resp = integrations_api.execute(
name=integration_path,
body={
"triggerId": f"api_trigger/{TRIGGER_NAME}",
"inputParameters": {"orderId": {"stringValue": "ORD-1001"}},
},
).execute()
print("executionId:", exec_resp.get("executionId"))
print("outputParameters:", exec_resp.get("outputParameters"))
undefinedexec_resp = integrations_api.execute(
name=integration_path,
body={
"triggerId": f"api_trigger/{TRIGGER_NAME}",
"inputParameters": {"orderId": {"stringValue": "ORD-1001"}},
},
).execute()
print("executionId:", exec_resp.get("executionId"))
print("outputParameters:", exec_resp.get("outputParameters"))
undefinedCommon Task Gotchas and Limits
常见任务注意事项与限制
- Data limits: Total cumulative integration data (including inputs and outputs) is capped at 30 MB. Above 10 MB, local execution logging is automatically disabled.
- Data Mapping: Input and output types must match (cast with ,
TO_STRING, and so on). Always set a fallback value or null inputs fail the task.TO_INT - Call REST Endpoint: Reaches the public internet only (cannot reach VPC-internal hosts). Fails on HTTP 4xx and 5xx responses. Request max 20 MB, response max 34 MB, max 100 concurrent calls.
- JavaScript: Uses the V8 engine (Rhino was deprecated January 24, 2025). Never remove the entrypoint. Max script request size is 25 MB.
executesScript(event) - Connectors task: Requires an active Integration Connectors connection (billed separately). Timeout is 3 minutes; Application Integration quotas cap data to and from connections at 8 MB (Integration Connectors quotas list a 10 MB Connectors task payload limit; response max 20 MB).
- Approval vs Suspend: Approval tasks can be approved or rejected via with body
POST .../executions/EXECUTION_ID/suspensions/SUSPENSION_ID:resolve(or{"suspension": {"eventExecutionInfoId": "EXECUTION_ID", "integration": "INTEGRATION_NAME", "taskId": "TASK_ID", "state": "LIFTED"}}), which is the same call the Cloud console Approve/Reject buttons make and requires"REJECTED". Suspend tasks are resumed viaintegrations.suspensions.resolve(wherePOST .../integrations/INTEGRATION_NAME/executions/EXECUTION_ID/suspensions/SUSPENSION_ID:liftcan replace-and eitherINTEGRATION_NAMEorEXECUTION_ID, provided at least one ofSUSPENSION_IDorEXECUTION_IDis concrete; accepts an optionalSUSPENSION_IDdefaulting tosuspensionResult), which requiresResolved. Listing suspensions (integrations.suspensions.lift) requiressuspensions.list. All three permissions are included inintegrations.suspensions.list(androles/integrations.suspensionResolver); resuming also requiresroles/integrations.integrationAdminon the integration's run-as service account, requires user confirmation first, and runs the remainder of the execution in async mode.roles/iam.serviceAccountUser - Loops and Sub-integrations: For Each Loop and While Loop allow up to 8,000 iterations; For Each Parallel allows up to 10,000 iterations (default parallelism 50). For sub-integration calls (,
Call Integration,For Each Loop), child responses/output parameters are returned to the parent only inFor Each Parallelmode (SYNCcalls return no output parameters); avoidASYNCmode if the sub-integration exceeds 2 minutes or includes an Approval task.SYNC
See references/tasks-and-gotchas.md for the full task catalog, limits, variable reference syntax, and retry strategies.
- 数据限制:integration 数据总量(包括输入和输出)上限为 30 MB。超过 10 MB 后,将自动禁用本地 execution 日志。
- 数据映射:输入和输出类型必须匹配(可使用 、
TO_STRING等进行类型转换)。务必设置回退值,否则空值输入会导致任务失败。TO_INT - Call REST Endpoint:只能访问公共互联网(无法访问 VPC 内部主机)。遇到 HTTP 4xx 和 5xx 响应时会失败。请求最大 20 MB,响应最大 34 MB,最多允许 100 个并发调用。
- JavaScript:使用 V8 engine(Rhino 已于 2025 年 1 月 24 日弃用)。切勿移除 入口点。脚本请求大小上限为 25 MB。
executesScript(event) - Connectors 任务:需要处于活跃状态的 Integration Connectors connection(单独计费)。超时时间为 3 分钟;Application Integration 配额将传入和传出 connection 的数据限制在 8 MB(Integration Connectors 配额列出了 10 MB 的 Connectors task payload 上限;响应最大 20 MB)。
- Approval 与 Suspend:可以通过 批准或拒绝 Approval task,请求体为
POST .../executions/EXECUTION_ID/suspensions/SUSPENSION_ID:resolve(或{"suspension": {"eventExecutionInfoId": "EXECUTION_ID", "integration": "INTEGRATION_NAME", "taskId": "TASK_ID", "state": "LIFTED"}}),这与 Cloud console 中的 Approve/Reject 按钮执行的调用相同,并且需要"REJECTED"权限。通过integrations.suspensions.resolve恢复 Suspend task(其中可以使用POST .../integrations/INTEGRATION_NAME/executions/EXECUTION_ID/suspensions/SUSPENSION_ID:lift替代-,且INTEGRATION_NAME或EXECUTION_ID至少有一个必须是具体值;还接受可选的SUSPENSION_ID,默认值为suspensionResult),该操作需要Resolved权限。列出 suspension(integrations.suspensions.lift)需要suspensions.list权限。所有三项权限都包含在integrations.suspensions.list(以及roles/integrations.suspensionResolver)角色中;恢复 execution 还需要拥有 integration 的 run-as service account 的roles/integrations.integrationAdmin权限,需要事先获得用户确认,并以异步模式运行 execution 的剩余部分。roles/iam.serviceAccountUser - Loop 与 Sub-integration:For Each Loop 和 While Loop 最多允许 8,000 次迭代;For Each Parallel 最多允许 10,000 次迭代(默认并行度为 50)。对于 sub-integration 调用(、
Call Integration、For Each Loop),只有For Each Parallel模式会将子响应或输出参数返回给父级(SYNC调用不返回输出参数);如果 sub-integration 超过 2 分钟或包含 Approval task,请避免使用ASYNC模式。SYNC
有关完整的 task 目录、限制、变量引用语法和重试策略,请参阅 references/tasks-and-gotchas.md。
Promoting Between Environments (CI/CD)
环境间提升(CI/CD)
To promote an integration from development to staging or production:
- Externalize environment-specific values (endpoints, project IDs, connection names) as config variables.
CONFIG_<NAME> - Provision the target region, run-as service account, Integration Connectors connections, and authentication profiles () in the target project first (these infrastructure resources are not created by version uploads).
authConfigs - Download the tested version JSON (), commit it to Git alongside per-environment config files, rewrite
versions:download?fileFormat=JSONto the target environment's run-as service account (.runAsServiceAccount) before uploading, and runjq --arg sa "$RUN_AS_SA" '.runAsServiceAccount = $sa' integration.json > integration.env.json+versions:uploadfrom Cloud Build or your CI runner (versions:publishcreates the integration automatically in the target project if it does not exist yet, producing aversions:uploadthatDRAFTactivates).:publish
See references/cicd-promotion.md for the complete promotion checklist and a ready-to-use Cloud Build pipeline.
要将 integration 从开发环境提升到 staging 或 production:
- 将环境特定的值(endpoint、项目 ID、连接名称)外部化为 配置变量。
CONFIG_<NAME> - 首先在目标项目中预配目标区域、run-as service account、Integration Connectors connection 和身份验证配置文件();这些基础架构资源不会由 version 上传操作创建。
authConfigs - 下载经过测试的 version JSON(),将其与各环境的配置文件一起提交到 Git,在上传前使用
versions:download?fileFormat=JSON将jq --arg sa "$RUN_AS_SA" '.runAsServiceAccount = $sa' integration.json > integration.env.json改写为目标环境的 run-as service account,然后在 Cloud Build 或 CI runner 中运行.runAsServiceAccount+versions:upload(如果目标项目中尚不存在该 integration,versions:publish会自动创建它,并生成一个由versions:upload激活的:publish)。DRAFT
有关完整的提升检查清单和可直接使用的 Cloud Build pipeline,请参阅 references/cicd-promotion.md。
Cleanup and Cost Management
清理与成本管理
- Pricing: An active billing account must be attached to the project even when usage stays within the monthly free tier. Application Integration offers a monthly free tier for executions, data processed, and Google service connector nodes, after which executions, data processed, and Integration Connectors nodes incur charges. Review current thresholds and rates on the Application Integration pricing page and estimate costs with the Google Cloud Pricing Calculator.
- Unpublish to stop triggers: Run (after user confirmation) to stop scheduled, Pub/Sub, or API triggers from firing.
POST .../versions/VERSION_ID:unpublish - Delete versions or integrations: archives a single version (deleting all versions deletes the integration).
DELETE .../versions/VERSION_IDpermanently deletes the integration and all its versions.DELETE .../integrations/INTEGRATION_NAME - Connector nodes: Unpublishing or deleting an integration does not delete Integration Connectors connections. Delete unused connections at to stop hourly node charges.
https://console.cloud.google.com/connectors/connections
- 定价:即使使用量保持在每月免费额度内,项目也必须关联有效的计费账户。Application Integration 对 execution、处理的数据和 Google service connector node 提供每月免费额度;超出后,execution、处理的数据和 Integration Connectors node 将产生费用。请在 Application Integration pricing page 上查看当前阈值和费率,并使用 Google Cloud Pricing Calculator 估算成本。
- 取消发布以停止 trigger:运行 (获得用户确认后)以停止 scheduled、Pub/Sub 或 API trigger 触发。
POST .../versions/VERSION_ID:unpublish - 删除 version 或 integration:会归档单个 version(删除所有 version 会删除该 integration)。
DELETE .../versions/VERSION_ID会永久删除该 integration 及其所有 version。DELETE .../integrations/INTEGRATION_NAME - Connector node:取消发布或删除 integration 不会删除 Integration Connectors connection。若要停止每小时 node 费用,请在 删除未使用的 connection。
https://console.cloud.google.com/connectors/connections
Reference Guides
Reference Guides
- REST API Cheatsheet: v1 and v2 endpoints, parameters, filters, and IAM permissions.
- IntegrationVersion JSON Reference: Schema for ,
triggerConfigs,taskConfigs,integrationParameters, and config variables.ValueType - Triggers and Execution Reference: Trigger types, formats,
triggerIdvs:execute, OpenAPI generation, and lifting or resolving suspensions.:schedule - Tasks and Gotchas Reference: Task-by-task rules, quotas, variable reference syntax, and error handling strategies.
- CI/CD Promotion Reference: Cross-project promotion checklist, environment config pattern, and Cloud Build workflow.
- REST API Cheatsheet:v1 和 v2 端点、参数、过滤器及 IAM 权限。
- IntegrationVersion JSON Reference:、
triggerConfigs、taskConfigs、integrationParameters和配置变量的 schema。ValueType - Triggers and Execution Reference:trigger 类型、格式、
triggerId与:execute、OpenAPI 生成,以及暂停解除或审批处理。:schedule - Tasks and Gotchas Reference:逐任务规则、配额、变量引用语法和错误处理策略。
- CI/CD Promotion Reference:跨项目提升检查清单、环境配置模式和 Cloud Build 工作流。