lb

package
v0.0.0-...-7aae7b9 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: MIT Imports: 14 Imported by: 0

README

负载均衡管理

统一状态

各云商状态

阿里云: API 文档

  • inactive: 实例已停止,此状态的实例监听不会再转发流量。
  • active: 实例运行中,实例创建后,默认状态为active。
  • locked: 实例已锁定。当负载均衡实例到期后,但到期时间未超过7天时,负载均衡实例进入锁定状态。此种状态下,您不能对负载均衡实例进行任何操作,并且实例不再会进行流量转发,但会保留实例的IP和其它配置。

腾讯云: LoadBalancer数据结构 0:创建中 1:正常运行。

华为云: API 文档

  • ONLINE
  • FROZEN
统一后状态
  • PENDING:表示创建中
  • RUNNING:表示运行中
  • LOCKED: 实例已锁定

Documentation

Index

Constants

View Source
const (
	AppName = "lb"
)

Variables

View Source
var (
	STATUS_name = map[int32]string{
		0:  "UNKNOW",
		5:  "PENDING",
		6:  "CREATE_FAILED",
		11: "RUNNING",
		70: "LOCKED",
		80: "STOPPED",
		81: "DELETING",
		90: "DESTROYED",
	}
	STATUS_value = map[string]int32{
		"UNKNOW":        0,
		"PENDING":       5,
		"CREATE_FAILED": 6,
		"RUNNING":       11,
		"LOCKED":        70,
		"STOPPED":       80,
		"DELETING":      81,
		"DESTROYED":     90,
	}
)

Enum value maps for STATUS.

View Source
var File_apps_lb_pb_lb_proto protoreflect.FileDescriptor
View Source
var File_apps_lb_pb_rpc_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "infraboard.cmdb.slb.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SyncSLB",
			Handler:    _Service_SyncSLB_Handler,
		},
		{
			MethodName: "QuerySLB",
			Handler:    _Service_QuerySLB_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/lb/pb/rpc.proto",
}

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

Functions

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type Describe

type Describe struct {

	// 负载均衡实例的域名,仅公网传统型负载均衡实例才提供该字段
	// @gotags: json:"domain"
	Domain string `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain"`
	// 状态变化的时间
	// @gotags: json:"status_at"
	StatusAt int64 `protobuf:"varint,2,opt,name=status_at,json=statusAt,proto3" json:"status_at"`
	// IP版本,可以设置为ipv4或者ipv6
	// @gotags: json:"ip_version"
	IpVersion string `protobuf:"bytes,3,opt,name=ip_version,json=ipVersion,proto3" json:"ip_version"`
	// 私网负载均衡实例的网络类型 vpc:专有网络实例 classic:经典网络实例
	// @gotags: json:"network_type"
	NetworkType string `protobuf:"bytes,4,opt,name=network_type,json=networkType,proto3" json:"network_type"`
	// 带宽
	// @gotags: json:"band_width"
	BandWidth int32 `protobuf:"varint,5,opt,name=band_width,json=bandWidth,proto3" json:"band_width"`
	// contains filtered or unexported fields
}

func (*Describe) Descriptor deprecated

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

Deprecated: Use Describe.ProtoReflect.Descriptor instead.

func (*Describe) GetBandWidth

func (x *Describe) GetBandWidth() int32

func (*Describe) GetDomain

func (x *Describe) GetDomain() string

func (*Describe) GetIpVersion

func (x *Describe) GetIpVersion() string

func (*Describe) GetNetworkType

func (x *Describe) GetNetworkType() string

func (*Describe) GetStatusAt

func (x *Describe) GetStatusAt() int64

func (*Describe) ProtoMessage

func (*Describe) ProtoMessage()

func (*Describe) ProtoReflect

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

func (*Describe) Reset

func (x *Describe) Reset()

func (*Describe) String

func (x *Describe) String() string

type LoadBalancer

type LoadBalancer struct {

	// @gotags: json:"resource"
	Resource *resource.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource"`
	// @gotags: json:"describe"
	Describe *Describe `protobuf:"bytes,3,opt,name=describe,proto3" json:"describe"`
	// contains filtered or unexported fields
}

func NewDefaultLoadBalancer

func NewDefaultLoadBalancer() *LoadBalancer

func (*LoadBalancer) Descriptor deprecated

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

Deprecated: Use LoadBalancer.ProtoReflect.Descriptor instead.

func (*LoadBalancer) GetDescribe

func (x *LoadBalancer) GetDescribe() *Describe

func (*LoadBalancer) GetResource

func (x *LoadBalancer) GetResource() *resource.Resource

func (*LoadBalancer) ProtoMessage

func (*LoadBalancer) ProtoMessage()

func (*LoadBalancer) ProtoReflect

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

func (*LoadBalancer) Reset

func (x *LoadBalancer) Reset()

func (*LoadBalancer) String

func (x *LoadBalancer) String() string

type LoadBalancerSet

type LoadBalancerSet struct {

	// 列表项
	Items []*LoadBalancer `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 NewLoadBalancerSet

func NewLoadBalancerSet() *LoadBalancerSet

func (*LoadBalancerSet) Add

func (s *LoadBalancerSet) Add(items ...any)

func (*LoadBalancerSet) Descriptor deprecated

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

Deprecated: Use LoadBalancerSet.ProtoReflect.Descriptor instead.

func (*LoadBalancerSet) GetItems

func (x *LoadBalancerSet) GetItems() []*LoadBalancer

func (*LoadBalancerSet) GetLast

func (s *LoadBalancerSet) GetLast() *LoadBalancer

func (*LoadBalancerSet) GetTotal

func (x *LoadBalancerSet) GetTotal() int64

func (*LoadBalancerSet) Length

func (s *LoadBalancerSet) Length() int64

func (*LoadBalancerSet) ProtoMessage

func (*LoadBalancerSet) ProtoMessage()

func (*LoadBalancerSet) ProtoReflect

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

func (*LoadBalancerSet) Reset

func (x *LoadBalancerSet) Reset()

func (*LoadBalancerSet) ResourceIds

func (s *LoadBalancerSet) ResourceIds() (ids []string)

func (*LoadBalancerSet) String

func (x *LoadBalancerSet) String() string

func (*LoadBalancerSet) ToAny

func (s *LoadBalancerSet) ToAny() (items []any)

func (*LoadBalancerSet) ToJsonString

func (s *LoadBalancerSet) ToJsonString() string

type QuerySLBRequest

type QuerySLBRequest struct {

	// 分页参数
	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// contains filtered or unexported fields
}

func (*QuerySLBRequest) Descriptor deprecated

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

Deprecated: Use QuerySLBRequest.ProtoReflect.Descriptor instead.

func (*QuerySLBRequest) GetPage

func (x *QuerySLBRequest) GetPage() *request.PageRequest

func (*QuerySLBRequest) ProtoMessage

func (*QuerySLBRequest) ProtoMessage()

func (*QuerySLBRequest) ProtoReflect

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

func (*QuerySLBRequest) Reset

func (x *QuerySLBRequest) Reset()

func (*QuerySLBRequest) String

func (x *QuerySLBRequest) String() string

type STATUS

type STATUS int32
const (
	// 未知状态
	STATUS_UNKNOW STATUS = 0
	// 表示创建中
	STATUS_PENDING STATUS = 5
	// 表示创建失败
	STATUS_CREATE_FAILED STATUS = 6
	// 表示运行中
	STATUS_RUNNING STATUS = 11
	// 表示实例已经锁定
	STATUS_LOCKED STATUS = 70
	// 表示停止
	STATUS_STOPPED STATUS = 80
	// 表示销毁中
	STATUS_DELETING STATUS = 81
	// 已销毁
	STATUS_DESTROYED STATUS = 90
)

func ParseSTATUSFromString

func ParseSTATUSFromString(str string) (STATUS, error)

ParseSTATUSFromString Parse STATUS from string

func (STATUS) Descriptor

func (STATUS) Descriptor() protoreflect.EnumDescriptor

func (STATUS) Enum

func (x STATUS) Enum() *STATUS

func (STATUS) EnumDescriptor deprecated

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

Deprecated: Use STATUS.Descriptor instead.

func (STATUS) Equal

func (t STATUS) Equal(target STATUS) bool

Equal type compare

func (STATUS) IsIn

func (t STATUS) IsIn(targets ...STATUS) bool

IsIn todo

func (STATUS) MarshalJSON

func (t STATUS) MarshalJSON() ([]byte, error)

MarshalJSON todo

func (STATUS) Number

func (x STATUS) Number() protoreflect.EnumNumber

func (STATUS) String

func (x STATUS) String() string

func (STATUS) Type

func (STATUS) Type() protoreflect.EnumType

func (*STATUS) UnmarshalJSON

func (t *STATUS) UnmarshalJSON(b []byte) error

UnmarshalJSON todo

type ServiceClient

type ServiceClient interface {
	SyncSLB(ctx context.Context, in *LoadBalancer, opts ...grpc.CallOption) (*LoadBalancer, error)
	QuerySLB(ctx context.Context, in *QuerySLBRequest, opts ...grpc.CallOption) (*LoadBalancer, error)
}

ServiceClient is the client API for Service 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.

func NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	SyncSLB(context.Context, *LoadBalancer) (*LoadBalancer, error)
	QuerySLB(context.Context, *QuerySLBRequest) (*LoadBalancer, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) QuerySLB

func (UnimplementedServiceServer) SyncSLB

type UnsafeServiceServer

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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