gateway

package
v0.0.0-...-4b711b1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Overview

Package gateway is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
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) GetHealth

func (m *GatewayServerMock) GetHealth(ctx context.Context, req *emptypb.Empty) (*Health, error)

func (*GatewayServerMock) GetVersion

func (m *GatewayServerMock) GetVersion(ctx context.Context, req *emptypb.Empty) (*Version, error)

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) Descriptor() ([]byte, []int)

Deprecated: Use Health.ProtoReflect.Descriptor instead.

func (*Health) GetStatus

func (x *Health) GetStatus() string

func (*Health) ProtoMessage

func (*Health) ProtoMessage()

func (*Health) ProtoReflect

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

func (*Health) Reset

func (x *Health) Reset()

func (*Health) String

func (x *Health) String() string

type UnimplementedGatewayServer

type UnimplementedGatewayServer struct {
}

UnimplementedGatewayServer can be embedded to have forward compatible implementations.

func (*UnimplementedGatewayServer) GetHealth

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) Descriptor() ([]byte, []int)

Deprecated: Use Version.ProtoReflect.Descriptor instead.

func (*Version) GetBuilt

func (x *Version) GetBuilt() string

func (*Version) GetName

func (x *Version) GetName() string

func (*Version) GetSha

func (x *Version) GetSha() string

func (*Version) GetVersion

func (x *Version) GetVersion() string

func (*Version) ProtoMessage

func (*Version) ProtoMessage()

func (*Version) ProtoReflect

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

func (*Version) Reset

func (x *Version) Reset()

func (*Version) String

func (x *Version) String() string

Jump to

Keyboard shortcuts

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