The Workflows connector defines the built-in
functions that can be used to access other Google Cloud products within a
workflow.

This page provides an overview of the individual connector.
There is no need to import or load connector libraries in a workflow---connectors
work out of the box when used in a call step.

## Cloud Firestore API

Accesses the NoSQL document database built for automatic scaling, high performance, and ease of application development.
To learn more, see the [Cloud Firestore API documentation](https://cloud.google.com/firestore).

The Firestore connector allows you to connect to the Firestore APIs from within
a workflow.

The Firestore connector only supports databases created in Native mode.
Operations will fail if used on a database in Datastore mode.
To learn more about the difference between the two,
see [Choosing between Native mode and Datastore mode](https://docs.cloud.google.com/firestore/docs/firestore-or-datastore).

> [!WARNING]
> **Warning:** Once you select Firestore in Datastore mode and write to the database, you cannot switch to Native mode. Once you select Firestore in Native mode, you cannot switch to Datastore mode. If you require a mode change in this situation, reach out to [Firestore support](https://docs.cloud.google.com/firestore/docs/getting-support).

## Cloud Firestore connector sample

### YAML

    # This workflow demonstrates how to use the Firestore connector:
    # Create and retrieve a Firestore document
    # Export the document to a Cloud Storage bucket (which must already exist)
    # Delete the document
    # Expected output: "SUCCESS"
    - init:
        assign:
          - project_id: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
          - collection: "example-collection"
          - document: "example-document"
    - create_document:
        call: googleapis.firestore.v1.projects.databases.documents.createDocument
        args:
          collectionId: ${collection}
          parent: ${"projects/" + project_id + "/databases/(default)/documents"}
          query:
            documentId: ${document}
          body:
            fields:
              fieldA:
                stringValue: abc
              fieldB:
                integerValue: 123
    - get_document:
        call: googleapis.firestore.v1.projects.databases.documents.get
        args:
          name: ${"projects/" + project_id + "/databases/(default)/documents/" + collection + "/" + document}
        result: got
    - check:
        switch:
          - condition: ${got.fields.fieldA.stringValue == "abc" AND int(got.fields.fieldB.integerValue) == 123}
            next: export
    - failed:
        raise: ${"got unexpected document" + "fieldA:" + got.fields.fieldA.stringValue + " fieldB:" + string(got.fields.fieldB.integerValue)}
    - export:
        call: googleapis.firestore.v1.projects.databases.exportDocuments
        args:
          name: ${"projects/" + project_id + "/databases/(default)"}
          body:
            outputUriPrefix: "gs://EXAMPLE_BUCKET"  # replace EXAMPLE_BUCKET placeholder with existing bucket
            collectionIds:
              - ${collection}
    - drop:
        call: googleapis.firestore.v1.projects.databases.documents.delete
        args:
          name: ${"projects/" + project_id + "/databases/(default)/documents/" + collection + "/" + document}
    - the_end:
        return: "SUCCESS"

### JSON

    [
      {
        "init": {
          "assign": [
            {
              "project_id": "${sys.get_env(\"GOOGLE_CLOUD_PROJECT_ID\")}"
            },
            {
              "collection": "example-collection"
            },
            {
              "document": "example-document"
            }
          ]
        }
      },
      {
        "create_document": {
          "call": "googleapis.firestore.v1.projects.databases.documents.createDocument",
          "args": {
            "collectionId": "${collection}",
            "parent": "${\"projects/\" + project_id + \"/databases/(default)/documents\"}",
            "query": {
              "documentId": "${document}"
            },
            "body": {
              "fields": {
                "fieldA": {
                  "stringValue": "abc"
                },
                "fieldB": {
                  "integerValue": 123
                }
              }
            }
          }
        }
      },
      {
        "get_document": {
          "call": "googleapis.firestore.v1.projects.databases.documents.get",
          "args": {
            "name": "${\"projects/\" + project_id + \"/databases/(default)/documents/\" + collection + \"/\" + document}"
          },
          "result": "got"
        }
      },
      {
        "check": {
          "switch": [
            {
              "condition": "${got.fields.fieldA.stringValue == \"abc\" AND int(got.fields.fieldB.integerValue) == 123}",
              "next": "export"
            }
          ]
        }
      },
      {
        "failed": {
          "raise": "${\"got unexpected document\" + \"fieldA:\" + got.fields.fieldA.stringValue + \" fieldB:\" + string(got.fields.fieldB.integerValue)}"
        }
      },
      {
        "export": {
          "call": "googleapis.firestore.v1.projects.databases.exportDocuments",
          "args": {
            "name": "${\"projects/\" + project_id + \"/databases/(default)\"}",
            "body": {
              "outputUriPrefix": "gs://EXAMPLE_BUCKET",
              "collectionIds": [
                "${collection}"
              ]
            }
          }
        }
      },
      {
        "drop": {
          "call": "googleapis.firestore.v1.projects.databases.documents.delete",
          "args": {
            "name": "${\"projects/\" + project_id + \"/databases/(default)/documents/\" + collection + \"/\" + document}"
          }
        }
      },
      {
        "the_end": {
          "return": "SUCCESS"
        }
      }
    ]

## Module: googleapis.firestore.v1.projects.databases

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases/exportDocuments` | Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage system, such as Google Cloud Storage. Recent updates to documents may not be reflected in the export. The export occurs in the background and its progress can be monitored and managed via the Operation resource that is created. The output of an export may only be used once the associated operation is done. If an export operation is cancelled before completion it may leave partial data behind in Google Cloud Storage. For more details on export behavior and output format, refer to: https://cloud.google.com/firestore/docs/manage-data/export-import |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases/importDocuments` | Imports documents into Google Cloud Firestore. Existing documents with the same name are overwritten. The import occurs in the background and its progress can be monitored and managed via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is possible that a subset of the data has already been imported to Cloud Firestore. |

## Module: googleapis.firestore.v1.projects.databases.collectionGroups.fields

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.collectionGroups.fields/get` | Gets the metadata and configuration for a Field. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.collectionGroups.fields/list` | Lists the field configuration and metadata for this database. Currently, FirestoreAdmin.ListFields only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with the filter set to `indexConfig.usesAncestorConfig:false` . |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.collectionGroups.fields/patch` | Updates a field configuration. Currently, field updates apply only to single field index configuration. However, calls to FirestoreAdmin.UpdateField should provide a field mask to avoid changing any configuration that the caller isn't aware of. The field mask should be specified as: `{ paths: "index_config" }`. This call returns a google.longrunning.Operation which may be used to track the status of the field update. The metadata for the operation will be the type FieldOperationMetadata. To configure the default field settings for the database, use the special `Field` with resource name: `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. |

## Module: googleapis.firestore.v1.projects.databases.collectionGroups.indexes

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.collectionGroups.indexes/create` | Creates a composite index. This returns a google.longrunning.Operation which may be used to track the status of the creation. The metadata for the operation will be the type IndexOperationMetadata. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.collectionGroups.indexes/delete` | Deletes a composite index. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.collectionGroups.indexes/get` | Gets a composite index. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.collectionGroups.indexes/list` | Lists composite indexes. |

## Module: googleapis.firestore.v1.projects.databases.documents

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/batchGet` | Gets multiple documents. Documents returned by this method are not guaranteed to be returned in the same order that they were requested. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/batchWrite` | Applies a batch of write operations. The BatchWrite method does not apply the write operations atomically and can apply them out of order. Method does not allow more than one write per document. Each write succeeds or fails independently. See the BatchWriteResponse for the success status of each write. If you require an atomically applied set of writes, use Commit instead. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/beginTransaction` | Starts a new transaction. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/commit` | Commits a transaction, while optionally updating documents. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/createDocument` | Creates a new document. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/delete` | Deletes a document. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/get` | Gets a single document. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/list` | Lists documents. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/listCollectionIds` | Lists all the collection IDs underneath a document. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/partitionQuery` | Partitions a query by returning partition cursors that can be used to run the query in parallel. The returned partition cursors are split points that can be used by RunQuery as starting/end points for the query results. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/patch` | Updates or inserts a document. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/rollback` | Rolls back a transaction. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.documents/runQuery` | Runs a query. |

## Module: googleapis.firestore.v1.projects.databases.operations

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.operations/cancel` | Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.operations/delete` | Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.operations/get` | Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.databases.operations/list` | Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id. |

## Module: googleapis.firestore.v1.projects.locations

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.locations/get` | Gets information about a location. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1/projects.locations/list` | Lists information about the supported locations for this service. |

## Module: googleapis.firestore.v1beta1.projects.databases

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases/exportDocuments` | Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage system, such as Google Cloud Storage. Recent updates to documents may not be reflected in the export. The export occurs in the background and its progress can be monitored and managed via the Operation resource that is created. The output of an export may only be used once the associated operation is done. If an export operation is cancelled before completion it may leave partial data behind in Google Cloud Storage. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases/importDocuments` | Imports documents into Google Cloud Firestore. Existing documents with the same name are overwritten. The import occurs in the background and its progress can be monitored and managed via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is possible that a subset of the data has already been imported to Cloud Firestore. |

## Module: googleapis.firestore.v1beta1.projects.databases.documents

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/batchGet` | Gets multiple documents. Documents returned by this method are not guaranteed to be returned in the same order that they were requested. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/batchWrite` | Applies a batch of write operations. The BatchWrite method does not apply the write operations atomically and can apply them out of order. Method does not allow more than one write per document. Each write succeeds or fails independently. See the BatchWriteResponse for the success status of each write. If you require an atomically applied set of writes, use Commit instead. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/beginTransaction` | Starts a new transaction. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/commit` | Commits a transaction, while optionally updating documents. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/createDocument` | Creates a new document. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/delete` | Deletes a document. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/get` | Gets a single document. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/list` | Lists documents. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/listCollectionIds` | Lists all the collection IDs underneath a document. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/partitionQuery` | Partitions a query by returning partition cursors that can be used to run the query in parallel. The returned partition cursors are split points that can be used by RunQuery as starting/end points for the query results. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/patch` | Updates or inserts a document. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/rollback` | Rolls back a transaction. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.documents/runQuery` | Runs a query. |

## Module: googleapis.firestore.v1beta1.projects.databases.indexes

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.indexes/create` | Creates the specified index. A newly created index's initial state is `CREATING`. On completion of the returned google.longrunning.Operation, the state will be `READY`. If the index already exists, the call will return an `ALREADY_EXISTS` status. During creation, the process could result in an error, in which case the index will move to the `ERROR` state. The process can be recovered by fixing the data that caused the error, removing the index with delete, then re-creating the index with create. Indexes with a single field cannot be created. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.indexes/delete` | Deletes an index. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.indexes/get` | Gets an index. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta1/projects.databases.indexes/list` | Lists the indexes that match the specified filters. |

## Module: googleapis.firestore.v1beta2.projects.databases

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta2/projects.databases/exportDocuments` | Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage system, such as Google Cloud Storage. Recent updates to documents may not be reflected in the export. The export occurs in the background and its progress can be monitored and managed via the Operation resource that is created. The output of an export may only be used once the associated operation is done. If an export operation is cancelled before completion it may leave partial data behind in Google Cloud Storage. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta2/projects.databases/importDocuments` | Imports documents into Google Cloud Firestore. Existing documents with the same name are overwritten. The import occurs in the background and its progress can be monitored and managed via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is possible that a subset of the data has already been imported to Cloud Firestore. |

## Module: googleapis.firestore.v1beta2.projects.databases.collectionGroups.fields

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta2/projects.databases.collectionGroups.fields/get` | Gets the metadata and configuration for a Field. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta2/projects.databases.collectionGroups.fields/list` | Lists the field configuration and metadata for this database. Currently, FirestoreAdmin.ListFields only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with the filter set to `indexConfig.usesAncestorConfig:false`. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta2/projects.databases.collectionGroups.fields/patch` | Updates a field configuration. Currently, field updates apply only to single field index configuration. However, calls to FirestoreAdmin.UpdateField should provide a field mask to avoid changing any configuration that the caller isn't aware of. The field mask should be specified as: `{ paths: "index_config" }`. This call returns a google.longrunning.Operation which may be used to track the status of the field update. The metadata for the operation will be the type FieldOperationMetadata. To configure the default field settings for the database, use the special `Field` with resource name: `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. |

## Module: googleapis.firestore.v1beta2.projects.databases.collectionGroups.indexes

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta2/projects.databases.collectionGroups.indexes/create` | Creates a composite index. This returns a google.longrunning.Operation which may be used to track the status of the creation. The metadata for the operation will be the type IndexOperationMetadata. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta2/projects.databases.collectionGroups.indexes/delete` | Deletes a composite index. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta2/projects.databases.collectionGroups.indexes/get` | Gets a composite index. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/firestore/v1beta2/projects.databases.collectionGroups.indexes/list` | Lists composite indexes. |