Documentation ¶
Overview ¶
Package gateway is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterGatewayHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterGatewayHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GatewayClient) error
- func RegisterGatewayHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterGatewayHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GatewayServer) error
- func RegisterGatewayServer(s *grpc.Server, srv GatewayServer)
- type GatewayClient
- type GatewayServer
- type GatewayServerMock
- type Health
- type UnimplementedGatewayServer
- type Version
- func (*Version) Descriptor() ([]byte, []int)deprecated
- func (x *Version) GetBuilt() string
- func (x *Version) GetName() string
- func (x *Version) GetSha() string
- func (x *Version) GetVersion() string
- func (*Version) ProtoMessage()
- func (x *Version) ProtoReflect() protoreflect.Message
- func (x *Version) Reset()
- func (x *Version) String() string
Constants ¶
This section is empty.
Variables ¶
var File_automate_gateway_api_gateway_gateway_proto protoreflect.FileDescriptor
Functions ¶
func RegisterGatewayHandler ¶
func RegisterGatewayHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterGatewayHandler registers the http handlers for service Gateway to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterGatewayHandlerClient ¶
func RegisterGatewayHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GatewayClient) error
RegisterGatewayHandlerClient registers the http handlers for service Gateway to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "GatewayClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "GatewayClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "GatewayClient" to call the correct interceptors.
func RegisterGatewayHandlerFromEndpoint ¶
func RegisterGatewayHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterGatewayHandlerFromEndpoint is same as RegisterGatewayHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterGatewayHandlerServer ¶
func RegisterGatewayHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GatewayServer) error
RegisterGatewayHandlerServer registers the http handlers for service Gateway to "mux". UnaryRPC :call GatewayServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
func RegisterGatewayServer ¶
func RegisterGatewayServer(s *grpc.Server, srv GatewayServer)
Types ¶
type GatewayClient ¶
type GatewayClient interface { GetVersion(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Version, error) GetHealth(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Health, error) }
GatewayClient is the client API for Gateway service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewGatewayClient ¶
func NewGatewayClient(cc grpc.ClientConnInterface) GatewayClient
type GatewayServer ¶
type GatewayServer interface { GetVersion(context.Context, *emptypb.Empty) (*Version, error) GetHealth(context.Context, *emptypb.Empty) (*Health, error) }
GatewayServer is the server API for Gateway service.
type GatewayServerMock ¶
type GatewayServerMock struct { GetVersionFunc func(context.Context, *emptypb.Empty) (*Version, error) GetHealthFunc func(context.Context, *emptypb.Empty) (*Health, error) // contains filtered or unexported fields }
GatewayServerMock is the mock-what-you-want struct that stubs all not-overridden methods with "not implemented" returns
func NewGatewayServerMock ¶
func NewGatewayServerMock() *GatewayServerMock
NewGatewayServerMock gives you a fresh instance of GatewayServerMock.
func NewGatewayServerMockWithoutValidation ¶
func NewGatewayServerMockWithoutValidation() *GatewayServerMock
NewGatewayServerMockWithoutValidation gives you a fresh instance of GatewayServerMock which does not attempt to validate requests before passing them to their respective '*Func'.
func (*GatewayServerMock) GetVersion ¶
func (*GatewayServerMock) Reset ¶
func (m *GatewayServerMock) Reset()
Reset resets all overridden functions
type Health ¶
type Health struct { Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
Health message
The automate-gateway service health is constructed with:
- Status: => ok: Everything is alright => initialization: The service is in its initialization process => warning: Something might be wrong? => critical: Something is wrong!
@afiune: Here we can add more health information to the response
func (*Health) Descriptor
deprecated
func (*Health) ProtoMessage ¶
func (*Health) ProtoMessage()
func (*Health) ProtoReflect ¶
func (x *Health) ProtoReflect() protoreflect.Message
type UnimplementedGatewayServer ¶
type UnimplementedGatewayServer struct { }
UnimplementedGatewayServer can be embedded to have forward compatible implementations.
func (*UnimplementedGatewayServer) GetVersion ¶
type Version ¶
type Version struct { Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` Built string `protobuf:"bytes,1,opt,name=built,proto3" json:"built,omitempty"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` Sha string `protobuf:"bytes,4,opt,name=sha,proto3" json:"sha,omitempty"` // contains filtered or unexported fields }
Version message
The service version constructed with: * Service name * Built time * Semantic version * Git SHA
func (*Version) Descriptor
deprecated
func (*Version) GetVersion ¶
func (*Version) ProtoMessage ¶
func (*Version) ProtoMessage()
func (*Version) ProtoReflect ¶
func (x *Version) ProtoReflect() protoreflect.Message