loadbalancer

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrSuccess              = 0
	ErrNoSuchLB             = (1 << 0)
	ErrNoSuchService        = (1 << 1)
	ErrNoSuchIP             = (1 << 2)
	ErrAddDestinationFailed = (1 << 3)
	ErrDelDestinationFailed = (1 << 4)
	ErrTargetAlreadyMapped  = (1 << 5)
	ErrTargetNotMapped      = (1 << 6)
	ErrIPAMError            = (1 << 7)
)

Error codes that can appear in the Error.Code field

Variables

View Source
var (
	Protocol_name = map[int32]string{
		0: "TCP",
		1: "UDP",
	}
	Protocol_value = map[string]int32{
		"TCP": 0,
		"UDP": 1,
	}
)

Enum value maps for Protocol.

View Source
var File_internal_loadbalancer_loadbalancer_proto protoreflect.FileDescriptor
View Source
var LoadBalancer_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "loadbalancer.LoadBalancer",
	HandlerType: (*LoadBalancerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetLoadBalancer",
			Handler:    _LoadBalancer_GetLoadBalancer_Handler,
		},
		{
			MethodName: "Create",
			Handler:    _LoadBalancer_Create_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _LoadBalancer_Delete_Handler,
		},
		{
			MethodName: "AddTarget",
			Handler:    _LoadBalancer_AddTarget_Handler,
		},
		{
			MethodName: "DelTarget",
			Handler:    _LoadBalancer_DelTarget_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "GetLoadBalancers",
			Handler:       _LoadBalancer_GetLoadBalancers_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "internal/loadbalancer/loadbalancer.proto",
}

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

Functions

func RegisterLoadBalancerServer

func RegisterLoadBalancerServer(s grpc.ServiceRegistrar, srv LoadBalancerServer)

Types

type AddTargetRequest

type AddTargetRequest struct {
	LbName  string  `protobuf:"bytes,1,opt,name=lb_name,json=lbName,proto3" json:"lb_name,omitempty"`
	SrcPort int32   `protobuf:"varint,2,opt,name=srcPort,proto3" json:"srcPort,omitempty"`
	Target  *Target `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"`
	// contains filtered or unexported fields
}

func (*AddTargetRequest) Descriptor deprecated

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

Deprecated: Use AddTargetRequest.ProtoReflect.Descriptor instead.

func (*AddTargetRequest) GetLbName

func (x *AddTargetRequest) GetLbName() string

func (*AddTargetRequest) GetSrcPort

func (x *AddTargetRequest) GetSrcPort() int32

func (*AddTargetRequest) GetTarget

func (x *AddTargetRequest) GetTarget() *Target

func (*AddTargetRequest) ProtoMessage

func (*AddTargetRequest) ProtoMessage()

func (*AddTargetRequest) ProtoReflect

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

func (*AddTargetRequest) Reset

func (x *AddTargetRequest) Reset()

func (*AddTargetRequest) String

func (x *AddTargetRequest) String() string

type CreateLoadBalancer

type CreateLoadBalancer struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// If an ip_addr is requested, try to use it. Otherwise, an unused IP will be allocated.
	IpAddr *string `protobuf:"bytes,2,opt,name=ip_addr,json=ipAddr,proto3,oneof" json:"ip_addr,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateLoadBalancer) Descriptor deprecated

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

Deprecated: Use CreateLoadBalancer.ProtoReflect.Descriptor instead.

func (*CreateLoadBalancer) GetIpAddr

func (x *CreateLoadBalancer) GetIpAddr() string

func (*CreateLoadBalancer) GetName

func (x *CreateLoadBalancer) GetName() string

func (*CreateLoadBalancer) ProtoMessage

func (*CreateLoadBalancer) ProtoMessage()

func (*CreateLoadBalancer) ProtoReflect

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

func (*CreateLoadBalancer) Reset

func (x *CreateLoadBalancer) Reset()

func (*CreateLoadBalancer) String

func (x *CreateLoadBalancer) String() string

type DelTargetRequest

type DelTargetRequest struct {
	LbName  string  `protobuf:"bytes,1,opt,name=lb_name,json=lbName,proto3" json:"lb_name,omitempty"`
	SrcPort int32   `protobuf:"varint,2,opt,name=srcPort,proto3" json:"srcPort,omitempty"`
	Target  *Target `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"`
	// contains filtered or unexported fields
}

func (*DelTargetRequest) Descriptor deprecated

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

Deprecated: Use DelTargetRequest.ProtoReflect.Descriptor instead.

func (*DelTargetRequest) GetLbName

func (x *DelTargetRequest) GetLbName() string

func (*DelTargetRequest) GetSrcPort

func (x *DelTargetRequest) GetSrcPort() int32

func (*DelTargetRequest) GetTarget

func (x *DelTargetRequest) GetTarget() *Target

func (*DelTargetRequest) ProtoMessage

func (*DelTargetRequest) ProtoMessage()

func (*DelTargetRequest) ProtoReflect

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

func (*DelTargetRequest) Reset

func (x *DelTargetRequest) Reset()

func (*DelTargetRequest) String

func (x *DelTargetRequest) String() string

type Error

type Error struct {
	Code    uint32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=Message,proto3" json:"Message,omitempty"`
	// contains filtered or unexported fields
}

func (*Error) Descriptor deprecated

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

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) GetCode

func (x *Error) GetCode() uint32

func (*Error) GetMessage

func (x *Error) GetMessage() string

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect

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

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

type Intf

type Intf interface {
	LoadBalancerServer
	Close()
	Restore() error
}

func NewServer

func NewServer(config *koanf.Koanf) (Intf, error)

type LoadBalancerClient

type LoadBalancerClient interface {
	// Get all information about all defined Load Balancers
	GetLoadBalancers(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (LoadBalancer_GetLoadBalancersClient, error)
	// Get information about a specific Load Balancer. If no such name exists, return
	// an empty structure
	GetLoadBalancer(ctx context.Context, in *LoadBalancerName, opts ...grpc.CallOption) (*LoadBalancerInformation, error)
	Create(ctx context.Context, in *CreateLoadBalancer, opts ...grpc.CallOption) (*LoadBalancerInformation, error)
	Delete(ctx context.Context, in *LoadBalancerName, opts ...grpc.CallOption) (*Error, error)
	AddTarget(ctx context.Context, in *AddTargetRequest, opts ...grpc.CallOption) (*Error, error)
	DelTarget(ctx context.Context, in *DelTargetRequest, opts ...grpc.CallOption) (*Error, error)
}

LoadBalancerClient is the client API for LoadBalancer 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 LoadBalancerInformation

type LoadBalancerInformation struct {
	Name    string                `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	IpAddr  string                `protobuf:"bytes,2,opt,name=ip_addr,json=ipAddr,proto3" json:"ip_addr,omitempty"`
	Targets map[int32]*TargetList `` /* 156-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*LoadBalancerInformation) Descriptor deprecated

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

Deprecated: Use LoadBalancerInformation.ProtoReflect.Descriptor instead.

func (*LoadBalancerInformation) GetIpAddr

func (x *LoadBalancerInformation) GetIpAddr() string

func (*LoadBalancerInformation) GetName

func (x *LoadBalancerInformation) GetName() string

func (*LoadBalancerInformation) GetTargets

func (x *LoadBalancerInformation) GetTargets() map[int32]*TargetList

func (*LoadBalancerInformation) ProtoMessage

func (*LoadBalancerInformation) ProtoMessage()

func (*LoadBalancerInformation) ProtoReflect

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

func (*LoadBalancerInformation) Reset

func (x *LoadBalancerInformation) Reset()

func (*LoadBalancerInformation) String

func (x *LoadBalancerInformation) String() string

type LoadBalancerName

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

func (*LoadBalancerName) Descriptor deprecated

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

Deprecated: Use LoadBalancerName.ProtoReflect.Descriptor instead.

func (*LoadBalancerName) GetName

func (x *LoadBalancerName) GetName() string

func (*LoadBalancerName) ProtoMessage

func (*LoadBalancerName) ProtoMessage()

func (*LoadBalancerName) ProtoReflect

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

func (*LoadBalancerName) Reset

func (x *LoadBalancerName) Reset()

func (*LoadBalancerName) String

func (x *LoadBalancerName) String() string

type LoadBalancerServer

type LoadBalancerServer interface {
	// Get all information about all defined Load Balancers
	GetLoadBalancers(*emptypb.Empty, LoadBalancer_GetLoadBalancersServer) error
	// Get information about a specific Load Balancer. If no such name exists, return
	// an empty structure
	GetLoadBalancer(context.Context, *LoadBalancerName) (*LoadBalancerInformation, error)
	Create(context.Context, *CreateLoadBalancer) (*LoadBalancerInformation, error)
	Delete(context.Context, *LoadBalancerName) (*Error, error)
	AddTarget(context.Context, *AddTargetRequest) (*Error, error)
	DelTarget(context.Context, *DelTargetRequest) (*Error, error)
	// contains filtered or unexported methods
}

LoadBalancerServer is the server API for LoadBalancer service. All implementations must embed UnimplementedLoadBalancerServer for forward compatibility

type LoadBalancer_GetLoadBalancersClient

type LoadBalancer_GetLoadBalancersClient interface {
	Recv() (*LoadBalancerInformation, error)
	grpc.ClientStream
}

type LoadBalancer_GetLoadBalancersServer

type LoadBalancer_GetLoadBalancersServer interface {
	Send(*LoadBalancerInformation) error
	grpc.ServerStream
}

type Protocol

type Protocol int32
const (
	Protocol_TCP Protocol = 0
	Protocol_UDP Protocol = 1
)

func (Protocol) Descriptor

func (Protocol) Descriptor() protoreflect.EnumDescriptor

func (Protocol) Enum

func (x Protocol) Enum() *Protocol

func (Protocol) EnumDescriptor deprecated

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

Deprecated: Use Protocol.Descriptor instead.

func (Protocol) Number

func (x Protocol) Number() protoreflect.EnumNumber

func (Protocol) String

func (x Protocol) String() string

func (Protocol) Type

type Target

type Target struct {
	Protocol Protocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=loadbalancer.Protocol" json:"protocol,omitempty"`
	DstIP    string   `protobuf:"bytes,2,opt,name=dstIP,proto3" json:"dstIP,omitempty"`
	DstPort  int32    `protobuf:"varint,3,opt,name=dstPort,proto3" json:"dstPort,omitempty"`
	// contains filtered or unexported fields
}

func (*Target) Descriptor deprecated

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

Deprecated: Use Target.ProtoReflect.Descriptor instead.

func (*Target) GetDstIP

func (x *Target) GetDstIP() string

func (*Target) GetDstPort

func (x *Target) GetDstPort() int32

func (*Target) GetProtocol

func (x *Target) GetProtocol() Protocol

func (*Target) ProtoMessage

func (*Target) ProtoMessage()

func (*Target) ProtoReflect

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

func (*Target) Reset

func (x *Target) Reset()

func (*Target) String

func (x *Target) String() string

type TargetList

type TargetList struct {
	Target []*Target `protobuf:"bytes,1,rep,name=target,proto3" json:"target,omitempty"`
	// contains filtered or unexported fields
}

func (*TargetList) Descriptor deprecated

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

Deprecated: Use TargetList.ProtoReflect.Descriptor instead.

func (*TargetList) GetTarget

func (x *TargetList) GetTarget() []*Target

func (*TargetList) ProtoMessage

func (*TargetList) ProtoMessage()

func (*TargetList) ProtoReflect

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

func (*TargetList) Reset

func (x *TargetList) Reset()

func (*TargetList) String

func (x *TargetList) String() string

type UnimplementedLoadBalancerServer

type UnimplementedLoadBalancerServer struct {
}

UnimplementedLoadBalancerServer must be embedded to have forward compatible implementations.

func (UnimplementedLoadBalancerServer) AddTarget

func (UnimplementedLoadBalancerServer) Create

func (UnimplementedLoadBalancerServer) DelTarget

func (UnimplementedLoadBalancerServer) Delete

func (UnimplementedLoadBalancerServer) GetLoadBalancer

func (UnimplementedLoadBalancerServer) GetLoadBalancers

type UnsafeLoadBalancerServer

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

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

Jump to

Keyboard shortcuts

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