httpapi

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Method_name = map[int32]string{
		0: "UNKNOWN",
		1: "GET",
		2: "HEAD",
		3: "POST",
		4: "PUT",
		5: "DELETE",
		6: "CONNECT",
		7: "OPTIONS",
		8: "TRACE",
		9: "PATCH",
	}
	Method_value = map[string]int32{
		"UNKNOWN": 0,
		"GET":     1,
		"HEAD":    2,
		"POST":    3,
		"PUT":     4,
		"DELETE":  5,
		"CONNECT": 6,
		"OPTIONS": 7,
		"TRACE":   8,
		"PATCH":   9,
	}
)

Enum value maps for Method.

View Source
var File_proxy_proto protoreflect.FileDescriptor

Functions

func RegisterExposedServiceServer

func RegisterExposedServiceServer(s *grpc.Server, srv ExposedServiceServer)

Types

type ExposedServiceClient

type ExposedServiceClient interface {
	// ProxyUnary sends a message to the GRPC API expecting an immediate single response
	ProxyUnary(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// ProxyStream handles streamed requests and responses from websockets
	ProxyStream(ctx context.Context, opts ...grpc.CallOption) (ExposedService_ProxyStreamClient, error)
}

ExposedServiceClient is the client API for ExposedService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type ExposedServiceServer

type ExposedServiceServer interface {
	// ProxyUnary sends a message to the GRPC API expecting an immediate single response
	ProxyUnary(context.Context, *Request) (*Response, error)
	// ProxyStream handles streamed requests and responses from websockets
	ProxyStream(ExposedService_ProxyStreamServer) error
	// contains filtered or unexported methods
}

ExposedServiceServer is the server API for ExposedService service. All implementations must embed UnimplementedExposedServiceServer for forward compatibility

type ExposedService_ProxyStreamClient added in v0.6.0

type ExposedService_ProxyStreamClient interface {
	Send(*StreamedRequest) error
	Recv() (*StreamedResponse, error)
	grpc.ClientStream
}

type ExposedService_ProxyStreamServer added in v0.6.0

type ExposedService_ProxyStreamServer interface {
	Send(*StreamedResponse) error
	Recv() (*StreamedRequest, error)
	grpc.ServerStream
}

type Method

type Method int32

All valid HTTP method names

const (
	Method_UNKNOWN Method = 0
	Method_GET     Method = 1
	Method_HEAD    Method = 2
	Method_POST    Method = 3
	Method_PUT     Method = 4
	Method_DELETE  Method = 5
	Method_CONNECT Method = 6
	Method_OPTIONS Method = 7
	Method_TRACE   Method = 8
	Method_PATCH   Method = 9
)

func (Method) Descriptor added in v0.5.1

func (Method) Descriptor() protoreflect.EnumDescriptor

func (Method) Enum added in v0.5.1

func (x Method) Enum() *Method

func (Method) EnumDescriptor deprecated

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

Deprecated: Use Method.Descriptor instead.

func (Method) Number added in v0.5.1

func (x Method) Number() protoreflect.EnumNumber

func (Method) String

func (x Method) String() string

func (Method) Type added in v0.5.1

func (Method) Type() protoreflect.EnumType

type MultiVal

type MultiVal struct {
	Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
	// contains filtered or unexported fields
}

func (*MultiVal) Descriptor deprecated

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

Deprecated: Use MultiVal.ProtoReflect.Descriptor instead.

func (*MultiVal) GetValues

func (x *MultiVal) GetValues() []string

func (*MultiVal) ProtoMessage

func (*MultiVal) ProtoMessage()

func (*MultiVal) ProtoReflect added in v0.5.1

func (x *MultiVal) ProtoReflect() protoreflect.Message

func (*MultiVal) Reset

func (x *MultiVal) Reset()

func (*MultiVal) String

func (x *MultiVal) String() string

type Request

type Request struct {

	// HTTP method from requestor
	Method Method `protobuf:"varint,1,opt,name=method,proto3,enum=httpapi.Method" json:"method,omitempty"`
	// Desired procedure name
	Procedure string `protobuf:"bytes,2,opt,name=procedure,proto3" json:"procedure,omitempty"`
	// JSON payload of the request, if present
	Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
	// Query params of the request, if present
	Params map[string]*MultiVal `` /* 153-byte string literal not displayed */
	// Headers won't be automatically translated into the GRPC requests, but they should be delivered in case manual conversion is needed
	Headers map[string]*MultiVal `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

The request data from the HTTP request

func (*Request) Descriptor deprecated

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

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetHeaders

func (x *Request) GetHeaders() map[string]*MultiVal

func (*Request) GetMethod

func (x *Request) GetMethod() Method

func (*Request) GetParams

func (x *Request) GetParams() map[string]*MultiVal

func (*Request) GetPayload

func (x *Request) GetPayload() []byte

func (*Request) GetProcedure

func (x *Request) GetProcedure() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect added in v0.5.1

func (x *Request) ProtoReflect() protoreflect.Message

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

type Response struct {

	// Manually set status code rather than rely on error-handling at the proxy
	StatusCode uint32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
	// JSON data to return to the requestor
	Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	// Headers won't be automatically returned from GRPC requests, but they should be accepted in case manual conversion is needed
	WriteHeaders map[string]*MultiVal `` /* 185-byte string literal not displayed */
	// contains filtered or unexported fields
}

The response to send to the requestor

func (*Response) Descriptor deprecated

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

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetPayload

func (x *Response) GetPayload() []byte

func (*Response) GetStatusCode

func (x *Response) GetStatusCode() uint32

func (*Response) GetWriteHeaders

func (x *Response) GetWriteHeaders() map[string]*MultiVal

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect added in v0.5.1

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type RoutingInformation added in v0.6.0

type RoutingInformation struct {

	// HTTP method from requestor
	Method Method `protobuf:"varint,1,opt,name=method,proto3,enum=httpapi.Method" json:"method,omitempty"`
	// Desired procedure name
	Procedure string `protobuf:"bytes,2,opt,name=procedure,proto3" json:"procedure,omitempty"`
	// Headers won't be automatically translated into the GRPC requests, but they should be delivered in case manual conversion is needed
	Headers map[string]*MultiVal `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*RoutingInformation) Descriptor deprecated added in v0.6.0

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

Deprecated: Use RoutingInformation.ProtoReflect.Descriptor instead.

func (*RoutingInformation) GetHeaders added in v0.6.0

func (x *RoutingInformation) GetHeaders() map[string]*MultiVal

func (*RoutingInformation) GetMethod added in v0.6.0

func (x *RoutingInformation) GetMethod() Method

func (*RoutingInformation) GetProcedure added in v0.6.0

func (x *RoutingInformation) GetProcedure() string

func (*RoutingInformation) ProtoMessage added in v0.6.0

func (*RoutingInformation) ProtoMessage()

func (*RoutingInformation) ProtoReflect added in v0.6.0

func (x *RoutingInformation) ProtoReflect() protoreflect.Message

func (*RoutingInformation) Reset added in v0.6.0

func (x *RoutingInformation) Reset()

func (*RoutingInformation) String added in v0.6.0

func (x *RoutingInformation) String() string

type StreamedRequest added in v0.6.0

type StreamedRequest struct {

	// Types that are assignable to MessageType:
	//	*StreamedRequest_Init
	//	*StreamedRequest_Request
	MessageType isStreamedRequest_MessageType `protobuf_oneof:"message_type"`
	// contains filtered or unexported fields
}

func (*StreamedRequest) Descriptor deprecated added in v0.6.0

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

Deprecated: Use StreamedRequest.ProtoReflect.Descriptor instead.

func (*StreamedRequest) GetInit added in v0.6.0

func (x *StreamedRequest) GetInit() *RoutingInformation

func (*StreamedRequest) GetMessageType added in v0.6.0

func (m *StreamedRequest) GetMessageType() isStreamedRequest_MessageType

func (*StreamedRequest) GetRequest added in v0.6.0

func (x *StreamedRequest) GetRequest() []byte

func (*StreamedRequest) ProtoMessage added in v0.6.0

func (*StreamedRequest) ProtoMessage()

func (*StreamedRequest) ProtoReflect added in v0.6.0

func (x *StreamedRequest) ProtoReflect() protoreflect.Message

func (*StreamedRequest) Reset added in v0.6.0

func (x *StreamedRequest) Reset()

func (*StreamedRequest) String added in v0.6.0

func (x *StreamedRequest) String() string

type StreamedRequest_Init added in v0.6.0

type StreamedRequest_Init struct {
	// Init will only be sent once on initialisation of the websocket that this stream is linked to, it contains the routing information normally transmitted by the Request message
	Init *RoutingInformation `protobuf:"bytes,1,opt,name=init,proto3,oneof"`
}

type StreamedRequest_Request added in v0.6.0

type StreamedRequest_Request struct {
	// Request will be sent for every message but the very first, and is the JSON extracted from the websocket message
	Request []byte `protobuf:"bytes,2,opt,name=request,proto3,oneof"`
}

type StreamedResponse added in v0.6.0

type StreamedResponse struct {
	Response []byte `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
	// contains filtered or unexported fields
}

TODO: work out what we can do here

func (*StreamedResponse) Descriptor deprecated added in v0.6.0

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

Deprecated: Use StreamedResponse.ProtoReflect.Descriptor instead.

func (*StreamedResponse) GetResponse added in v0.6.0

func (x *StreamedResponse) GetResponse() []byte

func (*StreamedResponse) ProtoMessage added in v0.6.0

func (*StreamedResponse) ProtoMessage()

func (*StreamedResponse) ProtoReflect added in v0.6.0

func (x *StreamedResponse) ProtoReflect() protoreflect.Message

func (*StreamedResponse) Reset added in v0.6.0

func (x *StreamedResponse) Reset()

func (*StreamedResponse) String added in v0.6.0

func (x *StreamedResponse) String() string

type UnimplementedExposedServiceServer

type UnimplementedExposedServiceServer struct {
}

UnimplementedExposedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedExposedServiceServer) ProxyStream added in v0.6.0

func (UnimplementedExposedServiceServer) ProxyUnary added in v0.6.0

type UnsafeExposedServiceServer added in v0.6.0

type UnsafeExposedServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeExposedServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ExposedServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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