Documentation ¶
Overview ¶
Package gateway is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- 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 RegisterGatewayServer(s *grpc.Server, srv GatewayServer)
- type GatewayClient
- type GatewayServer
- type GatewayServerMock
- type Health
- func (*Health) Descriptor() ([]byte, []int)
- func (m *Health) GetStatus() string
- func (*Health) ProtoMessage()
- func (m *Health) Reset()
- func (m *Health) String() string
- func (m *Health) XXX_DiscardUnknown()
- func (m *Health) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Health) XXX_Merge(src proto.Message)
- func (m *Health) XXX_Size() int
- func (m *Health) XXX_Unmarshal(b []byte) error
- type Version
- func (*Version) Descriptor() ([]byte, []int)
- func (m *Version) GetBuilt() string
- func (m *Version) GetName() string
- func (m *Version) GetSha() string
- func (m *Version) GetVersion() string
- func (*Version) ProtoMessage()
- func (m *Version) Reset()
- func (m *Version) String() string
- func (m *Version) XXX_DiscardUnknown()
- func (m *Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Version) XXX_Merge(src proto.Message)
- func (m *Version) XXX_Size() int
- func (m *Version) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 RegisterGatewayServer ¶
func RegisterGatewayServer(s *grpc.Server, srv GatewayServer)
Types ¶
type GatewayClient ¶
type GatewayClient interface { GetVersion(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Version, error) GetHealth(ctx context.Context, in *empty.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.ClientConn) GatewayClient
type GatewayServer ¶
type GatewayServer interface { GetVersion(context.Context, *empty.Empty) (*Version, error) GetHealth(context.Context, *empty.Empty) (*Health, error) }
GatewayServer is the server API for Gateway service.
type GatewayServerMock ¶
type GatewayServerMock struct { GetVersionFunc func(context.Context, *empty.Empty) (*Version, error) GetHealthFunc func(context.Context, *empty.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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
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 ¶
func (*Health) ProtoMessage ¶
func (*Health) ProtoMessage()
func (*Health) XXX_DiscardUnknown ¶
func (m *Health) XXX_DiscardUnknown()
func (*Health) XXX_Marshal ¶
func (*Health) XXX_Unmarshal ¶
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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Version message
The service version constructed with: * Service name * Built time * Semantic version * Git SHA
func (*Version) Descriptor ¶
func (*Version) GetVersion ¶
func (*Version) ProtoMessage ¶
func (*Version) ProtoMessage()
func (*Version) XXX_DiscardUnknown ¶
func (m *Version) XXX_DiscardUnknown()