examplepb

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2016 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package examplepb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package examplepb is a generated protocol buffer package.

Echo Service

Echo Service API consists of a single service which returns a message.

It is generated from these files:

examples/examplepb/echo_service.proto
examples/examplepb/a_bit_of_everything.proto
examples/examplepb/stream.proto
examples/examplepb/flow_combination.proto

It has these top-level messages:

SimpleMessage
ABitOfEverything
EmptyProto
NonEmptyProto
UnaryProto
NestedProto
SingleNestedProto

Package examplepb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package examplepb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package examplepb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var ABitOfEverything_Nested_DeepEnum_name = map[int32]string{
	0: "FALSE",
	1: "TRUE",
}
View Source
var ABitOfEverything_Nested_DeepEnum_value = map[string]int32{
	"FALSE": 0,
	"TRUE":  1,
}
View Source
var NumericEnum_name = map[int32]string{
	0: "ZERO",
	1: "ONE",
}
View Source
var NumericEnum_value = map[string]int32{
	"ZERO": 0,
	"ONE":  1,
}

Functions

func RegisterABitOfEverythingServiceHandler

func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterABitOfEverythingServiceHandler registers the http handlers for service ABitOfEverythingService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterABitOfEverythingServiceHandlerFromEndpoint

func RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterABitOfEverythingServiceHandlerFromEndpoint is same as RegisterABitOfEverythingServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterABitOfEverythingServiceServer

func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingServiceServer)

func RegisterEchoServiceHandler

func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterEchoServiceHandler registers the http handlers for service EchoService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterEchoServiceHandlerFromEndpoint

func RegisterEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterEchoServiceHandlerFromEndpoint is same as RegisterEchoServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterEchoServiceServer

func RegisterEchoServiceServer(s *grpc.Server, srv EchoServiceServer)

func RegisterFlowCombinationHandler

func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterFlowCombinationHandler registers the http handlers for service FlowCombination to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterFlowCombinationHandlerFromEndpoint

func RegisterFlowCombinationHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterFlowCombinationHandlerFromEndpoint is same as RegisterFlowCombinationHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterFlowCombinationServer

func RegisterFlowCombinationServer(s *grpc.Server, srv FlowCombinationServer)

func RegisterStreamServiceHandler

func RegisterStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterStreamServiceHandler registers the http handlers for service StreamService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterStreamServiceHandlerFromEndpoint

func RegisterStreamServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterStreamServiceHandlerFromEndpoint is same as RegisterStreamServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterStreamServiceServer

func RegisterStreamServiceServer(s *grpc.Server, srv StreamServiceServer)

Types

type ABitOfEverything

type ABitOfEverything struct {
	SingleNested *ABitOfEverything_Nested   `protobuf:"bytes,25,opt,name=single_nested,json=singleNested" json:"single_nested,omitempty"`
	Uuid         string                     `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"`
	Nested       []*ABitOfEverything_Nested `protobuf:"bytes,2,rep,name=nested" json:"nested,omitempty"`
	FloatValue   float32                    `protobuf:"fixed32,3,opt,name=float_value,json=floatValue" json:"float_value,omitempty"`
	DoubleValue  float64                    `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"`
	Int64Value   int64                      `protobuf:"varint,5,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"`
	Uint64Value  uint64                     `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"`
	Int32Value   int32                      `protobuf:"varint,7,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"`
	Fixed64Value uint64                     `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value" json:"fixed64_value,omitempty"`
	Fixed32Value uint32                     `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value" json:"fixed32_value,omitempty"`
	BoolValue    bool                       `protobuf:"varint,10,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"`
	StringValue  string                     `protobuf:"bytes,11,opt,name=string_value,json=stringValue" json:"string_value,omitempty"`
	// TODO(yugui) add bytes_value
	Uint32Value         uint32      `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"`
	EnumValue           NumericEnum `` /* 138-byte string literal not displayed */
	Sfixed32Value       int32       `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"`
	Sfixed64Value       int64       `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"`
	Sint32Value         int32       `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"`
	Sint64Value         int64       `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"`
	RepeatedStringValue []string    `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"`
	// Types that are valid to be assigned to OneofValue:
	//	*ABitOfEverything_OneofEmpty
	//	*ABitOfEverything_OneofString
	OneofValue               isABitOfEverything_OneofValue       `protobuf_oneof:"oneof_value"`
	MapValue                 map[string]NumericEnum              `` /* 209-byte string literal not displayed */
	MappedStringValue        map[string]string                   `` /* 182-byte string literal not displayed */
	MappedNestedValue        map[string]*ABitOfEverything_Nested `` /* 182-byte string literal not displayed */
	NonConventionalNameValue string                              `protobuf:"bytes,26,opt,name=nonConventionalNameValue" json:"nonConventionalNameValue,omitempty"`
}

Intentionaly complicated message type to cover much features of Protobuf. NEXT ID: 27

func (*ABitOfEverything) Descriptor

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

func (*ABitOfEverything) GetMapValue

func (m *ABitOfEverything) GetMapValue() map[string]NumericEnum

func (*ABitOfEverything) GetMappedNestedValue

func (m *ABitOfEverything) GetMappedNestedValue() map[string]*ABitOfEverything_Nested

func (*ABitOfEverything) GetMappedStringValue

func (m *ABitOfEverything) GetMappedStringValue() map[string]string

func (*ABitOfEverything) GetNested

func (m *ABitOfEverything) GetNested() []*ABitOfEverything_Nested

func (*ABitOfEverything) GetOneofEmpty

func (m *ABitOfEverything) GetOneofEmpty() *google_protobuf1.Empty

func (*ABitOfEverything) GetOneofString

func (m *ABitOfEverything) GetOneofString() string

func (*ABitOfEverything) GetOneofValue

func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue

func (*ABitOfEverything) GetSingleNested

func (m *ABitOfEverything) GetSingleNested() *ABitOfEverything_Nested

func (*ABitOfEverything) ProtoMessage

func (*ABitOfEverything) ProtoMessage()

func (*ABitOfEverything) Reset

func (m *ABitOfEverything) Reset()

func (*ABitOfEverything) String

func (m *ABitOfEverything) String() string

func (*ABitOfEverything) XXX_OneofFuncs

func (*ABitOfEverything) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type ABitOfEverything_Nested

type ABitOfEverything_Nested struct {
	// name is nested field.
	Name   string                           `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Amount uint32                           `protobuf:"varint,2,opt,name=amount" json:"amount,omitempty"`
	Ok     ABitOfEverything_Nested_DeepEnum `` /* 127-byte string literal not displayed */
}

Nested is nested type.

func (*ABitOfEverything_Nested) Descriptor

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

func (*ABitOfEverything_Nested) ProtoMessage

func (*ABitOfEverything_Nested) ProtoMessage()

func (*ABitOfEverything_Nested) Reset

func (m *ABitOfEverything_Nested) Reset()

func (*ABitOfEverything_Nested) String

func (m *ABitOfEverything_Nested) String() string

type ABitOfEverything_Nested_DeepEnum

type ABitOfEverything_Nested_DeepEnum int32

DeepEnum is one or zero.

const (
	// FALSE is false.
	ABitOfEverything_Nested_FALSE ABitOfEverything_Nested_DeepEnum = 0
	// TRUE is true.
	ABitOfEverything_Nested_TRUE ABitOfEverything_Nested_DeepEnum = 1
)

func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor

func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int)

func (ABitOfEverything_Nested_DeepEnum) String

type ABitOfEverything_OneofEmpty

type ABitOfEverything_OneofEmpty struct {
	OneofEmpty *google_protobuf1.Empty `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,oneof"`
}

type ABitOfEverything_OneofString

type ABitOfEverything_OneofString struct {
	OneofString string `protobuf:"bytes,21,opt,name=oneof_string,json=oneofString,oneof"`
}

type EchoServiceClient

type EchoServiceClient interface {
	// Echo method receives a simple message and returns it.
	//
	// The message posted as the id parameter will also be
	// returned.
	Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error)
	// EchoBody method receives a simple message and returns it.
	EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error)
}

func NewEchoServiceClient

func NewEchoServiceClient(cc *grpc.ClientConn) EchoServiceClient

type EchoServiceServer

type EchoServiceServer interface {
	// Echo method receives a simple message and returns it.
	//
	// The message posted as the id parameter will also be
	// returned.
	Echo(context.Context, *SimpleMessage) (*SimpleMessage, error)
	// EchoBody method receives a simple message and returns it.
	EchoBody(context.Context, *SimpleMessage) (*SimpleMessage, error)
}

type EmptyProto

type EmptyProto struct {
}

func (*EmptyProto) Descriptor

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

func (*EmptyProto) ProtoMessage

func (*EmptyProto) ProtoMessage()

func (*EmptyProto) Reset

func (m *EmptyProto) Reset()

func (*EmptyProto) String

func (m *EmptyProto) String() string

type FlowCombinationClient

type FlowCombinationClient interface {
	RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error)
	RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error)
	StreamEmptyRpc(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyRpcClient, error)
	StreamEmptyStream(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyStreamClient, error)
	RpcBodyRpc(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (*EmptyProto, error)
	RpcPathSingleNestedRpc(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (*EmptyProto, error)
	RpcPathNestedRpc(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (*EmptyProto, error)
	RpcBodyStream(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcBodyStreamClient, error)
	RpcPathSingleNestedStream(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathSingleNestedStreamClient, error)
	RpcPathNestedStream(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathNestedStreamClient, error)
}

func NewFlowCombinationClient

func NewFlowCombinationClient(cc *grpc.ClientConn) FlowCombinationClient

type FlowCombination_RpcBodyStreamClient

type FlowCombination_RpcBodyStreamClient interface {
	Recv() (*EmptyProto, error)
	grpc.ClientStream
}

type FlowCombination_RpcBodyStreamServer

type FlowCombination_RpcBodyStreamServer interface {
	Send(*EmptyProto) error
	grpc.ServerStream
}

type FlowCombination_RpcEmptyStreamClient

type FlowCombination_RpcEmptyStreamClient interface {
	Recv() (*EmptyProto, error)
	grpc.ClientStream
}

type FlowCombination_RpcEmptyStreamServer

type FlowCombination_RpcEmptyStreamServer interface {
	Send(*EmptyProto) error
	grpc.ServerStream
}

type FlowCombination_RpcPathNestedStreamClient

type FlowCombination_RpcPathNestedStreamClient interface {
	Recv() (*EmptyProto, error)
	grpc.ClientStream
}

type FlowCombination_RpcPathNestedStreamServer

type FlowCombination_RpcPathNestedStreamServer interface {
	Send(*EmptyProto) error
	grpc.ServerStream
}

type FlowCombination_RpcPathSingleNestedStreamClient

type FlowCombination_RpcPathSingleNestedStreamClient interface {
	Recv() (*EmptyProto, error)
	grpc.ClientStream
}

type FlowCombination_RpcPathSingleNestedStreamServer

type FlowCombination_RpcPathSingleNestedStreamServer interface {
	Send(*EmptyProto) error
	grpc.ServerStream
}

type FlowCombination_StreamEmptyRpcClient

type FlowCombination_StreamEmptyRpcClient interface {
	Send(*EmptyProto) error
	CloseAndRecv() (*EmptyProto, error)
	grpc.ClientStream
}

type FlowCombination_StreamEmptyRpcServer

type FlowCombination_StreamEmptyRpcServer interface {
	SendAndClose(*EmptyProto) error
	Recv() (*EmptyProto, error)
	grpc.ServerStream
}

type FlowCombination_StreamEmptyStreamClient

type FlowCombination_StreamEmptyStreamClient interface {
	Send(*EmptyProto) error
	Recv() (*EmptyProto, error)
	grpc.ClientStream
}

type FlowCombination_StreamEmptyStreamServer

type FlowCombination_StreamEmptyStreamServer interface {
	Send(*EmptyProto) error
	Recv() (*EmptyProto, error)
	grpc.ServerStream
}

type NestedProto

type NestedProto struct {
	A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"`
	B string      `protobuf:"bytes,2,opt,name=b" json:"b,omitempty"`
	C string      `protobuf:"bytes,3,opt,name=c" json:"c,omitempty"`
}

func (*NestedProto) Descriptor

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

func (*NestedProto) GetA

func (m *NestedProto) GetA() *UnaryProto

func (*NestedProto) ProtoMessage

func (*NestedProto) ProtoMessage()

func (*NestedProto) Reset

func (m *NestedProto) Reset()

func (*NestedProto) String

func (m *NestedProto) String() string

type NonEmptyProto

type NonEmptyProto struct {
	A string `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"`
	B string `protobuf:"bytes,2,opt,name=b" json:"b,omitempty"`
	C string `protobuf:"bytes,3,opt,name=c" json:"c,omitempty"`
}

func (*NonEmptyProto) Descriptor

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

func (*NonEmptyProto) ProtoMessage

func (*NonEmptyProto) ProtoMessage()

func (*NonEmptyProto) Reset

func (m *NonEmptyProto) Reset()

func (*NonEmptyProto) String

func (m *NonEmptyProto) String() string

type NumericEnum

type NumericEnum int32

NumericEnum is one or zero.

const (
	// ZERO means 0
	NumericEnum_ZERO NumericEnum = 0
	// ONE means 1
	NumericEnum_ONE NumericEnum = 1
)

func (NumericEnum) EnumDescriptor

func (NumericEnum) EnumDescriptor() ([]byte, []int)

func (NumericEnum) String

func (x NumericEnum) String() string

type SimpleMessage

type SimpleMessage struct {
	// Id represents the message identifier.
	Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
}

SimpleMessage represents a simple message sent to the Echo service.

func (*SimpleMessage) Descriptor

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

func (*SimpleMessage) ProtoMessage

func (*SimpleMessage) ProtoMessage()

func (*SimpleMessage) Reset

func (m *SimpleMessage) Reset()

func (*SimpleMessage) String

func (m *SimpleMessage) String() string

type SingleNestedProto

type SingleNestedProto struct {
	A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"`
}

func (*SingleNestedProto) Descriptor

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

func (*SingleNestedProto) GetA

func (m *SingleNestedProto) GetA() *UnaryProto

func (*SingleNestedProto) ProtoMessage

func (*SingleNestedProto) ProtoMessage()

func (*SingleNestedProto) Reset

func (m *SingleNestedProto) Reset()

func (*SingleNestedProto) String

func (m *SingleNestedProto) String() string

type StreamServiceClient

type StreamServiceClient interface {
	BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error)
	List(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (StreamService_ListClient, error)
	BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error)
}

func NewStreamServiceClient

func NewStreamServiceClient(cc *grpc.ClientConn) StreamServiceClient

type StreamService_BulkCreateClient

type StreamService_BulkCreateClient interface {
	Send(*ABitOfEverything) error
	CloseAndRecv() (*google_protobuf1.Empty, error)
	grpc.ClientStream
}

type StreamService_BulkCreateServer

type StreamService_BulkCreateServer interface {
	SendAndClose(*google_protobuf1.Empty) error
	Recv() (*ABitOfEverything, error)
	grpc.ServerStream
}

type StreamService_ListClient

type StreamService_ListClient interface {
	Recv() (*ABitOfEverything, error)
	grpc.ClientStream
}

type StreamService_ListServer

type StreamService_ListServer interface {
	Send(*ABitOfEverything) error
	grpc.ServerStream
}

type UnaryProto

type UnaryProto struct {
	Str string `protobuf:"bytes,1,opt,name=str" json:"str,omitempty"`
}

func (*UnaryProto) Descriptor

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

func (*UnaryProto) ProtoMessage

func (*UnaryProto) ProtoMessage()

func (*UnaryProto) Reset

func (m *UnaryProto) Reset()

func (*UnaryProto) String

func (m *UnaryProto) String() string

Jump to

Keyboard shortcuts

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