Conditional jump to a specific step

Jumps to a specific step depending on the value returned by the first step of the workflow.

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample

YAML

- first_step:
    call: http.get
    args:
      url: https://www.example.com/callA
    result: first_result
- where_to_jump:
    switch:
      - condition: ${first_result.body.SomeField < 10}
        next: small
      - condition: ${first_result.body.SomeField < 100}
        next: medium
    next: large
- small:
    call: http.get
    args:
      url: https://www.example.com/SmallFunc
    next: end
- medium:
    call: http.get
    args:
      url: https://www.example.com/MediumFunc
    next: end
- large:
    call: http.get
    args:
      url: https://www.example.com/LargeFunc
    next: end

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.