proto

package
v0.0.0-...-1215b3b Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var GatewayServiceExampleService = registry.Service{
	Name: _ExampleService_serviceDesc.ServiceName,
	Methods: []*registry.Method{
		&registry.Method{
			Name: "ApiCall",
			Bindings: []*registry.Binding{
				&route_ExampleService_ApiCall_0,
				&route_ExampleService_ApiCall_1,
			},
		},

		&registry.Method{
			Name: "Call",
			Bindings: []*registry.Binding{
				&route_ExampleService_Call_0,
				&route_ExampleService_Call_1,
			},
		},
	},
}
View Source
var RegistryServiceExampleService = registry.Service{
	Name: _ExampleService_serviceDesc.ServiceName,
	Methods: []*registry.Method{
		&registry.Method{
			Name: "ApiCall",
		},
		&registry.Method{
			Name: "Call",
		},
	},
}

ExampleService registry service

Functions

func RegisterExampleServiceHandler

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

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

func RegisterExampleServiceHandlerClient

func RegisterExampleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ExampleServiceClient) error

RegisterExampleServiceHandlerClient registers the http handlers for service ExampleService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ExampleServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ExampleServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ExampleServiceClient" to call the correct interceptors.

func RegisterExampleServiceHandlerFromEndpoint

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

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

func RegisterExampleServiceHandlerServer

func RegisterExampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleServiceServer) error

RegisterExampleServiceHandlerServer registers the http handlers for service ExampleService to "mux". UnaryRPC :call ExampleServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterExampleServiceServer

func RegisterExampleServiceServer(s *grpc.Server, srv ExampleServiceServer)

func ServiceDescExampleService

func ServiceDescExampleService() grpc.ServiceDesc

ExampleService desc

Types

type ApiRequest

type ApiRequest struct {
	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Services             string   `protobuf:"bytes,2,opt,name=services,proto3" json:"services,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ApiRequest) Descriptor

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

func (*ApiRequest) GetName

func (m *ApiRequest) GetName() string

func (*ApiRequest) GetServices

func (m *ApiRequest) GetServices() string

func (*ApiRequest) ProtoMessage

func (*ApiRequest) ProtoMessage()

func (*ApiRequest) Reset

func (m *ApiRequest) Reset()

func (*ApiRequest) String

func (m *ApiRequest) String() string

func (*ApiRequest) Validate

func (m *ApiRequest) Validate() error

Validate checks the field values on ApiRequest with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*ApiRequest) XXX_DiscardUnknown

func (m *ApiRequest) XXX_DiscardUnknown()

func (*ApiRequest) XXX_Marshal

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

func (*ApiRequest) XXX_Merge

func (m *ApiRequest) XXX_Merge(src proto.Message)

func (*ApiRequest) XXX_Size

func (m *ApiRequest) XXX_Size() int

func (*ApiRequest) XXX_Unmarshal

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

type ApiRequestValidationError

type ApiRequestValidationError struct {
	// contains filtered or unexported fields
}

ApiRequestValidationError is the validation error returned by ApiRequest.Validate if the designated constraints aren't met.

func (ApiRequestValidationError) Cause

func (e ApiRequestValidationError) Cause() error

Cause function returns cause value.

func (ApiRequestValidationError) Error

Error satisfies the builtin error interface

func (ApiRequestValidationError) ErrorName

func (e ApiRequestValidationError) ErrorName() string

ErrorName returns error name.

func (ApiRequestValidationError) Field

Field function returns field value.

func (ApiRequestValidationError) Key

Key function returns key value.

func (ApiRequestValidationError) Reason

func (e ApiRequestValidationError) Reason() string

Reason function returns reason value.

type ExampleServiceClient

type ExampleServiceClient interface {
	ApiCall(ctx context.Context, in *ApiRequest, opts ...grpc.CallOption) (*Response, error)
	Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

ExampleServiceClient is the client API for ExampleService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewExampleServiceClient

func NewExampleServiceClient(cc *grpc.ClientConn) ExampleServiceClient

type ExampleServiceServer

type ExampleServiceServer interface {
	ApiCall(context.Context, *ApiRequest) (*Response, error)
	Call(context.Context, *Request) (*Response, error)
}

ExampleServiceServer is the server API for ExampleService service.

type Node

type Node struct {
	Id                   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Host                 string   `protobuf:"bytes,2,opt,name=host,proto3" json:"host,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Node) Descriptor

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

func (*Node) GetHost

func (m *Node) GetHost() string

func (*Node) GetId

func (m *Node) GetId() string

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) Reset

func (m *Node) Reset()

func (*Node) String

func (m *Node) String() string

func (*Node) Validate

func (m *Node) Validate() error

Validate checks the field values on Node with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*Node) XXX_DiscardUnknown

func (m *Node) XXX_DiscardUnknown()

func (*Node) XXX_Marshal

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

func (*Node) XXX_Merge

func (m *Node) XXX_Merge(src proto.Message)

func (*Node) XXX_Size

func (m *Node) XXX_Size() int

func (*Node) XXX_Unmarshal

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

type NodeValidationError

type NodeValidationError struct {
	// contains filtered or unexported fields
}

NodeValidationError is the validation error returned by Node.Validate if the designated constraints aren't met.

func (NodeValidationError) Cause

func (e NodeValidationError) Cause() error

Cause function returns cause value.

func (NodeValidationError) Error

func (e NodeValidationError) Error() string

Error satisfies the builtin error interface

func (NodeValidationError) ErrorName

func (e NodeValidationError) ErrorName() string

ErrorName returns error name.

func (NodeValidationError) Field

func (e NodeValidationError) Field() string

Field function returns field value.

func (NodeValidationError) Key

func (e NodeValidationError) Key() bool

Key function returns key value.

func (NodeValidationError) Reason

func (e NodeValidationError) Reason() string

Reason function returns reason value.

type Request

type Request struct {
	Name                 string     `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Version              string     `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	Services             []*Service `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_unrecognized     []byte     `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (*Request) Descriptor

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

func (*Request) GetName

func (m *Request) GetName() string

func (*Request) GetServices

func (m *Request) GetServices() []*Service

func (*Request) GetVersion

func (m *Request) GetVersion() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

func (*Request) Validate

func (m *Request) Validate() error

Validate checks the field values on Request with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*Request) XXX_DiscardUnknown

func (m *Request) XXX_DiscardUnknown()

func (*Request) XXX_Marshal

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

func (*Request) XXX_Merge

func (m *Request) XXX_Merge(src proto.Message)

func (*Request) XXX_Size

func (m *Request) XXX_Size() int

func (*Request) XXX_Unmarshal

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

type RequestValidationError

type RequestValidationError struct {
	// contains filtered or unexported fields
}

RequestValidationError is the validation error returned by Request.Validate if the designated constraints aren't met.

func (RequestValidationError) Cause

func (e RequestValidationError) Cause() error

Cause function returns cause value.

func (RequestValidationError) Error

func (e RequestValidationError) Error() string

Error satisfies the builtin error interface

func (RequestValidationError) ErrorName

func (e RequestValidationError) ErrorName() string

ErrorName returns error name.

func (RequestValidationError) Field

func (e RequestValidationError) Field() string

Field function returns field value.

func (RequestValidationError) Key

func (e RequestValidationError) Key() bool

Key function returns key value.

func (RequestValidationError) Reason

func (e RequestValidationError) Reason() string

Reason function returns reason value.

type Response

type Response struct {
	Msg                  string            `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
	Chain                []*Response_Chain `protobuf:"bytes,2,rep,name=chain,proto3" json:"chain,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*Response) Descriptor

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

func (*Response) GetChain

func (m *Response) GetChain() []*Response_Chain

func (*Response) GetMsg

func (m *Response) GetMsg() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) String

func (m *Response) String() string

func (*Response) Validate

func (m *Response) Validate() error

Validate checks the field values on Response with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*Response) XXX_DiscardUnknown

func (m *Response) XXX_DiscardUnknown()

func (*Response) XXX_Marshal

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

func (*Response) XXX_Merge

func (m *Response) XXX_Merge(src proto.Message)

func (*Response) XXX_Size

func (m *Response) XXX_Size() int

func (*Response) XXX_Unmarshal

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

type ResponseValidationError

type ResponseValidationError struct {
	// contains filtered or unexported fields
}

ResponseValidationError is the validation error returned by Response.Validate if the designated constraints aren't met.

func (ResponseValidationError) Cause

func (e ResponseValidationError) Cause() error

Cause function returns cause value.

func (ResponseValidationError) Error

func (e ResponseValidationError) Error() string

Error satisfies the builtin error interface

func (ResponseValidationError) ErrorName

func (e ResponseValidationError) ErrorName() string

ErrorName returns error name.

func (ResponseValidationError) Field

func (e ResponseValidationError) Field() string

Field function returns field value.

func (ResponseValidationError) Key

func (e ResponseValidationError) Key() bool

Key function returns key value.

func (ResponseValidationError) Reason

func (e ResponseValidationError) Reason() string

Reason function returns reason value.

type Response_Chain

type Response_Chain struct {
	Service              *Service          `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
	Ctx                  string            `protobuf:"bytes,2,opt,name=ctx,proto3" json:"ctx,omitempty"`
	Chain                []*Response_Chain `protobuf:"bytes,3,rep,name=chain,proto3" json:"chain,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*Response_Chain) Descriptor

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

func (*Response_Chain) GetChain

func (m *Response_Chain) GetChain() []*Response_Chain

func (*Response_Chain) GetCtx

func (m *Response_Chain) GetCtx() string

func (*Response_Chain) GetService

func (m *Response_Chain) GetService() *Service

func (*Response_Chain) ProtoMessage

func (*Response_Chain) ProtoMessage()

func (*Response_Chain) Reset

func (m *Response_Chain) Reset()

func (*Response_Chain) String

func (m *Response_Chain) String() string

func (*Response_Chain) Validate

func (m *Response_Chain) Validate() error

Validate checks the field values on Response_Chain with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*Response_Chain) XXX_DiscardUnknown

func (m *Response_Chain) XXX_DiscardUnknown()

func (*Response_Chain) XXX_Marshal

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

func (*Response_Chain) XXX_Merge

func (m *Response_Chain) XXX_Merge(src proto.Message)

func (*Response_Chain) XXX_Size

func (m *Response_Chain) XXX_Size() int

func (*Response_Chain) XXX_Unmarshal

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

type Response_ChainValidationError

type Response_ChainValidationError struct {
	// contains filtered or unexported fields
}

Response_ChainValidationError is the validation error returned by Response_Chain.Validate if the designated constraints aren't met.

func (Response_ChainValidationError) Cause

Cause function returns cause value.

func (Response_ChainValidationError) Error

Error satisfies the builtin error interface

func (Response_ChainValidationError) ErrorName

func (e Response_ChainValidationError) ErrorName() string

ErrorName returns error name.

func (Response_ChainValidationError) Field

Field function returns field value.

func (Response_ChainValidationError) Key

Key function returns key value.

func (Response_ChainValidationError) Reason

Reason function returns reason value.

type Service

type Service struct {
	Name                 string     `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Version              string     `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	Node                 *Node      `protobuf:"bytes,3,opt,name=node,proto3" json:"node,omitempty"`
	Services             []*Service `protobuf:"bytes,4,rep,name=services,proto3" json:"services,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_unrecognized     []byte     `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (*Service) Descriptor

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

func (*Service) GetName

func (m *Service) GetName() string

func (*Service) GetNode

func (m *Service) GetNode() *Node

func (*Service) GetServices

func (m *Service) GetServices() []*Service

func (*Service) GetVersion

func (m *Service) GetVersion() string

func (*Service) ProtoMessage

func (*Service) ProtoMessage()

func (*Service) Reset

func (m *Service) Reset()

func (*Service) String

func (m *Service) String() string

func (*Service) Validate

func (m *Service) Validate() error

Validate checks the field values on Service with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

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 (m *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

type ServiceValidationError

type ServiceValidationError struct {
	// contains filtered or unexported fields
}

ServiceValidationError is the validation error returned by Service.Validate if the designated constraints aren't met.

func (ServiceValidationError) Cause

func (e ServiceValidationError) Cause() error

Cause function returns cause value.

func (ServiceValidationError) Error

func (e ServiceValidationError) Error() string

Error satisfies the builtin error interface

func (ServiceValidationError) ErrorName

func (e ServiceValidationError) ErrorName() string

ErrorName returns error name.

func (ServiceValidationError) Field

func (e ServiceValidationError) Field() string

Field function returns field value.

func (ServiceValidationError) Key

func (e ServiceValidationError) Key() bool

Key function returns key value.

func (ServiceValidationError) Reason

func (e ServiceValidationError) Reason() string

Reason function returns reason value.

type UnimplementedExampleServiceServer

type UnimplementedExampleServiceServer struct {
}

UnimplementedExampleServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedExampleServiceServer) ApiCall

func (*UnimplementedExampleServiceServer) Call

Jump to

Keyboard shortcuts

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