gateway

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

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_gateway_gateway_proto protoreflect.FileDescriptor
View Source
var GatewayService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gateway.GatewayService",
	HandlerType: (*GatewayServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "List",
			Handler:    _GatewayService_List_Handler,
		},
		{
			MethodName: "Create",
			Handler:    _GatewayService_Create_Handler,
		},
		{
			MethodName: "Update",
			Handler:    _GatewayService_Update_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _GatewayService_Delete_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "gateway/gateway.proto",
}

GatewayService_ServiceDesc is the grpc.ServiceDesc for GatewayService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterGatewayServiceHandler

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

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

func RegisterGatewayServiceHandlerClient

func RegisterGatewayServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GatewayServiceClient) error

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

func RegisterGatewayServiceHandlerFromEndpoint

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

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

func RegisterGatewayServiceHandlerServer

func RegisterGatewayServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GatewayServiceServer) error

RegisterGatewayServiceHandlerServer registers the http handlers for service GatewayService to "mux". UnaryRPC :call GatewayServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterGatewayServiceHandlerFromEndpoint instead.

func RegisterGatewayServiceServer

func RegisterGatewayServiceServer(s grpc.ServiceRegistrar, srv GatewayServiceServer)

Types

type Gateway

type Gateway struct {
	Id           string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" bson:"_id,omitempty"` // @gotags: bson:"_id,omitempty"
	Name         string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Intro        string   `protobuf:"bytes,3,opt,name=intro,proto3" json:"intro,omitempty"`
	Hosts        []string `protobuf:"bytes,5,rep,name=hosts,proto3" json:"hosts,omitempty"`
	HttpsEnabled bool     `` // @gotags: bson:"https_enabled,omitempty"
	/* 129-byte string literal not displayed */
	HttpsRedirect bool `` // @gotags: bson:"https_redirect,omitempty"
	/* 133-byte string literal not displayed */
	CertIssuer  string                 `protobuf:"bytes,8,opt,name=cert_issuer,json=certIssuer,proto3" json:"cert_issuer,omitempty" bson:"cert_issuer,omitempty"`      // @gotags: bson:"cert_issuer,omitempty"
	CustomPorts *Port                  `protobuf:"bytes,11,opt,name=custom_ports,json=customPorts,proto3" json:"custom_ports,omitempty" bson:"custom_ports,omitempty"` // @gotags: bson:"custom_ports,omitempty"
	CreatedAt   *timestamppb.Timestamp `protobuf:"bytes,101,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	UpdatedAt   *timestamppb.Timestamp `protobuf:"bytes,103,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	// contains filtered or unexported fields
}

func (*Gateway) Descriptor deprecated

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

Deprecated: Use Gateway.ProtoReflect.Descriptor instead.

func (*Gateway) GetCertIssuer

func (x *Gateway) GetCertIssuer() string

func (*Gateway) GetCreatedAt

func (x *Gateway) GetCreatedAt() *timestamppb.Timestamp

func (*Gateway) GetCustomPorts

func (x *Gateway) GetCustomPorts() *Port

func (*Gateway) GetHosts

func (x *Gateway) GetHosts() []string

func (*Gateway) GetHttpsEnabled

func (x *Gateway) GetHttpsEnabled() bool

func (*Gateway) GetHttpsRedirect

func (x *Gateway) GetHttpsRedirect() bool

func (*Gateway) GetId

func (x *Gateway) GetId() string

func (*Gateway) GetIntro

func (x *Gateway) GetIntro() string

func (*Gateway) GetName

func (x *Gateway) GetName() string

func (*Gateway) GetUpdatedAt

func (x *Gateway) GetUpdatedAt() *timestamppb.Timestamp

func (*Gateway) ProtoMessage

func (*Gateway) ProtoMessage()

func (*Gateway) ProtoReflect

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

func (*Gateway) Reset

func (x *Gateway) Reset()

func (*Gateway) String

func (x *Gateway) String() string

func (*Gateway) Validate

func (m *Gateway) Validate() error

Validate checks the field values on Gateway with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Gateway) ValidateAll

func (m *Gateway) ValidateAll() error

ValidateAll checks the field values on Gateway with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GatewayMultiError, or nil if none found.

type GatewayMultiError

type GatewayMultiError []error

GatewayMultiError is an error wrapping multiple validation errors returned by Gateway.ValidateAll() if the designated constraints aren't met.

func (GatewayMultiError) AllErrors

func (m GatewayMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GatewayMultiError) Error

func (m GatewayMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type GatewayServiceClient

type GatewayServiceClient interface {
	List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
	Create(ctx context.Context, in *Gateway, opts ...grpc.CallOption) (*Gateway, error)
	Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*Gateway, error)
	Delete(ctx context.Context, in *kiae.IdRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

GatewayServiceClient is the client API for GatewayService 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 GatewayServiceServer

type GatewayServiceServer interface {
	List(context.Context, *ListRequest) (*ListResponse, error)
	Create(context.Context, *Gateway) (*Gateway, error)
	Update(context.Context, *UpdateRequest) (*Gateway, error)
	Delete(context.Context, *kiae.IdRequest) (*emptypb.Empty, error)
}

GatewayServiceServer is the server API for GatewayService service. All implementations should embed UnimplementedGatewayServiceServer for forward compatibility

type GatewayValidationError

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

GatewayValidationError is the validation error returned by Gateway.Validate if the designated constraints aren't met.

func (GatewayValidationError) Cause

func (e GatewayValidationError) Cause() error

Cause function returns cause value.

func (GatewayValidationError) Error

func (e GatewayValidationError) Error() string

Error satisfies the builtin error interface

func (GatewayValidationError) ErrorName

func (e GatewayValidationError) ErrorName() string

ErrorName returns error name.

func (GatewayValidationError) Field

func (e GatewayValidationError) Field() string

Field function returns field value.

func (GatewayValidationError) Key

func (e GatewayValidationError) Key() bool

Key function returns key value.

func (GatewayValidationError) Reason

func (e GatewayValidationError) Reason() string

Reason function returns reason value.

type ListRequest

type ListRequest struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*ListRequest) Descriptor deprecated

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

Deprecated: Use ListRequest.ProtoReflect.Descriptor instead.

func (*ListRequest) GetName

func (x *ListRequest) GetName() string

func (*ListRequest) ProtoMessage

func (*ListRequest) ProtoMessage()

func (*ListRequest) ProtoReflect

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

func (*ListRequest) Reset

func (x *ListRequest) Reset()

func (*ListRequest) String

func (x *ListRequest) String() string

func (*ListRequest) Validate

func (m *ListRequest) Validate() error

Validate checks the field values on ListRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*ListRequest) ValidateAll

func (m *ListRequest) ValidateAll() error

ValidateAll checks the field values on ListRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ListRequestMultiError, or nil if none found.

type ListRequestMultiError

type ListRequestMultiError []error

ListRequestMultiError is an error wrapping multiple validation errors returned by ListRequest.ValidateAll() if the designated constraints aren't met.

func (ListRequestMultiError) AllErrors

func (m ListRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ListRequestMultiError) Error

func (m ListRequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ListRequestValidationError

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

ListRequestValidationError is the validation error returned by ListRequest.Validate if the designated constraints aren't met.

func (ListRequestValidationError) Cause

Cause function returns cause value.

func (ListRequestValidationError) Error

Error satisfies the builtin error interface

func (ListRequestValidationError) ErrorName

func (e ListRequestValidationError) ErrorName() string

ErrorName returns error name.

func (ListRequestValidationError) Field

Field function returns field value.

func (ListRequestValidationError) Key

Key function returns key value.

func (ListRequestValidationError) Reason

Reason function returns reason value.

type ListResponse

type ListResponse struct {
	Items []*Gateway `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	Total int64      `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"`
	// contains filtered or unexported fields
}

func (*ListResponse) Descriptor deprecated

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

Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.

func (*ListResponse) GetItems

func (x *ListResponse) GetItems() []*Gateway

func (*ListResponse) GetTotal

func (x *ListResponse) GetTotal() int64

func (*ListResponse) ProtoMessage

func (*ListResponse) ProtoMessage()

func (*ListResponse) ProtoReflect

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

func (*ListResponse) Reset

func (x *ListResponse) Reset()

func (*ListResponse) String

func (x *ListResponse) String() string

func (*ListResponse) Validate

func (m *ListResponse) Validate() error

Validate checks the field values on ListResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*ListResponse) ValidateAll

func (m *ListResponse) ValidateAll() error

ValidateAll checks the field values on ListResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ListResponseMultiError, or nil if none found.

type ListResponseMultiError

type ListResponseMultiError []error

ListResponseMultiError is an error wrapping multiple validation errors returned by ListResponse.ValidateAll() if the designated constraints aren't met.

func (ListResponseMultiError) AllErrors

func (m ListResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ListResponseMultiError) Error

func (m ListResponseMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ListResponseValidationError

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

ListResponseValidationError is the validation error returned by ListResponse.Validate if the designated constraints aren't met.

func (ListResponseValidationError) Cause

Cause function returns cause value.

func (ListResponseValidationError) Error

Error satisfies the builtin error interface

func (ListResponseValidationError) ErrorName

func (e ListResponseValidationError) ErrorName() string

ErrorName returns error name.

func (ListResponseValidationError) Field

Field function returns field value.

func (ListResponseValidationError) Key

Key function returns key value.

func (ListResponseValidationError) Reason

Reason function returns reason value.

type Port

type Port struct {
	Port     int32  `protobuf:"varint,1,opt,name=port,proto3" json:"port,omitempty"`
	Protocol string `protobuf:"bytes,2,opt,name=protocol,proto3" json:"protocol,omitempty"`
	// contains filtered or unexported fields
}

func (*Port) Descriptor deprecated

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

Deprecated: Use Port.ProtoReflect.Descriptor instead.

func (*Port) GetPort

func (x *Port) GetPort() int32

func (*Port) GetProtocol

func (x *Port) GetProtocol() string

func (*Port) ProtoMessage

func (*Port) ProtoMessage()

func (*Port) ProtoReflect

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

func (*Port) Reset

func (x *Port) Reset()

func (*Port) String

func (x *Port) String() string

func (*Port) Validate

func (m *Port) Validate() error

Validate checks the field values on Port with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Port) ValidateAll

func (m *Port) ValidateAll() error

ValidateAll checks the field values on Port with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PortMultiError, or nil if none found.

type PortMultiError

type PortMultiError []error

PortMultiError is an error wrapping multiple validation errors returned by Port.ValidateAll() if the designated constraints aren't met.

func (PortMultiError) AllErrors

func (m PortMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PortMultiError) Error

func (m PortMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type PortValidationError

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

PortValidationError is the validation error returned by Port.Validate if the designated constraints aren't met.

func (PortValidationError) Cause

func (e PortValidationError) Cause() error

Cause function returns cause value.

func (PortValidationError) Error

func (e PortValidationError) Error() string

Error satisfies the builtin error interface

func (PortValidationError) ErrorName

func (e PortValidationError) ErrorName() string

ErrorName returns error name.

func (PortValidationError) Field

func (e PortValidationError) Field() string

Field function returns field value.

func (PortValidationError) Key

func (e PortValidationError) Key() bool

Key function returns key value.

func (PortValidationError) Reason

func (e PortValidationError) Reason() string

Reason function returns reason value.

type UnimplementedGatewayServiceServer

type UnimplementedGatewayServiceServer struct {
}

UnimplementedGatewayServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedGatewayServiceServer) Create

func (UnimplementedGatewayServiceServer) Delete

func (UnimplementedGatewayServiceServer) List

func (UnimplementedGatewayServiceServer) Update

type UnsafeGatewayServiceServer

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

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

type UpdateRequest

type UpdateRequest struct {
	Payload    *Gateway               `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateRequest) Descriptor deprecated

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

Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.

func (*UpdateRequest) GetPayload

func (x *UpdateRequest) GetPayload() *Gateway

func (*UpdateRequest) GetUpdateMask

func (x *UpdateRequest) GetUpdateMask() *fieldmaskpb.FieldMask

func (*UpdateRequest) ProtoMessage

func (*UpdateRequest) ProtoMessage()

func (*UpdateRequest) ProtoReflect

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

func (*UpdateRequest) Reset

func (x *UpdateRequest) Reset()

func (*UpdateRequest) String

func (x *UpdateRequest) String() string

func (*UpdateRequest) Validate

func (m *UpdateRequest) Validate() error

Validate checks the field values on UpdateRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*UpdateRequest) ValidateAll

func (m *UpdateRequest) ValidateAll() error

ValidateAll checks the field values on UpdateRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in UpdateRequestMultiError, or nil if none found.

type UpdateRequestMultiError

type UpdateRequestMultiError []error

UpdateRequestMultiError is an error wrapping multiple validation errors returned by UpdateRequest.ValidateAll() if the designated constraints aren't met.

func (UpdateRequestMultiError) AllErrors

func (m UpdateRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (UpdateRequestMultiError) Error

func (m UpdateRequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type UpdateRequestValidationError

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

UpdateRequestValidationError is the validation error returned by UpdateRequest.Validate if the designated constraints aren't met.

func (UpdateRequestValidationError) Cause

Cause function returns cause value.

func (UpdateRequestValidationError) Error

Error satisfies the builtin error interface

func (UpdateRequestValidationError) ErrorName

func (e UpdateRequestValidationError) ErrorName() string

ErrorName returns error name.

func (UpdateRequestValidationError) Field

Field function returns field value.

func (UpdateRequestValidationError) Key

Key function returns key value.

func (UpdateRequestValidationError) Reason

Reason function returns reason value.

Jump to

Keyboard shortcuts

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