Bind Integration to Cloud Function
Use the tcb integration bind-resource command to bind an integration to a cloud function, establishing the association between business logic and the integration.
tcb integration bind-resource [options]
Command Parameters
| Parameter | Description | Required |
|---|---|---|
--key-id <keyId> | Integration Key ID | No (either this or --name) |
--name <name> | Integration name | No (either this or --key-id) |
--function <functionName> | Cloud function name to bind | Yes |
--json | Output results in JSON format | No |
--yes | Skip interactive confirmation | No |
Usage Examples
Bind by Key ID
tcb integration bind-resource --key-id key-721a6e232e169382d3cbc5faa3dc2cd6 --function my-function
Bind by Name
tcb integration bind-resource --name my-integration --function my-function
JSON Format Output
tcb integration bind-resource --key-id key-xxx --function my-function --json
Automation Script
In CI/CD pipelines, it is recommended to use the --yes parameter to skip interactive confirmation:
tcb integration bind-resource --key-id key-xxx --function my-function --yes
Output Examples
Standard Output
✓ Cloud function bound successfully
Integration info:
Key ID: key-721a6e232e169382d3cbc5faa3dc2cd6
Name: my-integration
Bound cloud function: my-function
Next steps:
Use 'tcb integration get --key-id key-721a6e232e169382d3cbc5faa3dc2cd6' to view details
Use 'tcb fn invoke my-function' to test the cloud function
JSON Output
{
"RequestId": "abc-123-def-456"
}
How It Works
After binding a cloud function, the integration establishes an association with the specified cloud function:
- Integration config passing: The integration's configuration (such as AppId, AppSecret, etc.) is passed to the cloud function
- Business logic execution: The cloud function can use the integration configuration to execute corresponding business logic
- Permission management: Unified permission management and control is achieved through integration binding
Notes
- Ensure the cloud function is deployed before binding
- One integration can only bind to one cloud function
- Repeated binding will overwrite the previous binding relationship
- After binding, you can view the bound cloud function name in the integration details
Unbind Cloud Function
To unbind a cloud function, you can use the tcb integration update command to update the integration without specifying a cloud function name:
# Currently, CLI does not support direct unbinding; please operate through the console