Skip to content

Commit

Permalink
Experimental cloud operations client
Browse files Browse the repository at this point in the history
Fixes #522
  • Loading branch information
cretz committed Jul 3, 2024
1 parent 38d9eef commit 7ab59b5
Show file tree
Hide file tree
Showing 37 changed files with 7,790 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- os: ubuntu-latest
python: "3.12"
docsTarget: true
cloudTestTarget: true
- os: ubuntu-latest
python: "3.8"
protoCheckTarget: true
Expand Down Expand Up @@ -68,6 +69,13 @@ jobs:
# Time skipping doesn't yet support ARM
- if: ${{ !endsWith(matrix.os, '-arm') }}
run: poe test -s -o log_cli_level=DEBUG --workflow-environment time-skipping
# Check cloud if proper target and not on fork
- if: ${{ matrix.cloudCheckTarget && (github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == 'temporalio/sdk-python') }}
run: poe test -s -o log_cli_level=DEBUG -k test_cloud_client
env:
TEMPORAL_CLIENT_CLOUD_API_KEY: ${{ secrets.TEMPORAL_CLIENT_CLOUD_API_KEY }}
TEMPORAL_CLIENT_CLOUD_API_VERSION: 2024-05-13-00
TEMPORAL_CLIENT_CLOUD_NAMESPACE: sdk-ci.a2dd6

# Confirm protos are already generated properly with older protobuf
# library and run test with that older version. We must downgrade protobuf
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1475,8 +1475,8 @@ protobuf code, you must be on Python <= 3.10, and then run `poetry add "protobuf
generated via `poe gen-protos`. Tests can be run for protobuf version 3 by setting the `TEMPORAL_TEST_PROTO3` env var
to `1` prior to running tests.

Do not commit `poetry.lock` or `pyproject.toml` changes. To go back from this downgrade, restore `pyproject.toml` and
run `poetry update protobuf grpcio-tools`.
Do not commit `poetry.lock` or `pyproject.toml` changes. To go back from this downgrade, restore both of those files
and run `poetry install --no-root --all extras`.

For a less system-intrusive approach, you can (note this approach [may have a bug](https://github.com/temporalio/sdk-python/issues/543)):
```shell
Expand Down
2 changes: 2 additions & 0 deletions scripts/gen_protos.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
base_dir / "temporalio" / "bridge" / "sdk-core" / "sdk-core-protos" / "protos"
)
api_proto_dir = proto_dir / "api_upstream"
api_cloud_proto_dir = proto_dir / "api_cloud_upstream"
core_proto_dir = proto_dir / "local"
testsrv_proto_dir = proto_dir / "testsrv_upstream"
test_proto_dir = base_dir / "tests"
Expand Down Expand Up @@ -155,6 +156,7 @@ def generate_protos(output_dir: Path):
sys.executable,
"-mgrpc_tools.protoc",
f"--proto_path={api_proto_dir}",
f"--proto_path={api_cloud_proto_dir}",
f"--proto_path={core_proto_dir}",
f"--proto_path={testsrv_proto_dir}",
f"--proto_path={health_proto_dir}",
Expand Down
Empty file.
Empty file.
157 changes: 157 additions & 0 deletions temporalio/api/cloud/cloudservice/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
from .request_response_pb2 import (
AddNamespaceRegionRequest,
AddNamespaceRegionResponse,
CreateApiKeyRequest,
CreateApiKeyResponse,
CreateNamespaceRequest,
CreateNamespaceResponse,
CreateServiceAccountRequest,
CreateServiceAccountResponse,
CreateUserGroupRequest,
CreateUserGroupResponse,
CreateUserRequest,
CreateUserResponse,
DeleteApiKeyRequest,
DeleteApiKeyResponse,
DeleteNamespaceRequest,
DeleteNamespaceResponse,
DeleteServiceAccountRequest,
DeleteServiceAccountResponse,
DeleteUserGroupRequest,
DeleteUserGroupResponse,
DeleteUserRequest,
DeleteUserResponse,
FailoverNamespaceRegionRequest,
FailoverNamespaceRegionResponse,
GetApiKeyRequest,
GetApiKeyResponse,
GetApiKeysRequest,
GetApiKeysResponse,
GetAsyncOperationRequest,
GetAsyncOperationResponse,
GetNamespaceRequest,
GetNamespaceResponse,
GetNamespacesRequest,
GetNamespacesResponse,
GetRegionRequest,
GetRegionResponse,
GetRegionsRequest,
GetRegionsResponse,
GetServiceAccountRequest,
GetServiceAccountResponse,
GetServiceAccountsRequest,
GetServiceAccountsResponse,
GetUserGroupRequest,
GetUserGroupResponse,
GetUserGroupsRequest,
GetUserGroupsResponse,
GetUserRequest,
GetUserResponse,
GetUsersRequest,
GetUsersResponse,
RenameCustomSearchAttributeRequest,
RenameCustomSearchAttributeResponse,
SetUserGroupNamespaceAccessRequest,
SetUserGroupNamespaceAccessResponse,
SetUserNamespaceAccessRequest,
SetUserNamespaceAccessResponse,
UpdateApiKeyRequest,
UpdateApiKeyResponse,
UpdateNamespaceRequest,
UpdateNamespaceResponse,
UpdateServiceAccountRequest,
UpdateServiceAccountResponse,
UpdateUserGroupRequest,
UpdateUserGroupResponse,
UpdateUserRequest,
UpdateUserResponse,
)

__all__ = [
"AddNamespaceRegionRequest",
"AddNamespaceRegionResponse",
"CreateApiKeyRequest",
"CreateApiKeyResponse",
"CreateNamespaceRequest",
"CreateNamespaceResponse",
"CreateServiceAccountRequest",
"CreateServiceAccountResponse",
"CreateUserGroupRequest",
"CreateUserGroupResponse",
"CreateUserRequest",
"CreateUserResponse",
"DeleteApiKeyRequest",
"DeleteApiKeyResponse",
"DeleteNamespaceRequest",
"DeleteNamespaceResponse",
"DeleteServiceAccountRequest",
"DeleteServiceAccountResponse",
"DeleteUserGroupRequest",
"DeleteUserGroupResponse",
"DeleteUserRequest",
"DeleteUserResponse",
"FailoverNamespaceRegionRequest",
"FailoverNamespaceRegionResponse",
"GetApiKeyRequest",
"GetApiKeyResponse",
"GetApiKeysRequest",
"GetApiKeysResponse",
"GetAsyncOperationRequest",
"GetAsyncOperationResponse",
"GetNamespaceRequest",
"GetNamespaceResponse",
"GetNamespacesRequest",
"GetNamespacesResponse",
"GetRegionRequest",
"GetRegionResponse",
"GetRegionsRequest",
"GetRegionsResponse",
"GetServiceAccountRequest",
"GetServiceAccountResponse",
"GetServiceAccountsRequest",
"GetServiceAccountsResponse",
"GetUserGroupRequest",
"GetUserGroupResponse",
"GetUserGroupsRequest",
"GetUserGroupsResponse",
"GetUserRequest",
"GetUserResponse",
"GetUsersRequest",
"GetUsersResponse",
"RenameCustomSearchAttributeRequest",
"RenameCustomSearchAttributeResponse",
"SetUserGroupNamespaceAccessRequest",
"SetUserGroupNamespaceAccessResponse",
"SetUserNamespaceAccessRequest",
"SetUserNamespaceAccessResponse",
"UpdateApiKeyRequest",
"UpdateApiKeyResponse",
"UpdateNamespaceRequest",
"UpdateNamespaceResponse",
"UpdateServiceAccountRequest",
"UpdateServiceAccountResponse",
"UpdateUserGroupRequest",
"UpdateUserGroupResponse",
"UpdateUserRequest",
"UpdateUserResponse",
]

# gRPC is optional
try:
import grpc

from .service_pb2_grpc import (
CloudServiceServicer,
CloudServiceStub,
add_CloudServiceServicer_to_server,
)

__all__.extend(
[
"CloudServiceServicer",
"CloudServiceStub",
"add_CloudServiceServicer_to_server",
]
)
except ImportError:
pass
Loading

0 comments on commit 7ab59b5

Please sign in to comment.