列出构建触发器

使用客户端库列出构建触发器。

代码示例

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 示例浏览器