编写 Cloud Functions 函数
-
概览
简要介绍如何编写 Cloud Functions 函数。
-
HTTP 函数
通过标准 HTTP 请求调用 Cloud Functions 函数。
-
后台函数
某些 Cloud Functions 运行时(Node.js、Python、Java 和 Go)使用后台函数来处理云基础架构产生的事件,例如 Cloud Pub/Sub 主题中收到消息或 Google Cloud Storage 存储分区发生更改。
-
CloudEvent 函数
其他 Cloud Functions 运行时(例如 Ruby 和 .NET)使用 CloudEvent 函数来处理云基础架构产生的事件,例如 Cloud Pub/Sub 主题中收到消息或 Google Cloud Storage 存储分区发生更改。
-
指定 Node.js 依赖项
了解如何为使用 Node.js 编写的 Cloud Functions 函数指定依赖项。
-
指定 Python 依赖项
了解如何为使用 Python 编写的 Cloud Functions 函数指定依赖项。
-
指定 Go 依赖项
了解如何为使用 Go 编写的 Cloud Functions 函数指定依赖项。
-
指定 Java 依赖项
了解如何为使用 Java 编写的 Cloud Functions 函数指定依赖项。
-
指定 .NET 依赖项
了解如何为使用 .NET 语言编写的 Cloud Functions 函数指定依赖项。
-
指定 Ruby 依赖项
了解如何为使用 Ruby 编写的 Cloud Functions 函数指定依赖项。
-
指定 PHP 依赖项
了解如何为使用 PHP 编写的 Cloud Functions 函数指定依赖项。
部署 Cloud Functions 函数
调用 Cloud Functions 函数
-
概览
简要介绍如何调用 Cloud Functions 函数。
-
HTTP 触发器
使用 HTTP 方法触发 Cloud Functions 函数。
-
Cloud Pub/Sub 触发器
通过 Pub/Sub 主题异步触发 Cloud Functions 函数。
-
Cloud Storage 触发器
触发 Cloud Functions 函数来响应 Google Cloud Storage 发出的更改通知。
-
直接调用 Cloud Functions 函数
了解如何通过 Google Cloud CLI 和 Cloud Console 手动调用 Cloud Functions 函数。
-
Cloud Firestore 触发器
触发 Cloud Functions 函数来响应 Firestore 事件。
-
Google Analytics for Firebase 触发器
触发 Cloud Functions 函数来响应 Google Analytics for Firebase 事件。
-
Firebase Realtime Database 触发器
触发 Cloud Functions 函数来响应 Firebase Realtime Database 事件。
-
Firebase Authentication 触发器
触发 Cloud Functions 函数来响应 Firebase 身份验证事件。
-
使用 Cloud Logging 的第二方触发器
触发 Cloud Functions 函数以响应来自生成 Cloud Logging 审核日志的 Google Cloud Platform 服务的事件。
-
使用 Cloud Scheduler 触发 Cloud Functions 函数
使用 Cloud Scheduler 和 Cloud Pub/Sub 触发器按预定时间调用 Cloud Functions 函数。这样,您就可以将 Cron 作业设置为按特定时间间隔定期运行。
测试 Cloud Functions 函数
-
测试基础知识
了解如何使用 Cloud Functions 创建单元测试、系统测试和集成测试。
-
测试 HTTP 函数
了解如何测试 HTTP Cloud Functions 函数。Cloud Functions 函数可以是 HTTP 函数,也可以是事件驱动函数。
-
测试事件驱动函数
了解如何测试事件驱动型 Cloud Functions 函数。如果您希望间接调用 Cloud Functions 函数来响应事件(例如 Cloud Pub/Sub 主题中收到消息、Cloud Storage 存储分区发生更改或 Firebase 事件),则可以使用事件驱动函数。
-
CI/CD
了解如何配置持续集成和部署 (CI/CD) 流水线,以持续运行 Cloud Functions 函数测试。
Cloud Functions 网络
确保 Cloud Functions 函数的安全
-
通过 IAM 管理访问权限
了解如何使用 IAM 为您的函数提供基于身份的访问权限控制。管理开发者查看、创建、更新和删除函数的能力,并控制是否需要通过身份验证才能调用函数。
-
对开发者、函数和最终用户进行身份验证
了解如何对函数的调用方进行身份验证。
-
函数身份
了解您的函数在运行时使用的身份,如何配置此身份并更改其权限,以及如何获取身份和访问令牌以安全地调用其他函数或 Cloud API。
-
使用 VPC Service Controls
了解如何将 VPC Service Control 与 Cloud Functions 结合使用,从而加强函数的安全性并防止数据渗漏。
-
使用客户管理的加密密钥
了解如何为 Cloud Functions 启用客户管理的加密密钥 (CMEK)。