protoc-gen-cloud-proxy

command module
v0.0.0-...-ac2c546 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

README

protoc-gen-cloud-proxy

License Apache 2

The ☁ gRPC Proxy is an experimental project to code generate a proxy from Protobuf that enables you to use ☁ services like AWS Lambda, Amazon DynamoDB) and more via gRPC. It combines the design by contract approach with the ease of the :cloud.

⚠ the API of the project is not yet stable. ⚠ this is yet focused on AWS services

Getting Started

You provide your service definitions in Protobuf.

syntax = "proto3";

package proto;

import "google/protobuf/timestamp.proto";
import "api/annotations.proto";

// Example ...
service Example {
  // Insert ...
  rpc Insert(Insert.Request) returns (Insert.Response) {
    option (amazon.api.methods).lambda = {
      function_name: "arn:aws:lambda:us-east-2:123456789012:function:my-function:1"
    };
  };

  // Update ...
  rpc Update(Update.Request) returns (Update.Response) {
    option (amazon.api.methods).dynamodb.UpdateItem = {
      TableName: "aws-grpc-service-proxy"
      ReturnValues: "ALL_NEW"
      UpdateExpression: "SET #Y = :y, #AT = :t"
      ExpressionAttributeNames: [
        { key: "key", value: "value" }
      ]
    };
  };
}

// Item ...
message Item {
 // UUID ...
  string uuid   = 1;
  // Title ...
  string title  = 2;
  // Body ...
  string body   = 3;
}

// Insert ...
message Insert {
  // Request ...
  message Request {
    Item item = 1;
  }
  // Response ...
  message Response {
    string uuid = 1;
  }
}

// Update ...
message Update {
  // Request ...
  message Request {
    Item item = 1;
  }
  // Response ...
  message Response {
    string uuid = 1;
  }
}

The included plugin generates a fully functioning proxy from the Protobuf. The current code is generated in the Go programming language, but there is room for other languages.

If you want to compile the full example/example.proto you have to run the following command.

go build -o bin/protoc-gen-aws-service-proxy main.go && protoc --go_out=plugins=grpc:. --go_opt=paths=source_relative --aws-service-proxy_out=. --plugin=bin/protoc-gen-aws-service-proxy -I ./ example/example.proto

Install

go get -u github.com/katallaxie/protoc-gen-cloud-proxy

Future

There are several services waiting to be get supported

  • AWS Lambda
  • Amazon DynamoDB
  • Amazon SQS
  • Amazon SNS
  • Amazon MSK

License

Apache 2.0

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
internal
gen
packages
pkg
gen
plugins

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL