How to send parameters to GCP Firestore Workflows?

56 Views Asked by At

I am trying to send parameters to this Google Cloud Platform - Firestore Workflow:

- initialize:
    assign:
      - project: "myproject123"
      - collection: "myEntries"
      - document: "Report"
- read_item:
    try:
      call: http.get
      args:
        url: ${"https://firestore.googleapis.com/v1/projects/"+project+"/databases/(default)/documents/"+collection+"/"+document}
        auth:
          type: OAuth2
      result: document_value
    except:
      as: e
      steps:
        - is_the_key_found:
            switch:
              - condition: ${e.code == 404}
                next: document_not_found
              - condition: ${e.code == 403}
                next: auth_error
    next: document_found
- document_not_found:
    return: "Document not found."
- auth_error:
    return: "Authentication error."
- document_found:
    return: ${document_value.body.fields.LastName.stringValue}

I assume the yaml file should be modified based on this idea:

main:
  params: [args]
  steps:
    - step1:
        assign:
          - outputVar: ${"Hello " + args.firstName + " " + args.lastName}
    - step2:
        return: ${outputVar}

However, if I copy the main, param and step lines into the Firestore Workflow, I am getting this error:

ERROR: (gcloud.workflows.deploy) [INVALID_ARGUMENT] main.yaml:13:7: parse error: in workflow 'main', step 'step1': expected a mapping; got sequence

Thanks for your help.

0

There are 0 best solutions below