适用于 Workflows 定义的连接器

定义用于访问 Workflows 定义的内置函数的 Workflows 连接器。

包含此代码示例的文档页面

如需查看代码示例的实际使用场景,请参阅以下文档:

代码示例

YAML

# This workflow demonstrates how to use the Cloud Workflows connector.
# The workflow creates/gets/deletes a workflow.
# Expected successful output: "SUCCESS"

- init:
    assign:
    - project: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
    - location: "us-central1"
    - workflow: "dummy-workflow"
- create_workflow:
    call: googleapis.workflows.v1.projects.locations.workflows.create
    args:
      parent: ${"projects/" + project + "/locations/" + location}
      workflowId: ${workflow}
      body:
        name: ${"projects/" + project + "/locations/" + location + "/workflows/" + workflow}
        description: "A dummy workflow to be created and deleted."
        sourceContents: "- step:\n    next: end"
- get_workflow:
    call: googleapis.workflows.v1.projects.locations.workflows.get
    args:
      name: ${"projects/" + project + "/locations/" + location + "/workflows/" + workflow}
- delete_workflow:
    call: googleapis.workflows.v1.projects.locations.workflows.delete
    args:
      name: ${"projects/" + project + "/locations/" + location + "/workflows/" + workflow}
- the_end:
    return: "SUCCESS"

后续步骤

如需搜索和过滤其他 Google Cloud 产品的代码示例,请参阅 Google Cloud 示例浏览器