2021-08-10 20:12:08 -07:00
|
|
|
## Google Cloud function for reading BigTable
|
|
|
|
|
|
|
|
This is a reference implementaion for getting data out of BigTable.
|
|
|
|
|
2021-09-21 09:08:07 -07:00
|
|
|
### deploying
|
|
|
|
|
|
|
|
First deploy (creation) must include all the flags to configure the environment:
|
|
|
|
|
|
|
|
gcloud functions --project your-project deploy testnet --region europe-west3 --entry-point Entry --runtime go116 --trigger-http --allow-unauthenticated --service-account=your-readonly@your-project.iam.gserviceaccount.com --update-env-vars GCP_PROJECT=your-project,BIGTABLE_INSTANCE=wormhole-testnet
|
|
|
|
|
|
|
|
Subsequent deploys (updates) only need include flags to indentify the resource for updating: project, region, name.
|
|
|
|
|
|
|
|
gcloud functions --project your-project deploy testnet --region europe-west3 --entry-point Entry
|
|
|
|
|
2021-08-10 20:12:08 -07:00
|
|
|
### invocation
|
|
|
|
|
2021-09-21 09:08:07 -07:00
|
|
|
All routes accept their input(s) as query parameters, or request body. Just two different ways of querying:
|
2021-08-10 20:12:08 -07:00
|
|
|
|
|
|
|
GET
|
|
|
|
|
|
|
|
```bash
|
2021-09-21 09:08:07 -07:00
|
|
|
curl "https://region-project-id.cloudfunctions.net/testnet/readrow?emitterChain=2&emitterAddress=000000000000000000000000e982e462b094850f12af94d21d470e21be9d0e9c&sequence=0000000000000006"
|
2021-08-10 20:12:08 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
POST
|
|
|
|
|
|
|
|
```bash
|
2021-09-21 09:08:07 -07:00
|
|
|
curl -X POST https://region-project-id.cloudfunctions.net/testnet/readrow \
|
2021-08-10 20:12:08 -07:00
|
|
|
-H "Content-Type:application/json" \
|
|
|
|
-d \
|
2021-09-21 09:08:07 -07:00
|
|
|
'{"emitterChain":"2", "emitterAddress":"000000000000000000000000e982e462b094850f12af94d21d470e21be9d0e9c", "sequence":"0000000000000006"}'
|
2021-08-10 20:12:08 -07:00
|
|
|
|
|
|
|
```
|
2021-09-21 09:08:07 -07:00
|
|
|
|
|
|
|
See [./bigtable-endpoints.md](./bigtable-endpoints.md) for API patterns
|