Skip to content

Using gRPC Proto

You can use the render apiproxy command to create an Apigee API proxy bundle using a template and a gRPC proto file as input.

When working with gRPC in Apigee, it's crucial to ensure your API proxy's base path and conditional flows are configured correctly to handle gRPC traffic. This command simplifies the process by letting you build a template that understands these gRPC-specific requirements.

How it works

  • Start with Your Template

    Input your gRPC proto file, and the template generates the intermediate YAML configuration.

  • Automate the Details

    The template handles the intricacies of gRPC integration within your API proxy.

  • Access the Proto

    Use --set-grpc to access the gRPC proto text and descriptor during template rendering.

  • Inject Your Values

    Use --set and --set-string to provide missing values (like target server) for your template.

Example

Check out the examples/templates/grpc directory for an example of building the intermediate YAML for a gRPC API proxy.

Here is how you would use the render apiproxy command with this example:

Create bundle zip

apigee-go-gen render apiproxy \
    --template ./examples/templates/grpc/apiproxy.yaml \
    --set-grpc proto=./examples/protos/greeter.proto \
    --set-string "target_server=example-target-server" \
    --include ./examples/templates/grpc/*.tmpl \
    --output ./out/apiproxies/greeter.zip

Create bundle dir

apigee-go-gen render apiproxy \
    --template ./examples/templates/grpc/apiproxy.yaml \
    --set-grpc proto=./examples/protos/greeter.proto \
    --set-string "target_server=example-target-server" \
    --include ./examples/templates/grpc/*.tmpl \
    --output ./out/apiproxies/greeter