列出版本觸發條件

使用用戶端程式庫列出建構觸發程序。

程式碼範例

Node.js

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

async function listBuildTriggers(
  projectId = 'YOUR_PROJECT_ID' // Your Google Cloud Platform project ID
) {
  // Imports the Google Cloud client library
  const {CloudBuildClient} = require('@google-cloud/cloudbuild');

  // Creates a client
  const cb = new CloudBuildClient();

  // What project should we list triggers for?
  const request = {
    projectId,
  };

  const [result] = await cb.listBuildTriggers(request);
  console.info(JSON.stringify(result, null, 2));
}

後續步驟

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