トリガー追加
    • PDF

    トリガー追加

    • PDF

    記事の要約

    Classic/VPC環境で利用できます。

    アクションを実行するトリガーを追加する方法を理解するのに役立つユースケースを紹介します。このユースケースは、ユーザーの位置を更新するトリガーを作成し、ユーザーの位置が更新されたときに helloアクションを呼び出す内容です。ユースケース学習の際は、以下のガイドをご参考ください。

    • アクション作成方法
      • Cloud Functions を使用する > Action > アクション作成

    アクション作成

    1. 名前と場所を受け取り、出力するソースコードを作成します。
    function main(params) {
        return {payload:  'Hello, ' + params.name + ' from ' + params.place};
    }
    
    1. 1.で作成したソースコードを使用し、コンソールでアクションを作成します。
      cloudfunctions-example04_v2_01_ko

    トリガー追加

    アクションを実行するトリガーを追加する手順は、次の通りです。

    1. コンソールで作成した helloActionという名前のアクションを選択し、詳細情報に移動します。
      cloudfunctions-example04_v2_02_ko
    2. トリガー項目の [追加] ボタンをクリックします。
    3. 関連付け方法として 新規作成 を選択し、タイプとして API Gateway を選択します。
      cloudfunctions-example04_v2_03_ko
    4. API Gatewayを介してアクションを呼び出す API Gatewayのエンドポイントを作成するための設定を行います。
      cloudfunctions-example04_v2_04_ko

    実行結果確認

    トリガーを実行し、アクションが正常に実行されたか確認できます。確認する手順は次の通りです。

    1. API Gatewayエンドポイントを呼び出してアクションを実行します。詳しい実行方法は、API Gatewayトリガーのトリガー実行をご参照ください。
    curl -X POST -H "Content-Type: application/json" https://func.apigw.ntruss.com/api/v1/hello?blocking=true&result=true -d '{"name": "Cloud Functions", "place": "NAVER Cloud"}'
    
    1. アクション詳細情報の モニタリング タブのメニュー画面で、実行結果の詳細情報を確認します。最も最近発生したアクティベーション情報を確認してアクションの実行有無を確認し、トリガーにより実行されたアクションがパラメータを正常に処理するか確認します。
      cloudfunctions-example04_v2_05_ko

    この記事は役に立ちましたか?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.