Hello World Cloud 函式

這個簡單的 Cloud 函式會在記錄檔中輸出「Hello, stdout!」。

程式碼範例

Python

如要驗證 Cloud Run 函式,請設定應用程式預設憑證。 詳情請參閱「為本機開發環境設定驗證機制」。

import functions_framework


@functions_framework.cloud_event
def hello_world(event):
    """Cloud Event Function.
    Args:
        event: Cloud event for the function trigger
    """
    print("Hello, stdout!")

後續步驟

如要搜尋及篩選其他 Google Cloud 產品的程式碼範例,請參閱 Google Cloud 範例瀏覽器