Skip to content

Commit 610fa12

Browse files
Merge pull request #7 from bitovi/sdk-temporal-cloud-api
Using (experimental) Cloud API from Temporal SDK directly
2 parents 31d6750 + 5cec218 commit 610fa12

33 files changed

Lines changed: 3 additions & 3320 deletions

encryption_jwt/README.md

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -140,38 +140,4 @@ Open the Web UI and select a workflow, you'll only see encrypted results. To see
140140
Once those requirements are met you can then see the unencrypted results. This is possible because
141141
CORS settings in the codec server allow the browser to access the codec server directly over
142142
localhost. Decrypted data never leaves your local machine. See [Codec
143-
Server](https://docs.temporal.io/production-deployment/data-encryption)
144-
145-
## Protobuf
146-
147-
> [!WARNING]
148-
> You will not normally need to rebuild protobuf support; the generated files have been committed to
149-
> this repo. The instructions are included because:
150-
> - If the API changes these steps will need to be followed to get those changes
151-
> - A reminder of how to generate the protobuf files for python 😃
152-
153-
To rebuild protobuf support.
154-
155-
1. Install the python [grpc_tools](https://grpc.io/docs/languages/python/quickstart/) for protobufs.
156-
1. Clone the following two repositories (you need to copy files from them, they can be deleted after
157-
setup):
158-
159-
```sh
160-
git clone https://github.com/temporalio/api-cloud.git
161-
git clone https://github.com/googleapis/googleapis.git
162-
```
163-
164-
3. Copy the `temporal` directory and its contents, from `api_cloud` into the root of this **project**.
165-
1. Copy the `google` directory and its contents, from `googleapis` into the root of this
166-
**project**.
167-
1. From the project root generate the python wrappers for each subdirectory of `temporal/api/cloud`
168-
and `google/api` like so:
169-
170-
```sh
171-
python -m grpc_tools.protoc -I./ --python_out=./ --grpc_python_out=./ temporal/api/cloud/cloudservice/v1/*.proto
172-
python -m grpc_tools.protoc -I./ --python_out=./ --grpc_python_out=./ temporal/api/cloud/identity/v1/*.proto
173-
python -m grpc_tools.protoc -I./ --python_out=./ --grpc_python_out=./ temporal/api/cloud/namespace/v1/*.proto
174-
python -m grpc_tools.protoc -I./ --python_out=./ --grpc_python_out=./ temporal/api/cloud/operation/v1/*.proto
175-
python -m grpc_tools.protoc -I./ --python_out=./ --grpc_python_out=./ temporal/api/cloud/region/v1/*.proto
176-
python -m grpc_tools.protoc -I./ --python_out=./ --grpc_python_out=./ google/api/*.proto
177-
```
143+
Server](https://docs.temporal.io/production-deployment/data-encryption)

encryption_jwt/codec_server.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
from aiohttp import hdrs, web
77

88
from temporalio.api.common.v1 import Payload, Payloads
9+
from temporalio.api.cloud.cloudservice.v1 import request_response_pb2, service_pb2_grpc
910
from google.protobuf import json_format
10-
from temporal.api.cloud.cloudservice.v1 import request_response_pb2, service_pb2_grpc
1111
from encryption_jwt.codec import EncryptionCodec
1212

13-
1413
DECRYPT_ROLES = ["admin"]
1514

1615
temporal_ops_address = "saas-api.tmprl.cloud:443"
@@ -76,7 +75,7 @@ async def handler(req: web.Request):
7675
decoded["https://saas-api.tmprl.cloud/user/email"])
7776
if role.lower() in DECRYPT_ROLES:
7877
codec = EncryptionCodec(namespace)
79-
payloads = Payloads(payloads=await codec[fn](payloads.payloads))
78+
payloads = Payloads(payloads=await getattr(codec, fn)(payloads.payloads))
8079

8180
# Apply CORS and return JSON
8281
resp = await cors_options(req)

encryption_jwt/temporal/__init__.py

Whitespace-only changes.

encryption_jwt/temporal/api/__init__.py

Whitespace-only changes.

encryption_jwt/temporal/api/cloud/__init__.py

Whitespace-only changes.

encryption_jwt/temporal/api/cloud/cloudservice/__init__.py

Whitespace-only changes.

encryption_jwt/temporal/api/cloud/cloudservice/v1/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)