Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)
- type Host
- type HostSet
- func (s *HostSet) Add(item *Host)
- func (*HostSet) Descriptor() ([]byte, []int)deprecated
- func (x *HostSet) GetItems() []*Host
- func (x *HostSet) GetTotal() int64
- func (s *HostSet) Length() int
- func (*HostSet) ProtoMessage()
- func (x *HostSet) ProtoReflect() protoreflect.Message
- func (x *HostSet) Reset()
- func (x *HostSet) String() string
- func (s *HostSet) UpdateResource(rss ...*resource.Resource)
- type QueryHostRequest
- func (*QueryHostRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryHostRequest) GetPage() *request.PageRequest
- func (x *QueryHostRequest) GetResourceIds() []string
- func (*QueryHostRequest) ProtoMessage()
- func (x *QueryHostRequest) ProtoReflect() protoreflect.Message
- func (x *QueryHostRequest) Reset()
- func (x *QueryHostRequest) String() string
- type RPCClient
- type RPCServer
- type Service
- type Spec
- func (*Spec) Descriptor() ([]byte, []int)deprecated
- func (x *Spec) GetGpuSpec() string
- func (x *Spec) GetImageId() string
- func (x *Spec) GetInternetMaxBandwidthIn() int64
- func (x *Spec) GetInternetMaxBandwidthOut() int64
- func (x *Spec) GetOsName() string
- func (x *Spec) GetOsType() string
- func (*Spec) ProtoMessage()
- func (x *Spec) ProtoReflect() protoreflect.Message
- func (x *Spec) Reset()
- func (x *Spec) String() string
- type UnimplementedRPCServer
- type UnsafeRPCServer
Constants ¶
const (
AppName = "host"
)
Variables ¶
var File_apps_host_pb_host_proto protoreflect.FileDescriptor
var File_apps_host_pb_rpc_proto protoreflect.FileDescriptor
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) GetResource ¶
func (*Host) ProtoMessage ¶
func (*Host) ProtoMessage()
func (*Host) ProtoReflect ¶
func (x *Host) ProtoReflect() protoreflect.Message
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) Descriptor
deprecated
func (*HostSet) ProtoMessage ¶
func (*HostSet) ProtoMessage()
func (*HostSet) ProtoReflect ¶
func (x *HostSet) ProtoReflect() protoreflect.Message
func (*HostSet) UpdateResource ¶
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 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) GetGpuSpec ¶
func (*Spec) GetImageId ¶
func (*Spec) GetInternetMaxBandwidthIn ¶
func (*Spec) GetInternetMaxBandwidthOut ¶
func (*Spec) ProtoMessage ¶
func (*Spec) ProtoMessage()
func (*Spec) ProtoReflect ¶
func (x *Spec) ProtoReflect() protoreflect.Message
type UnimplementedRPCServer ¶
type UnimplementedRPCServer struct { }
UnimplementedRPCServer must be embedded to have forward compatible implementations.
func (UnimplementedRPCServer) CreateHost ¶
func (UnimplementedRPCServer) QueryHost ¶
func (UnimplementedRPCServer) QueryHost(context.Context, *QueryHostRequest) (*HostSet, error)
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.