sidekick: a tool to generate and maintain Google Cloud SDKs
sidekick
automates (or will soon automate) most activities around generating
and maintaining SDKs for Google Cloud.
Example Run with Protobuf
You need to have protoc
installed in your path. You can find useful links
below.
This will generate the client library for Secret Manager in the
generator/testdata/rust/openapi/golden
directory. In future releases most
options should be already configured in a .sidekick.toml
file.
cd generator
go run github.com/googleapis/google-cloud-rust/generator/sidekick@latest generate -project-root=.. \
-specification-format protobuf \
-specification-source generator/testdata/googleapis/google/cloud/secretmanager/v1 \
-service-config generator/testdata/googleapis/google/cloud/secretmanager/v1/secretmanager_v1.yaml \
-parser-option googleapis-root=generator/testdata/googleapis \
-language rust \
-output generator/testdata/rust/protobuf/golden/secretmanager \
-codec-option package-name-override=secretmanager-golden-protobuf \
-codec-option package:wkt=package=types,path=types,source=google.protobuf \
-codec-option package:gax=package=gax,path=gax,feature=unstable-sdk-client \
-codec-option package:iam=package=iam-v1-golden-protobuf,path=generator/testdata/rust/protobuf/golden/iam/v1,source=google.iam.v1
Example Run with OpenAPI
This will generate the client library for Secret Manager in the
generator/testdata/rust/openapi/golden
directory. In future releases most
options should be already configured in a .sidekick.toml
file.
cd generator
go run cmd/sidekick/main.go generate -project-root=.. \
-specification-format openapi \
-specification-source generator/testdata/openapi/secretmanager_openapi_v1.json \
-service-config generator/testdata/googleapis/google/cloud/secretmanager/v1/secretmanager_v1.yaml \
-language rust \
-output generator/testdata/rust/openapi/golden \
-codec-option package-name-override=secretmanager-golden-openapi \
-codec-option package:wkt=package=types,path=types,source=google.protobuf \
-codec-option package:gax=package=gax,path=gax,feature=unstable-sdk-client
Prerequisites
Installing protoc
: the Protobuf Compiler
The unit tests use protoc
to parse text .proto
files. You will need this
installed in your $PATH
to run the tests.
You can find numerous guides on how to install the Protobuf Compiler. Here
we suggest two approaches:
-
Follow the instructions in the gRPC Tutorial.
-
The Protobuf team ships easy to install binaries with each release. In the
latest Protobuf release you can find a .zip
file for
your platform. Download and extract such that the bin/
subdirectory is in
your path. For example:
curl -fSSL -o /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip
cd /usr/local
sudo unzip -x /tmp/protoc.zip
Install goimports
go install golang.org/x/tools/cmd/goimports@latest