host

package
v0.0.0-...-6a8978f Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = "host"
)

Variables

View Source
var File_apps_host_pb_host_proto protoreflect.FileDescriptor
View Source
var File_apps_host_pb_rpc_proto protoreflect.FileDescriptor
View Source
var RPC_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "go8.devcloud.cmdb.host.RPC",
	HandlerType: (*RPCServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateHost",
			Handler:    _RPC_CreateHost_Handler,
		},
		{
			MethodName: "QueryHost",
			Handler:    _RPC_QueryHost_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/host/pb/rpc.proto",
}

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

Functions

func RegisterRPCServer

func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)

Types

type Host

type Host struct {

	// 通用定义
	// @gotags: json:"resource"
	Resource *resource.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource"`
	// 通用定义
	// @gotags: json:"spec"
	Spec *Spec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec"`
	// contains filtered or unexported fields
}

func NewDefaultHost

func NewDefaultHost() *Host

func (*Host) Descriptor deprecated

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

Deprecated: Use Host.ProtoReflect.Descriptor instead.

func (*Host) GetResource

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

func (*Host) GetSpec

func (x *Host) GetSpec() *Spec

func (*Host) ProtoMessage

func (*Host) ProtoMessage()

func (*Host) ProtoReflect

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

func (*Host) Reset

func (x *Host) Reset()

func (*Host) String

func (x *Host) String() string

type HostSet

type HostSet struct {

	// 数据
	// @gotags: json:"total"
	Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"`
	// 数据
	// @gotags: json:"items"
	Items []*Host `protobuf:"bytes,2,rep,name=items,proto3" json:"items"`
	// contains filtered or unexported fields
}

func NewHostSet

func NewHostSet() *HostSet

func (*HostSet) Add

func (s *HostSet) Add(item *Host)

func (*HostSet) Descriptor deprecated

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

Deprecated: Use HostSet.ProtoReflect.Descriptor instead.

func (*HostSet) GetItems

func (x *HostSet) GetItems() []*Host

func (*HostSet) GetTotal

func (x *HostSet) GetTotal() int64

func (*HostSet) Length

func (s *HostSet) Length() int

func (*HostSet) ProtoMessage

func (*HostSet) ProtoMessage()

func (*HostSet) ProtoReflect

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

func (*HostSet) Reset

func (x *HostSet) Reset()

func (*HostSet) String

func (x *HostSet) String() string

func (*HostSet) UpdateResource

func (s *HostSet) UpdateResource(rss ...*resource.Resource)

type QueryHostRequest

type QueryHostRequest struct {

	// 分页参数
	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// 主机资源Id列表
	// @gotags: json:"resource_ids"
	ResourceIds []string `protobuf:"bytes,2,rep,name=resource_ids,json=resourceIds,proto3" json:"resource_ids"`
	// contains filtered or unexported fields
}

func NeWQueryHostRequest

func NeWQueryHostRequest() *QueryHostRequest

func NewQueryHostRequestFromHTTP

func NewQueryHostRequestFromHTTP(r *http.Request) *QueryHostRequest

func (*QueryHostRequest) Descriptor deprecated

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

Deprecated: Use QueryHostRequest.ProtoReflect.Descriptor instead.

func (*QueryHostRequest) GetPage

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

func (*QueryHostRequest) GetResourceIds

func (x *QueryHostRequest) GetResourceIds() []string

func (*QueryHostRequest) ProtoMessage

func (*QueryHostRequest) ProtoMessage()

func (*QueryHostRequest) ProtoReflect

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

func (*QueryHostRequest) Reset

func (x *QueryHostRequest) Reset()

func (*QueryHostRequest) String

func (x *QueryHostRequest) String() string

type RPCClient

type RPCClient interface {
	CreateHost(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Host, error)
	QueryHost(ctx context.Context, in *QueryHostRequest, opts ...grpc.CallOption) (*HostSet, error)
}

RPCClient is the client API for RPC 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 NewRPCClient

func NewRPCClient(cc grpc.ClientConnInterface) RPCClient

type RPCServer

type RPCServer interface {
	CreateHost(context.Context, *Host) (*Host, error)
	QueryHost(context.Context, *QueryHostRequest) (*HostSet, error)
	// contains filtered or unexported methods
}

RPCServer is the server API for RPC service. All implementations must embed UnimplementedRPCServer for forward compatibility

type Service

type Service interface {
	RPCServer
}

type Spec

type Spec struct {

	// GPU类型
	// @gotags: json:"gpu_spec"
	GpuSpec string `protobuf:"bytes,2,opt,name=gpu_spec,json=gpuSpec,proto3" json:"gpu_spec"`
	// 操作系统类型,分为Windows和Linux
	// @gotags: json:"os_type"
	OsType string `protobuf:"bytes,3,opt,name=os_type,json=osType,proto3" json:"os_type"`
	// 操作系统名称
	// @gotags: json:"os_name"
	OsName string `protobuf:"bytes,4,opt,name=os_name,json=osName,proto3" json:"os_name"`
	// 镜像ID
	// @gotags: json:"image_id"
	ImageId string `protobuf:"bytes,5,opt,name=image_id,json=imageId,proto3" json:"image_id"`
	// 公网出带宽最大值,单位为 Mbps
	// @gotags: json:"internet_max_bandwidth_out"
	InternetMaxBandwidthOut int64 `protobuf:"varint,6,opt,name=internet_max_bandwidth_out,json=internetMaxBandwidthOut,proto3" json:"internet_max_bandwidth_out"`
	// 公网入带宽最大值,单位为 Mbps
	// @gotags: json:"internet_max_bandwidth_in"
	InternetMaxBandwidthIn int64 `protobuf:"varint,7,opt,name=internet_max_bandwidth_in,json=internetMaxBandwidthIn,proto3" json:"internet_max_bandwidth_in"`
	// contains filtered or unexported fields
}

func (*Spec) Descriptor deprecated

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

Deprecated: Use Spec.ProtoReflect.Descriptor instead.

func (*Spec) GetGpuSpec

func (x *Spec) GetGpuSpec() string

func (*Spec) GetImageId

func (x *Spec) GetImageId() string

func (*Spec) GetInternetMaxBandwidthIn

func (x *Spec) GetInternetMaxBandwidthIn() int64

func (*Spec) GetInternetMaxBandwidthOut

func (x *Spec) GetInternetMaxBandwidthOut() int64

func (*Spec) GetOsName

func (x *Spec) GetOsName() string

func (*Spec) GetOsType

func (x *Spec) GetOsType() string

func (*Spec) ProtoMessage

func (*Spec) ProtoMessage()

func (*Spec) ProtoReflect

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

func (*Spec) Reset

func (x *Spec) Reset()

func (*Spec) String

func (x *Spec) String() string

type UnimplementedRPCServer

type UnimplementedRPCServer struct {
}

UnimplementedRPCServer must be embedded to have forward compatible implementations.

func (UnimplementedRPCServer) CreateHost

func (UnimplementedRPCServer) QueryHost

type UnsafeRPCServer

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

UnsafeRPCServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RPCServer 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