Application Integration Authoring

Application Integration Authoring

Builds, versions, publishes, tests and runs Google Cloud Application Integration workflows through the REST API, and promotes versions across environments in CI/CD.

Skill files7 files

references/

SKILL.md394 lines
1
---
2
name: application-integration-authoring
3
metadata:
4
version: "1.0.3"
5
category: ApplicationDevelopment
6
description: >-
7
Builds, versions, publishes, tests, and executes Google Cloud Application Integration
8
workflows through the REST API and Python discovery client, and promotes versions across
9
environments. Use when listing integrations, downloading or uploading integration versions
10
as JSON, configuring API triggers or config variables, publishing drafts, invoking
11
integrations, or automating CI/CD promotion. Do not use for initial region provisioning
12
and IAM setup (use application-integration-basics) or diagnosing failed runs and logs (use application-integration-troubleshooting).
13
---
14
15
# Application Integration Authoring
16
17
Google Cloud Application Integration workflows are authored, versioned, published, and executed programmatically through the REST API (`https://integrations.googleapis.com/v1/...`) or the discovery-based Google API Python client (`googleapiclient.discovery.build("integrations", "v1")`).
18
19
There is no `gcloud integrations` command group, no Google-managed MCP server for Application Integration, and no documented Terraform resource for integrations or versions. Use `gcloud` only for authentication, enabling APIs, and IAM bindings. Use Terraform only for region provisioning (`google_integrations_client`), authentication profiles (`google_integrations_auth_config`), and Integration Connectors (`google_integration_connectors_connection`).
20
21
For initial project setup, region provisioning, and IAM role definitions, use the `application-integration-basics` skill. For diagnosing failed or stuck runs, execution logs, and quota errors, use the `application-integration-troubleshooting` skill.
22
23
## Attribution
24
25
**MUST READ**: Before executing any `gcloud` command, REST API call, or Python
26
discovery-client call, you MUST read
27
[Usage Attribution](references/attribution.md). For commands executed directly
28
in the terminal (never in generated scripts, Terraform, ADK agents, or user
29
code), prefix `gcloud` with
30
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:application-integration-authoring)"`
31
and add `agent-skills/1.0 (skill:application-integration-authoring)` to the
32
`User-Agent` header of `curl` requests.
33
34
## Safety and Confirmation Rules
35
36
- **Read-only operations run freely**: `integrations.list`, `integrations:search`, `versions.list`, `versions.get`, `versions:download`, `authConfigs.list`, and `executions.list`.
37
- **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.
38
- **Host changes require approval.** Before installing packages (`pip install`) or changing global gcloud or credential state (`gcloud config set ...` such as `auth/impersonate_service_account`, `gcloud auth application-default login` / `set-quota-project`), show the exact command and wait for the user's approval.
39
- **Never store secrets in config variables**: Config variables (`CONFIG_*`) are stored and exported in plain text. Always use authentication profiles (`projects.locations.authConfigs`) or the Secret Manager access task for credentials.
40
41
## Prerequisites Checklist
42
43
1. **Install Google Cloud CLI**: Follow [Install the Google Cloud CLI](https://docs.cloud.google.com/sdk/docs/install-sdk.md.txt) if `gcloud` is not installed.
44
2. **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 (changes global gcloud state; get the user's approval first):
45
```bash
46
gcloud config set project PROJECT_ID
47
```
48
3. **Enable required APIs**:
49
```bash
50
gcloud services enable integrations.googleapis.com connectors.googleapis.com secretmanager.googleapis.com
51
```
52
4. **Provision the region**: Application Integration is regional: confirm the target region is supported on [Application Integration locations](https://docs.cloud.google.com/application-integration/docs/locations.md.txt) and use `us-central1` as a well-supported default when the user has no preference. The region is the `LOCATION` in every REST path; no `gcloud` default-region setting applies to Application Integration. The target `LOCATION` must be provisioned via the Cloud console or `POST .../clients:provision` before authoring integrations (see `application-integration-basics`).
53
5. **Authenticate**:
54
- For `curl`: run `gcloud auth login` (changes host or credential state; get the user's approval first) and pass `-H "Authorization: Bearer $(gcloud auth print-access-token)"`.
55
- For the Python client (install with `pip install "google-api-python-client>=2.100.0,<3" "google-auth>=2.20.0,<3"`): run `gcloud auth application-default login` and `gcloud auth application-default set-quota-project PROJECT_ID` (or set `GOOGLE_APPLICATION_CREDENTIALS` for a service account) (changes host or credential state; get the user's approval first).
56
- For service account impersonation: run `gcloud config set auth/impersonate_service_account SA_EMAIL` (requires `roles/iam.serviceAccountTokenCreator`) (changes host or credential state; get the user's approval first).
57
6. **Verify IAM roles**:
58
- Create, upload, or edit drafts: `roles/integrations.integrationEditor` (covers `versions:upload`, which needs `integrations.integrationVersions.create`, and `versions:publish`)
59
- Publish or unpublish: `roles/integrations.integrationDeployer` or `roles/integrations.integrationEditor` (`roles/integrations.integrationDeployer` alone can publish an existing version but cannot upload via `versions:upload`), plus `roles/integrations.serviceAgent` granted to the Application Integration service agent (`service-PROJECT_NUMBER@gcp-sa-integrations.iam.gserviceaccount.com`)
60
- Invoke integrations: `roles/integrations.integrationInvoker`
61
- 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 `runAsServiceAccount`) cannot be tested or published unless `runAsServiceAccount` is set (and region governance requires it for all integrations); whenever `runAsServiceAccount` is set, the user publishing or testing the version needs `roles/iam.serviceAccountUser` on it (and at runtime, the invoking caller or trigger service account needs `roles/iam.serviceAccountUser` on it).
62
63
## Decision Flow
64
65
| Goal | Action | Endpoint / Method |
66
| :--- | :--- | :--- |
67
| Inspect existing integrations in a region | List integrations, then list versions | `GET .../integrations` then `GET .../versions` |
68
| Export an integration version to source control | Download version JSON | `GET .../versions/VERSION_ID:download?fileFormat=JSON` |
69
| Create an integration or add a new `DRAFT` version from JSON | Upload version JSON (creates the integration if it does not exist, or adds a new `DRAFT` version; still needs `:publish`) | `POST .../integrations/INTEGRATION_NAME/versions:upload` |
70
| Create a brand-new integration and fail on a name clash | Create first `DRAFT` version with `newIntegration=true` (returns `ALREADY_EXISTS` if `INTEGRATION_NAME` already exists) | `POST .../integrations/INTEGRATION_NAME/versions?newIntegration=true` |
71
| Edit an existing `DRAFT` version | Check `lockHolder`, then patch or upload | `PATCH .../versions/VERSION_ID?updateMask=...` |
72
| Edit an `ACTIVE` (published) integration | Upload or create a new `DRAFT` version | `POST .../integrations/INTEGRATION_NAME/versions:upload` |
73
| Externalize environment-specific URLs or IDs | Define `CONFIG_<NAME>` and supply at publish | `integrationConfigParameters` + `versions:publish` |
74
| Store API keys, OAuth credentials, or certs | Create an authentication profile | `POST .../authConfigs` |
75
| Test an integration before production | Publish to a non-production project and invoke `:execute` | `POST .../versions/VERSION_ID:publish` then `POST .../integrations/INTEGRATION_NAME:execute` |
76
| Deploy a `DRAFT` to serve live traffic | Publish version with `configParameters` | `POST .../versions/VERSION_ID:publish` |
77
| Invoke a published integration synchronously | Call `:execute` with `api_trigger/TRIGGER_NAME` | `POST .../integrations/INTEGRATION_NAME:execute` |
78
| Invoke a published integration asynchronously | Call `:schedule` with `scheduleTime` | `POST .../integrations/INTEGRATION_NAME:schedule` |
79
| Promote a version across projects (CI/CD) | Download JSON -> Upload to target -> Publish | `:download` -> `:upload` -> `:publish` |
80
81
See [references/rest-api-cheatsheet.md](references/rest-api-cheatsheet.md) for full request parameters, query filters, and IAM permissions for each method.
82
83
## Core Authoring Workflow
84
85
### 1. List Integrations and Download a Version
86
87
List integrations in `LOCATION` and list versions for a specific `INTEGRATION_NAME`:
88
89
```bash
90
TOKEN="$(gcloud auth print-access-token)"
91
92
# List integrations in the region
93
curl -sS -H "Authorization: Bearer ${TOKEN}" \
94
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations?pageSize=50"
95
96
# List versions (ordered by most recently modified)
97
curl -sS -H "Authorization: Bearer ${TOKEN}" \
98
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions?orderBy=last_modified_time%20desc"
99
```
100
101
Download a specific version (`VERSION_ID` is the UUID at the end of the version's `name` field) as portable JSON:
102
103
```bash
104
curl -sS -H "Authorization: Bearer ${TOKEN}" \
105
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions/VERSION_ID:download?fileFormat=JSON" \
106
| jq -r '.content' > integration-version.json
107
```
108
109
### 2. Understand the `IntegrationVersion` Structure
110
111
An `IntegrationVersion` JSON object contains four primary arrays and version-level settings:
112
113
- `triggerConfigs`: Entry points that start the workflow. Each entry requires a unique `triggerNumber`, plus `triggerType` (such as `API` or `PRIVATE_TRIGGER`), optional `triggerId` (auto-generated from `properties` if omitted; for API triggers: `api_trigger/TRIGGER_NAME`), and `startTasks` pointing to the first `taskId`.
114
- `taskConfigs`: Units of work. Each entry needs `task` (the task type, such as `EmailTask` in the public upload sample, or `FieldMappingTask` in a discovery enum description), a unique `taskId`, `parameters`, `nextTasks`, and optional `failurePolicy` or `errorCatcherId`.
115
- `integrationParameters`: Input, output, and transient variables (`key`, `dataType` such as `STRING_VALUE` or `JSON_VALUE`, `inputOutputType` of `IN`, `OUT`, `IN_OUT`, or `IN_OUT_TYPE_UNSPECIFIED`, and `defaultValue`).
116
- `integrationConfigParameters`: Environment-specific config variable definitions (`parameter` with key `` `CONFIG_<NAME>` `` and `parameter.defaultValue`; a top-level `value` in uploaded or created draft JSON is discarded, so per-environment values go in `configParameters` at publish).
117
- `runAsServiceAccount`: Dedicated user-managed service account email. When set and no authentication profile (`authConfig`) is configured on the task, it is used to generate the auth token for Connector (`Connectors`), REST (`Call REST Endpoint`), and Cloud Function tasks; an authentication profile configured on the task takes precedence over `runAsServiceAccount`.
118
119
Always use `triggerConfigs`, `taskConfigs`, and `integrationParameters`. Never use `triggerConfigsInternal`, `taskConfigsInternal`, or `integrationParametersInternal` because they are deprecated. See [references/integration-version-json.md](references/integration-version-json.md) for field schemas, `ValueType` shapes, and a minimal `IntegrationVersion` JSON template.
120
121
### 3. Create or Upload a `DRAFT` Version
122
123
Each integration allows up to 100 versions and 100 tasks, and `INTEGRATION_NAME` can be at most 64 characters. Calling `versions:upload` creates a new `DRAFT` version—creating the integration automatically if `INTEGRATION_NAME` does not exist yet, or adding the next `DRAFT` version if it already exists (for example, uploading onto version 5 creates version 6). The uploaded version is in `DRAFT` state and still requires `versions:publish` to serve traffic. Use `POST .../versions?newIntegration=true` (passing an `IntegrationVersion` JSON body) only when you explicitly want the call to fail with `ALREADY_EXISTS` if `INTEGRATION_NAME` already exists.
124
125
```bash
126
# Upload integration-version.json as a new DRAFT version
127
PAYLOAD="$(jq -n --rawfile content integration-version.json '{content: $content, fileFormat: "JSON"}')"
128
129
curl -sS --fail-with-body -X POST \
130
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
131
-H "Content-Type: application/json" \
132
-d "${PAYLOAD}" \
133
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions:upload"
134
```
135
136
Capture the new `VERSION_ID` from `.integrationVersion.name` in the response (`projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions/VERSION_ID`).
137
138
### 4. Version States and Edit-Lock Rules
139
140
| State | Meaning | Editable? | Can Serve Triggers? |
141
| :--- | :--- | :--- | :--- |
142
| `DRAFT` | Version actively being edited; its edit lock is held by its author (`lockHolder` email) for 15 minutes from the last update | Yes (only by `lockHolder`) | No |
143
| `ACTIVE` | Published version serving live traffic | No | Yes |
144
| `SNAPSHOT` | Prior draft (when another author takes over in the console) or unpublished version (`PREVIOUSLY_PUBLISHED`) | No | No |
145
| `ARCHIVED` | Soft-deleted via `versions.delete` (no undelete; listed as `DELETED` on the Integration versions documentation page) | No | No |
146
147
- **Edit-lock enforcement**: A `DRAFT` version's edit lock is held by its author (`lockHolder`). Calling `versions:publish` or `versions.delete` on a `DRAFT` fails if the caller is not the `lockHolder` (`versions:publish` and `versions.delete` release any existing lock when they succeed).
148
- **No v1 lock-takeover API**: `takeoverEditLock` does **not** exist on `projects.locations.integrations.versions` in the v1 REST API (it only exists on `versions.testCases`). If a `DRAFT` is locked by another user, wait 15 minutes from `updateTime` for the lock to expire automatically, or click **Take Over** in the Cloud console (which converts the existing draft to `SNAPSHOT` and creates a new `DRAFT`).
149
150
### 5. Config Variables vs Authentication Profiles
151
152
- **Config variables (`CONFIG_<NAME>`)**: Use for non-secret environment values (backend hostnames, Pub/Sub topics, connection names). Define them in `integrationConfigParameters` on the draft (putting any default in `parameter.defaultValue`, because a top-level `value` on a draft is discarded) and pass their per-environment values in `configParameters` when calling `versions:publish`. **Gotcha**: Keys in `configParameters` at publish must **exactly match** a key in `integrationConfigParameters`, backticks included (for example, `` "`CONFIG_target_url`" ``); unknown keys are **silently ignored**, not rejected (`versions:publish` returns 200 and the default stays). Config variables cannot configure Integration Connectors entity operations or actions.
153
- **Authentication profiles (`authConfigs`)**: Use for API keys, OAuth 2.0 credentials, JWTs, OIDC tokens, SSL/TLS certificates, and service accounts. Auth profiles are regional resources (`projects/PROJECT_ID/locations/LOCATION/authConfigs/AUTH_CONFIG_ID`) and are **not** included when you download an integration version. Create them in each target project via `POST .../authConfigs` or Terraform `google_integrations_auth_config`.
154
155
### 6. Test, Publish, and Unpublish
156
157
- **Recommended testing path**: Test integrations by publishing the version in a non-production project (`versions:publish`) and invoking `integrations:execute` there.
158
- **Note on `integrations:test`**: The v1 REST API includes `POST .../integrations/INTEGRATION_NAME:test` for testing a `DRAFT`, which requires `TestIntegrationsRequest.clientId` ("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 a `clientId` value; publish to a non-production project and call `:execute` instead. (Draft testing also cannot run `Approval`, `Suspend`, or `Timer` tasks, and Call REST Endpoint authentication profile changes only take effect after publishing.)
159
- **Publish (`versions:publish`)**: Deploys the version as `ACTIVE` and releases any edit lock (fails if the version is already `ACTIVE` or `ARCHIVED`, or if it is a `DRAFT` whose `lockHolder` differs from the caller). Any previously `ACTIVE` version is automatically unpublished, and dependent services switch to the newly published version.
160
- **Gotcha**: Publishing a new version automatically cancels all suspended executions of the previous version.
161
- **Gotcha**: Due to eventual consistency, the previous version can continue running for up to 10 minutes after a new version is published.
162
- **Unpublish (`versions:unpublish`)**: Moves the `ACTIVE` version to `SNAPSHOT` (tagged `PREVIOUSLY_PUBLISHED`; fails if the version is not `ACTIVE`) and stops triggers and dependent services.
163
164
```bash
165
# Publish VERSION_ID and supply config variable values (keys must exactly match integrationConfigParameters keys, backticks included; unknown keys are silently ignored)
166
curl -sS --fail-with-body -X POST \
167
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
168
-H "Content-Type: application/json" \
169
-d '{"configParameters": {"`CONFIG_backend_url`": "https://api.example.com"}}' \
170
"https://integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions/VERSION_ID:publish"
171
```
172
173
### 7. Execute (Sync) vs Schedule (Async)
174
175
Only an `ACTIVE` (published) version can be invoked via `execute` or `schedule`. For API triggers, `triggerId` is always `api_trigger/TRIGGER_NAME` (where `TRIGGER_NAME` is at most 64 characters). Passing `-` as `INTEGRATION_NAME` in `execute` runs all published integrations in that region that share the `triggerId`.
176
177
| Method | Mode | Max Timeout | Max API Input | Key Request Fields | Key Response Fields |
178
| :--- | :--- | :--- | :--- | :--- | :--- |
179
| `integrations:execute` | Sync | 2 minutes | 8 MB | `triggerId`, `inputParameters`, `requestId`, `doNotPropagateError` | `executionId`, `outputParameters`, `parameters` |
180
| `integrations:schedule` | Async | 10 minutes | Not documented | `triggerId`, `scheduleTime` (RFC 3339), `inputParameters`, `requestId`, `userGeneratedExecutionId` | `executionInfoIds[]` |
181
182
- **Reading `outputParameters` and `executionId`**: In `ExecuteIntegrationsResponse`, `executionId` identifies the run, and `outputParameters` is a JSON object of output variables (system-generated keys such as `` `ExecutionId` `` are wrapped in backticks).
183
- **HTTP 200 does not prove every task succeeded**: If `doNotPropagateError` is `true`, or a task uses failure policy `IGNORE` or `NONE` with an alternate path, the HTTP call returns `200 OK` even when a task failed. Always verify the execution record via `executions.list?filter=execution_id="EXECUTION_ID"` (checking `executionDetails.state`, each task's `taskExecutionState`, and `ErrorInfo` in `Execution.responseParameters`; when `doNotPropagateError` is `true`, errors are also returned in event parameters as `PostWithTriggerIdExecutionException`). Do not rely on the legacy/deprecated `executionFailed` field.
184
185
See [references/triggers-and-execution.md](references/triggers-and-execution.md) for all trigger types, `ValueType` input formatting, OpenAPI spec generation, and suspension lifting and approval resolution.
186
187
## End-to-End Version and API Workflow Examples
188
189
In downloaded and uploaded `IntegrationVersion` JSON, an `EmailTask` uses four customer-visible parameter keys inside `taskConfigs[].parameters`: `"To"` (`stringArray` of recipient addresses), `"Subject"` (`stringValue`), `"BodyFormat"` (`stringValue`, such as `"PLAIN_TEXT"`), and `"TextBody"` (`stringValue`). Both runnable examples below also set `"runAsServiceAccount": "RUN_AS_SA"` (replace `RUN_AS_SA` with your dedicated service account email, such as `order-workflow-sa@PROJECT_ID.iam.gserviceaccount.com`; projects with governance require a run-as service account to publish, and the caller needs `roles/iam.serviceAccountUser` on it). Executing an `EmailTask` sends a real email, so always confirm the recipient address (`RECIPIENT_EMAIL`) and each state-changing command (upload, publish, and execute) with the user before running.
190
191
### Example 1: Upload, Publish, and Invoke Workflow with `curl`
192
193
This example uploads a runnable `IntegrationVersion` JSON (`versions:upload` creates `INTEGRATION_NAME` automatically if it does not exist yet, or adds a new `DRAFT` version if it does), publishes the draft, and invokes `:execute`. The caller must hold `roles/iam.serviceAccountUser` on `RUN_AS_SA` (projects with governance require a run-as service account to publish). Because `EmailTask` sends real email, confirm `RECIPIENT_EMAIL` and get user confirmation before running the upload, publish, and execute calls.
194
195
```bash
196
set -euo pipefail
197
export PROJECT_ID="my-project"
198
export LOCATION="us-central1"
199
export INTEGRATION_NAME="order-webhook"
200
export TRIGGER_NAME="order_api"
201
TOKEN="$(gcloud auth print-access-token)"
202
BASE_URL="https://integrations.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}"
203
204
# 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)
205
cat <<'EOF' > /tmp/version.json
206
{
207
"description": "API-triggered order notification integration",
208
"runAsServiceAccount": "RUN_AS_SA",
209
"triggerConfigs": [
210
{
211
"label": "API Trigger",
212
"triggerType": "API",
213
"triggerNumber": "1",
214
"triggerId": "api_trigger/order_api",
215
"properties": {"Trigger name": "order_api"},
216
"startTasks": [{"taskId": "1"}]
217
}
218
],
219
"taskConfigs": [
220
{
221
"task": "EmailTask",
222
"taskId": "1",
223
"displayName": "Send Email",
224
"taskExecutionStrategy": "WHEN_ALL_SUCCEED",
225
"parameters": {
226
"To": {"key": "To", "value": {"stringArray": {"stringValues": ["RECIPIENT_EMAIL"]}}},
227
"Subject": {"key": "Subject", "value": {"stringValue": "Order notification for $orderId$"}},
228
"BodyFormat": {"key": "BodyFormat", "value": {"stringValue": "PLAIN_TEXT"}},
229
"TextBody": {"key": "TextBody", "value": {"stringValue": "Processing order $orderId$."}}
230
}
231
}
232
],
233
"integrationParameters": [
234
{
235
"key": "orderId",
236
"dataType": "STRING_VALUE",
237
"inputOutputType": "IN_OUT",
238
"defaultValue": {"stringValue": "ORD-0000"}
239
}
240
]
241
}
242
EOF
243
244
# 2. Upload as a new DRAFT version — creates INTEGRATION_NAME if it does not exist yet (confirm with user first)
245
UPLOAD_BODY="$(jq -n --rawfile content /tmp/version.json '{content: $content, fileFormat: "JSON"}')"
246
VERSION_NAME="$(curl -sS --fail-with-body -X POST \
247
-H "Authorization: Bearer ${TOKEN}" \
248
-H "Content-Type: application/json" \
249
-d "${UPLOAD_BODY}" \
250
"${BASE_URL}/integrations/${INTEGRATION_NAME}/versions:upload" \
251
| jq -r '.integrationVersion.name')"
252
VERSION_ID="${VERSION_NAME##*/}"
253
[[ -n "${VERSION_ID}" && "${VERSION_ID}" != "null" ]] || { echo "upload failed: ${VERSION_NAME}" >&2; exit 1; }
254
255
# 3. Publish the DRAFT version (confirm with user first)
256
curl -sS --fail-with-body -X POST \
257
-H "Authorization: Bearer ${TOKEN}" \
258
-H "Content-Type: application/json" \
259
-d '{}' \
260
"${BASE_URL}/integrations/${INTEGRATION_NAME}/versions/${VERSION_ID}:publish"
261
262
# 4. Invoke the published version synchronously — sends a real email to RECIPIENT_EMAIL (confirm with user first)
263
curl -sS --fail-with-body -X POST \
264
-H "Authorization: Bearer ${TOKEN}" \
265
-H "Content-Type: application/json" \
266
-H "X-Server-Timeout: 120" \
267
-d "{
268
\"triggerId\": \"api_trigger/${TRIGGER_NAME}\",
269
\"inputParameters\": {
270
\"orderId\": {\"stringValue\": \"ORD-1001\"}
271
}
272
}" \
273
"${BASE_URL}/integrations/${INTEGRATION_NAME}:execute" \
274
| jq '{executionId, outputParameters}'
275
```
276
277
### Example 2: Python Discovery Client Workflow (Built from the API Reference)
278
279
No official Python sample is published on `docs.cloud.google.com`; the following workflow is built from the v1 API discovery document (`google-api-python-client`). The caller must hold `roles/iam.serviceAccountUser` on `RUN_AS_SA` (projects with governance require a run-as service account to publish). Because `EmailTask` sends real email, confirm `RECIPIENT_EMAIL` and each state-changing call (`upload`, `publish`, `execute`) with the user before running. Install dependencies first with `pip install "google-api-python-client>=2.100.0,<3" "google-auth>=2.20.0,<3"` (changes host or credential state; get the user's approval first).
280
281
```python
282
import json
283
from googleapiclient.discovery import build
284
285
PROJECT_ID = "PROJECT_ID"
286
LOCATION = "LOCATION"
287
INTEGRATION_NAME = "INTEGRATION_NAME"
288
TRIGGER_NAME = "TRIGGER_NAME"
289
RECIPIENT_EMAIL = "RECIPIENT_EMAIL"
290
parent = f"projects/{PROJECT_ID}/locations/{LOCATION}"
291
integration_path = f"{parent}/integrations/{INTEGRATION_NAME}"
292
293
service = build("integrations", "v1")
294
integrations_api = service.projects().locations().integrations()
295
versions_api = integrations_api.versions()
296
297
# 1. List existing integrations (read-only)
298
listed = integrations_api.list(parent=parent, pageSize=20).execute()
299
for item in listed.get("integrations", []):
300
print(item["name"], "active=", item.get("active"))
301
302
# 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)
303
version_dict = {
304
"description": "API-triggered order notification integration",
305
"runAsServiceAccount": "RUN_AS_SA",
306
"triggerConfigs": [{
307
"label": "API Trigger",
308
"triggerType": "API",
309
"triggerNumber": "1",
310
"triggerId": f"api_trigger/{TRIGGER_NAME}",
311
"properties": {"Trigger name": TRIGGER_NAME},
312
"startTasks": [{"taskId": "1"}],
313
}],
314
"taskConfigs": [{
315
"task": "EmailTask",
316
"taskId": "1",
317
"displayName": "Send Email",
318
"taskExecutionStrategy": "WHEN_ALL_SUCCEED",
319
"parameters": {
320
"To": {"key": "To", "value": {"stringArray": {"stringValues": [RECIPIENT_EMAIL]}}},
321
"Subject": {"key": "Subject", "value": {"stringValue": "Order notification for $orderId$"}},
322
"BodyFormat": {"key": "BodyFormat", "value": {"stringValue": "PLAIN_TEXT"}},
323
"TextBody": {"key": "TextBody", "value": {"stringValue": "Processing order $orderId$."}},
324
},
325
}],
326
"integrationParameters": [{
327
"key": "orderId",
328
"dataType": "STRING_VALUE",
329
"inputOutputType": "IN_OUT",
330
"defaultValue": {"stringValue": "ORD-0000"},
331
}],
332
}
333
upload_resp = versions_api.upload(
334
parent=integration_path,
335
body={"content": json.dumps(version_dict), "fileFormat": "JSON"},
336
).execute()
337
version_name = upload_resp["integrationVersion"]["name"]
338
339
# 3. Publish the DRAFT version (confirm with user before running)
340
versions_api.publish(
341
name=version_name,
342
body={"configParameters": {}},
343
).execute()
344
345
# 4. Invoke the published version synchronously — sends a real email to RECIPIENT_EMAIL (confirm with user before running)
346
exec_resp = integrations_api.execute(
347
name=integration_path,
348
body={
349
"triggerId": f"api_trigger/{TRIGGER_NAME}",
350
"inputParameters": {"orderId": {"stringValue": "ORD-1001"}},
351
},
352
).execute()
353
print("executionId:", exec_resp.get("executionId"))
354
print("outputParameters:", exec_resp.get("outputParameters"))
355
```
356
357
## Common Task Gotchas and Limits
358
359
- **Data limits**: Total cumulative integration data (including inputs and outputs) is capped at 30 MB. Above 10 MB, local execution logging is automatically disabled.
360
- **Data Mapping**: Input and output types must match (cast with `TO_STRING`, `TO_INT`, and so on). Always set a fallback value or null inputs fail the task.
361
- **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.
362
- **JavaScript**: Uses the V8 engine (Rhino was deprecated January 24, 2025). Never remove the `executesScript(event)` entrypoint. Max script request size is 25 MB.
363
- **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).
364
- **Approval vs Suspend**: Approval tasks can be approved or rejected via `POST .../executions/EXECUTION_ID/suspensions/SUSPENSION_ID:resolve` with body `{"suspension": {"eventExecutionInfoId": "EXECUTION_ID", "integration": "INTEGRATION_NAME", "taskId": "TASK_ID", "state": "LIFTED"}}` (or `"REJECTED"`), which is the same call the Cloud console Approve/Reject buttons make and requires `integrations.suspensions.resolve`. Suspend tasks are resumed via `POST .../integrations/INTEGRATION_NAME/executions/EXECUTION_ID/suspensions/SUSPENSION_ID:lift` (where `-` can replace `INTEGRATION_NAME` and either `EXECUTION_ID` or `SUSPENSION_ID`, provided at least one of `EXECUTION_ID` or `SUSPENSION_ID` is concrete; accepts an optional `suspensionResult` defaulting to `Resolved`), which requires `integrations.suspensions.lift`. Listing suspensions (`suspensions.list`) requires `integrations.suspensions.list`. All three permissions are included in `roles/integrations.suspensionResolver` (and `roles/integrations.integrationAdmin`); resuming also requires `roles/iam.serviceAccountUser` on the integration's run-as service account, requires user confirmation first, and runs the remainder of the execution in async mode.
365
- **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`, `For Each Parallel`), child responses/output parameters are returned to the parent only in `SYNC` mode (`ASYNC` calls return no output parameters); avoid `SYNC` mode if the sub-integration exceeds 2 minutes or includes an Approval task.
366
367
See [references/tasks-and-gotchas.md](references/tasks-and-gotchas.md) for the full task catalog, limits, variable reference syntax, and retry strategies.
368
369
## Promoting Between Environments (CI/CD)
370
371
To promote an integration from development to staging or production:
372
373
1. Externalize environment-specific values (endpoints, project IDs, connection names) as `CONFIG_<NAME>` config variables.
374
2. Provision the target region, run-as service account, Integration Connectors connections, and authentication profiles (`authConfigs`) in the target project first (these infrastructure resources are not created by version uploads).
375
3. Download the tested version JSON (`versions:download?fileFormat=JSON`), commit it to Git alongside per-environment config files, rewrite `.runAsServiceAccount` to the target environment's run-as service account (`jq --arg sa "$RUN_AS_SA" '.runAsServiceAccount = $sa' integration.json > integration.env.json`) before uploading, and run `versions:upload` + `versions:publish` from Cloud Build or your CI runner (`versions:upload` creates the integration automatically in the target project if it does not exist yet, producing a `DRAFT` that `:publish` activates).
376
377
See [references/cicd-promotion.md](references/cicd-promotion.md) for the complete promotion checklist and a ready-to-use Cloud Build pipeline.
378
379
## Cleanup and Cost Management
380
381
- **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](https://cloud.google.com/application-integration/pricing) and estimate costs with the Google Cloud Pricing Calculator.
382
- **Unpublish to stop triggers**: Run `POST .../versions/VERSION_ID:unpublish` (after user confirmation) to stop scheduled, Pub/Sub, or API triggers from firing.
383
- **Delete versions or integrations**: `DELETE .../versions/VERSION_ID` archives a single version (deleting all versions deletes the integration). `DELETE .../integrations/INTEGRATION_NAME` permanently deletes the integration and all its versions.
384
- **Connector nodes**: Unpublishing or deleting an integration does not delete Integration Connectors connections. Delete unused connections at `https://console.cloud.google.com/connectors/connections` to stop hourly node charges.
385
386
## Reference Guides
387
388
- [Usage Attribution](references/attribution.md): Usage attribution for `gcloud` CLI commands, direct `curl` REST calls, and Python discovery-client snippets run in the terminal.
389
- [REST API Cheatsheet](references/rest-api-cheatsheet.md): v1 and v2 endpoints, parameters, filters, and IAM permissions.
390
- [IntegrationVersion JSON Reference](references/integration-version-json.md): Schema for `triggerConfigs`, `taskConfigs`, `integrationParameters`, `ValueType`, and config variables.
391
- [Triggers and Execution Reference](references/triggers-and-execution.md): Trigger types, `triggerId` formats, `:execute` vs `:schedule`, OpenAPI generation, and lifting or resolving suspensions.
392
- [Tasks and Gotchas Reference](references/tasks-and-gotchas.md): Task-by-task rules, quotas, variable reference syntax, and error handling strategies.
393
- [CI/CD Promotion Reference](references/cicd-promotion.md): Cross-project promotion checklist, environment config pattern, and Cloud Build workflow.
394

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…