Skip to content

Commit e50aa65

Browse files
authored
Add Cloud API (#157)
1 parent 7322e8f commit e50aa65

21 files changed

+9916
-30
lines changed

Diff for: .gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "proto/api"]
22
path = proto/api
33
url = https://github.com/temporalio/api
4+
[submodule "proto/api-cloud"]
5+
path = proto/api-cloud
6+
url = https://github.com/temporalio/api-cloud

Diff for: Makefile

+7-10
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ COLOR := "\e[1;36m%s\e[0m\n"
2424
PINNED_DEPENDENCIES := \
2525

2626
PROTO_ROOT := proto/api
27-
PROTO_FILES = $(shell find $(PROTO_ROOT)/temporal -name "*.proto")
28-
PROTO_DIRS = $(sort $(dir $(PROTO_FILES)))
29-
PROTO_ENUMS := $(shell grep -R '^enum ' $(PROTO_ROOT) | cut -d ' ' -f2)
27+
PROTO_CLOUD_ROOT := proto/api-cloud
3028
PROTO_OUT := .
3129
PROTO_IMPORTS = \
3230
-I=$(PROTO_ROOT)
@@ -57,10 +55,10 @@ go-grpc: clean .go-helpers-installed $(PROTO_OUT)
5755
printf $(COLOR) "Compile for go-gRPC..."
5856
go run ./cmd/protogen \
5957
--root=$(PROTO_ROOT) \
58+
--root=$(PROTO_CLOUD_ROOT) \
6059
--output=$(PROTO_OUT) \
6160
--exclude=internal \
6261
--exclude=proto/api/google \
63-
-I $(PROTO_ROOT) \
6462
-p go-grpc_out=$(PROTO_PATHS) \
6563
-p grpc-gateway_out=allow_patch_feature=false,$(PROTO_PATHS) \
6664
-p go-helpers_out=$(PROTO_PATHS)
@@ -80,14 +78,11 @@ copy-helpers:
8078
cp $(PROTO_OUT)/internal/temporalcommonv1/payload_json.go $(PROTO_OUT)/common/v1/
8179
chmod -w $(PROTO_OUT)/common/v1/payload_json.go
8280

83-
# All generated service files pathes relative to PROTO_OUT.
84-
PROTO_GRPC_SERVICES = $(patsubst $(PROTO_OUT)/%,%,$(shell find $(PROTO_OUT) -name "service_grpc.pb.go"))
85-
service_name = $(firstword $(subst /, ,$(1)))
86-
mock_file_name = $(call service_name,$(1))mock/$(subst $(call service_name,$(1))/,,$(1:go=mock.go))
87-
8881
grpc-mock:
8982
printf $(COLOR) "Generate gRPC mocks..."
90-
$(foreach PROTO_GRPC_SERVICE,$(PROTO_GRPC_SERVICES),cd $(PROTO_OUT) && mockgen -package $(call service_name,$(PROTO_GRPC_SERVICE))mock -source $(PROTO_GRPC_SERVICE) -destination $(call mock_file_name,$(PROTO_GRPC_SERVICE))$(NEWLINE) )
83+
mockgen -package operatorservicemock -source operatorservice/v1/service_grpc.pb.go -destination operatorservicemock/v1/service_grpc.pb.mock.go
84+
mockgen -package workflowservicemock -source workflowservice/v1/service_grpc.pb.go -destination workflowservicemock/v1/service_grpc.pb.mock.go
85+
mockgen -package cloudservicemock -source cloud/cloudservice/v1/service_grpc.pb.go -destination cloud/cloudservicemock/v1/service_grpc.pb.mock.go
9186

9287
.PHONY: proxy
9388
proxy:
@@ -146,3 +141,5 @@ clean:
146141
printf $(COLOR) "Deleting generated go files..."
147142
# Delete all directories with *.pb.go and *.mock.go files from $(PROTO_OUT)
148143
find $(PROTO_OUT) \( -name "*.pb.go" -o -name "*.mock.go" -o -name "*.go-helpers.go" \) | xargs -I{} dirname {} | egrep -v 'testprotos' | sort -u | xargs rm -rf
144+
# Delete entire cloud dir
145+
rm -rf cloud

Diff for: README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ _Note that any changes merged to [api](https://github.com/temporalio/api) will a
88

99
To install in your project run:
1010
```
11-
go get -u go.temporal.io/api
11+
go get go.temporal.io/api
1212
```
1313

1414
## Rebuild
1515

1616
Run `make` once to install all plugins and tools (`protoc` and `go` must be installed manually).
1717

18-
Run `make update-proto` to update submodule and recompile proto files.
18+
Run `make update-proto` to update the `proto/api` submodule and recompile proto files. The `proto/api-cloud` submodule
19+
must be updated manually.
1920

2021
## License
2122

0 commit comments

Comments
 (0)