api

package
v0.0.0-...-e4d393c Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: MIT Imports: 4 Imported by: 0

README

API

This package contains API artifacts such as protobuf annotations.

Protobuf Usage

  1. Define your gRPC service using protocol buffers

    your_service.proto:

    syntax = "proto3";
    package example;
    message StringMessage {
      string value = 1;
    }
    
    service YourService {
      rpc Echo(StringMessage) returns (StringMessage) {}
    }
    
  2. Add a maestro.api annotation to your .proto file

    your_service.proto:

     syntax = "proto3";
     package example;
    +
    +import "maestro/api/annotations.proto";
    +
     message StringMessage {
       string value = 1;
     }
    
     service YourService {
    +  option (maestro.api.service) = {
    +    host: "127.0.0.1:80"
    +    transport: "http"
    +    codec: "json"
    +  };
    +
    -  rpc Echo(StringMessage) returns (StringMessage) {}
    +  rpc Echo(StringMessage) returns (StringMessage) {
    +    option (maestro.api.http) = {
    +      post: "/v1/example/echo"
    +      body: "*"
    +    };
    +  }
     }
    

    You will need to provide the required third party protobuf files to the protoc compiler. They are included in this repo under the api folder, and we recommend copying them into your protoc generation file structure. If you've structured your protofiles according to something like the Buf style guide, you could copy the files into a top-level ./maestro folder.

    If you do not want to modify the proto file for use with grpc-gateway you can alternatively use an external Service Configuration file. Check our documentation for more information.

  3. Write flow your definitions as usual

Documentation

Index

Constants

This section is empty.

Variables

View Source
var E_Http = &proto.ExtensionDesc{
	ExtendedType:  (*descriptor.MethodOptions)(nil),
	ExtensionType: (*HTTP)(nil),
	Field:         50011,
	Name:          "maestro.api.http",
	Tag:           "bytes,50011,opt,name=http",
	Filename:      "api/annotations.proto",
}
View Source
var E_Service = &proto.ExtensionDesc{
	ExtendedType:  (*descriptor.ServiceOptions)(nil),
	ExtensionType: (*Service)(nil),
	Field:         50012,
	Name:          "maestro.api.service",
	Tag:           "bytes,50012,opt,name=service",
	Filename:      "api/annotations.proto",
}

Functions

This section is empty.

Types

type HTTP

type HTTP struct {
	Endpoint             string   `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	Method               string   `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*HTTP) Descriptor

func (*HTTP) Descriptor() ([]byte, []int)

func (*HTTP) GetEndpoint

func (m *HTTP) GetEndpoint() string

func (*HTTP) GetMethod

func (m *HTTP) GetMethod() string

func (*HTTP) ProtoMessage

func (*HTTP) ProtoMessage()

func (*HTTP) Reset

func (m *HTTP) Reset()

func (*HTTP) String

func (m *HTTP) String() string

func (*HTTP) XXX_DiscardUnknown

func (m *HTTP) XXX_DiscardUnknown()

func (*HTTP) XXX_Marshal

func (m *HTTP) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HTTP) XXX_Merge

func (dst *HTTP) XXX_Merge(src proto.Message)

func (*HTTP) XXX_Size

func (m *HTTP) XXX_Size() int

func (*HTTP) XXX_Unmarshal

func (m *HTTP) XXX_Unmarshal(b []byte) error

type Service

type Service struct {
	Package              string   `protobuf:"bytes,1,opt,name=package,proto3" json:"package,omitempty"`
	Name                 string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Host                 string   `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"`
	Transport            string   `protobuf:"bytes,4,opt,name=transport,proto3" json:"transport,omitempty"`
	Codec                string   `protobuf:"bytes,5,opt,name=codec,proto3" json:"codec,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Service) Descriptor

func (*Service) Descriptor() ([]byte, []int)

func (*Service) GetCodec

func (m *Service) GetCodec() string

func (*Service) GetHost

func (m *Service) GetHost() string

func (*Service) GetName

func (m *Service) GetName() string

func (*Service) GetPackage

func (m *Service) GetPackage() string

func (*Service) GetTransport

func (m *Service) GetTransport() string

func (*Service) ProtoMessage

func (*Service) ProtoMessage()

func (*Service) Reset

func (m *Service) Reset()

func (*Service) String

func (m *Service) String() string

func (*Service) XXX_DiscardUnknown

func (m *Service) XXX_DiscardUnknown()

func (*Service) XXX_Marshal

func (m *Service) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Service) XXX_Merge

func (dst *Service) XXX_Merge(src proto.Message)

func (*Service) XXX_Size

func (m *Service) XXX_Size() int

func (*Service) XXX_Unmarshal

func (m *Service) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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