Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)
- type DeleteHostRequest
- type Describe
- func (*Describe) Descriptor() ([]byte, []int)deprecated
- func (x *Describe) GetCpu() int64
- func (x *Describe) GetGpuAmount() int64
- func (x *Describe) GetGpuSpec() string
- func (x *Describe) GetImageId() string
- func (x *Describe) GetInternetMaxBandwidthIn() int64
- func (x *Describe) GetInternetMaxBandwidthOut() int64
- func (x *Describe) GetKeyPairName() string
- func (x *Describe) GetMemory() int64
- func (x *Describe) GetOsName() string
- func (x *Describe) GetOsType() string
- func (x *Describe) GetSecurityGroups() string
- func (x *Describe) GetSerialNumber() string
- func (*Describe) ProtoMessage()
- func (x *Describe) ProtoReflect() protoreflect.Message
- func (x *Describe) Reset()
- func (x *Describe) String() string
- type DesribeHostRequest
- type Host
- func (*Host) Descriptor() ([]byte, []int)deprecated
- func (x *Host) GetDescribe() *Describe
- func (x *Host) GetDescribeHash() string
- func (x *Host) GetResource() *Resource
- func (x *Host) GetResourceHash() string
- func (h *Host) Patch(res *Resource, desc *Describe) error
- func (*Host) ProtoMessage()
- func (x *Host) ProtoReflect() protoreflect.Message
- func (x *Host) Reset()
- func (x *Host) String() string
- func (h *Host) Update(res *Resource, desc *Describe)
- func (h *Host) Validate() error
- type QueryHostRequest
- func (*QueryHostRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryHostRequest) GetKeywords() string
- func (x *QueryHostRequest) GetPageNumber() int64
- func (x *QueryHostRequest) GetPageSize() int64
- func (req *QueryHostRequest) Offset() int64
- func (*QueryHostRequest) ProtoMessage()
- func (x *QueryHostRequest) ProtoReflect() protoreflect.Message
- func (x *QueryHostRequest) Reset()
- func (x *QueryHostRequest) String() string
- type Resource
- func (*Resource) Descriptor() ([]byte, []int)deprecated
- func (x *Resource) GetCategory() string
- func (x *Resource) GetCreateAt() int64
- func (x *Resource) GetDescription() string
- func (x *Resource) GetExpireAt() int64
- func (x *Resource) GetId() string
- func (x *Resource) GetInstanceId() string
- func (x *Resource) GetName() string
- func (x *Resource) GetPayType() string
- func (x *Resource) GetPrivateIp() string
- func (x *Resource) GetPublicIp() string
- func (x *Resource) GetRegion() string
- func (x *Resource) GetStatus() string
- func (x *Resource) GetSyncAccout() string
- func (x *Resource) GetSyncAt() int64
- func (x *Resource) GetTags() map[string]string
- func (x *Resource) GetType() string
- func (x *Resource) GetUpdateAt() int64
- func (x *Resource) GetVendor() Vendor
- func (x *Resource) GetZone() string
- func (*Resource) ProtoMessage()
- func (x *Resource) ProtoReflect() protoreflect.Message
- func (x *Resource) Reset()
- func (x *Resource) String() string
- type ServiceClient
- type ServiceServer
- type Set
- type UnimplementedServiceServer
- func (UnimplementedServiceServer) CreateHost(context.Context, *Host) (*Host, error)
- func (UnimplementedServiceServer) DeleteHost(context.Context, *DeleteHostRequest) (*Host, error)
- func (UnimplementedServiceServer) DesribeHost(context.Context, *DesribeHostRequest) (*Host, error)
- func (UnimplementedServiceServer) QueryHost(context.Context, *QueryHostRequest) (*Set, error)
- func (UnimplementedServiceServer) UpdateHost(context.Context, *UpdateHostRequest) (*Host, error)
- type UnsafeServiceServer
- type UpdateHostRequest
- func (*UpdateHostRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateHostRequest) GetDescribe() *Describe
- func (x *UpdateHostRequest) GetResource() *Resource
- func (x *UpdateHostRequest) GetUpdateMode() UpdateMode
- func (*UpdateHostRequest) ProtoMessage()
- func (x *UpdateHostRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateHostRequest) Reset()
- func (x *UpdateHostRequest) String() string
- type UpdateMode
- type Vendor
Constants ¶
const (
AppName = "host"
)
Variables ¶
var ( Vendor_name = map[int32]string{ 0: "ALI_CLOUD", 1: "TX_CLOUD", 2: "HW_CLOUD", } Vendor_value = map[string]int32{ "ALI_CLOUD": 0, "TX_CLOUD": 1, "HW_CLOUD": 2, } )
Enum value maps for Vendor.
var ( UpdateMode_name = map[int32]string{ 0: "PUT", 1: "PATCH", } UpdateMode_value = map[string]int32{ "PUT": 0, "PATCH": 1, } )
Enum value maps for UpdateMode.
var File_apps_host_pb_host_proto protoreflect.FileDescriptor
var Service_ServiceDesc = grpc.ServiceDesc{ ServiceName: "demo.Service", HandlerType: (*ServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreateHost", Handler: _Service_CreateHost_Handler, }, { MethodName: "QueryHost", Handler: _Service_QueryHost_Handler, }, { MethodName: "DesribeHost", Handler: _Service_DesribeHost_Handler, }, { MethodName: "UpdateHost", Handler: _Service_UpdateHost_Handler, }, { MethodName: "DeleteHost", Handler: _Service_DeleteHost_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "apps/host/pb/host.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 DeleteHostRequest ¶
type DeleteHostRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*DeleteHostRequest) Descriptor
deprecated
func (*DeleteHostRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteHostRequest.ProtoReflect.Descriptor instead.
func (*DeleteHostRequest) GetId ¶
func (x *DeleteHostRequest) GetId() string
func (*DeleteHostRequest) ProtoMessage ¶
func (*DeleteHostRequest) ProtoMessage()
func (*DeleteHostRequest) ProtoReflect ¶
func (x *DeleteHostRequest) ProtoReflect() protoreflect.Message
func (*DeleteHostRequest) Reset ¶
func (x *DeleteHostRequest) Reset()
func (*DeleteHostRequest) String ¶
func (x *DeleteHostRequest) String() string
type Describe ¶
type Describe struct { // @gotags: json:"cpu" validate:"required" Cpu int64 `protobuf:"varint,1,opt,name=cpu,proto3" json:"cpu" validate:"required"` // 核数 // @gotags: json:"memory" validate:"required" Memory int64 `protobuf:"varint,2,opt,name=memory,proto3" json:"memory" validate:"required"` // 内存 // @gotags: json:"gpu_amount" GpuAmount int64 `protobuf:"varint,3,opt,name=gpu_amount,json=gpuAmount,proto3" json:"gpu_amount"` // GPU数量 // @gotags: json:"gpu_spec" GpuSpec string `protobuf:"bytes,4,opt,name=gpu_spec,json=gpuSpec,proto3" json:"gpu_spec"` // GPU类型 // @gotags: json:"os_type" OsType string `protobuf:"bytes,5,opt,name=os_type,json=osType,proto3" json:"os_type"` // 操作系统类型,分为Windows和Linux // @gotags: json:"os_name" OsName string `protobuf:"bytes,6,opt,name=os_name,json=osName,proto3" json:"os_name"` // 操作系统名称 // @gotags: json:"serial_number" SerialNumber string `protobuf:"bytes,7,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number"` // 序列号 // @gotags: json:"image_id" ImageId string `protobuf:"bytes,8,opt,name=image_id,json=imageId,proto3" json:"image_id"` // 镜像ID // @gotags: json:"internet_max_bandwidth_out" InternetMaxBandwidthOut int64 `protobuf:"varint,9,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,10,opt,name=internet_max_bandwidth_in,json=internetMaxBandwidthIn,proto3" json:"internet_max_bandwidth_in"` // 公网入带宽最大值,单位为 Mbps // @gotags: json:"key_pair_name" KeyPairName string `protobuf:"bytes,11,opt,name=key_pair_name,json=keyPairName,proto3" json:"key_pair_name"` // 秘钥对名称 // @gotags: json:"security_groups" SecurityGroups string `protobuf:"bytes,12,opt,name=security_groups,json=securityGroups,proto3" json:"security_groups"` // 安全组 采用逗号分隔 // contains filtered or unexported fields }
func (*Describe) Descriptor
deprecated
func (*Describe) GetGpuAmount ¶
func (*Describe) GetGpuSpec ¶
func (*Describe) GetImageId ¶
func (*Describe) GetInternetMaxBandwidthIn ¶
func (*Describe) GetInternetMaxBandwidthOut ¶
func (*Describe) GetKeyPairName ¶
func (*Describe) GetSecurityGroups ¶
func (*Describe) GetSerialNumber ¶
func (*Describe) ProtoMessage ¶
func (*Describe) ProtoMessage()
func (*Describe) ProtoReflect ¶
func (x *Describe) ProtoReflect() protoreflect.Message
type DesribeHostRequest ¶
type DesribeHostRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func NewDesribeHostRequestWithID ¶
func NewDesribeHostRequestWithID(id string) *DesribeHostRequest
func (*DesribeHostRequest) Descriptor
deprecated
func (*DesribeHostRequest) Descriptor() ([]byte, []int)
Deprecated: Use DesribeHostRequest.ProtoReflect.Descriptor instead.
func (*DesribeHostRequest) GetId ¶
func (x *DesribeHostRequest) GetId() string
func (*DesribeHostRequest) ProtoMessage ¶
func (*DesribeHostRequest) ProtoMessage()
func (*DesribeHostRequest) ProtoReflect ¶
func (x *DesribeHostRequest) ProtoReflect() protoreflect.Message
func (*DesribeHostRequest) Reset ¶
func (x *DesribeHostRequest) Reset()
func (*DesribeHostRequest) String ¶
func (x *DesribeHostRequest) String() string
type Host ¶
type Host struct { // @gotags: json:"resource_hash" ResourceHash string `protobuf:"bytes,1,opt,name=resource_hash,json=resourceHash,proto3" json:"resource_hash"` // @gotags: json:"describe_hash" DescribeHash string `protobuf:"bytes,2,opt,name=describe_hash,json=describeHash,proto3" json:"describe_hash"` // @gotags: json:"resource" Resource *Resource `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource"` // @gotags: json:"describe" Describe *Describe `protobuf:"bytes,4,opt,name=describe,proto3" json:"describe"` // contains filtered or unexported fields }
func NewDefaultHost ¶
func NewDefaultHost() *Host
func (*Host) Descriptor
deprecated
func (*Host) GetDescribe ¶
func (*Host) GetDescribeHash ¶
func (*Host) GetResource ¶
func (*Host) GetResourceHash ¶
func (*Host) ProtoMessage ¶
func (*Host) ProtoMessage()
func (*Host) ProtoReflect ¶
func (x *Host) ProtoReflect() protoreflect.Message
type QueryHostRequest ¶
type QueryHostRequest struct { PageSize int64 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` PageNumber int64 `protobuf:"varint,2,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"` Keywords string `protobuf:"bytes,3,opt,name=keywords,proto3" json:"keywords,omitempty"` // contains filtered or unexported fields }
func NewQueryHostRequest ¶
func NewQueryHostRequest() *QueryHostRequest
func (*QueryHostRequest) Descriptor
deprecated
func (*QueryHostRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryHostRequest.ProtoReflect.Descriptor instead.
func (*QueryHostRequest) GetKeywords ¶
func (x *QueryHostRequest) GetKeywords() string
func (*QueryHostRequest) GetPageNumber ¶
func (x *QueryHostRequest) GetPageNumber() int64
func (*QueryHostRequest) GetPageSize ¶
func (x *QueryHostRequest) GetPageSize() int64
func (*QueryHostRequest) Offset ¶
func (req *QueryHostRequest) Offset() int64
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 Resource ¶
type Resource struct { // @gotags: json:"id" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` // 全局唯一Id // @gotags: json:"vendor" Vendor Vendor `protobuf:"varint,2,opt,name=vendor,proto3,enum=demo.Vendor" json:"vendor"` // 厂商 // @gotags: json:"region" validate:"required" Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region" validate:"required"` // 地域 // @gotags: json:"zone" Zone string `protobuf:"bytes,4,opt,name=zone,proto3" json:"zone"` // 区域 // 使用13位的时间戳 // 为什么不只用Datetime, 如果使用数据的时间, 数据库会给你默认加上时区 // @gotags: json:"create_at" CreateAt int64 `protobuf:"varint,5,opt,name=create_at,json=createAt,proto3" json:"create_at"` // 创建时间 // @gotags: json:"expire_at" ExpireAt int64 `protobuf:"varint,6,opt,name=expire_at,json=expireAt,proto3" json:"expire_at"` // 过期时间 // @gotags: json:"category" Category string `protobuf:"bytes,7,opt,name=category,proto3" json:"category"` // 种类 // @gotags: json:"type" Type string `protobuf:"bytes,8,opt,name=type,proto3" json:"type"` // 规格 // @gotags: json:"instance_id" InstanceId string `protobuf:"bytes,9,opt,name=instance_id,json=instanceId,proto3" json:"instance_id"` // 实例ID // @gotags: json:"name" validate:"required" Name string `protobuf:"bytes,10,opt,name=name,proto3" json:"name" validate:"required"` // 名称 // @gotags: json:"description" Description string `protobuf:"bytes,11,opt,name=description,proto3" json:"description"` // 描述 // @gotags: json:"status" validate:"required" Status string `protobuf:"bytes,12,opt,name=status,proto3" json:"status" validate:"required"` // 服务商中的状态 // @gotags: json:"tags" Tags map[string]string `` // 标签 /* 140-byte string literal not displayed */ // @gotags: json:"update_at" UpdateAt int64 `protobuf:"varint,14,opt,name=update_at,json=updateAt,proto3" json:"update_at"` // 更新时间 // @gotags: json:"sync_at" SyncAt int64 `protobuf:"varint,15,opt,name=sync_at,json=syncAt,proto3" json:"sync_at"` // 同步时间 // @gotags: json:"sync_accout" SyncAccout string `protobuf:"bytes,16,opt,name=sync_accout,json=syncAccout,proto3" json:"sync_accout"` // 同步的账号 // @gotags: json:"public_ip" PublicIp string `protobuf:"bytes,17,opt,name=public_ip,json=publicIp,proto3" json:"public_ip"` // 公网IP // @gotags: json:"private_ip" validate:"required" PrivateIp string `protobuf:"bytes,18,opt,name=private_ip,json=privateIp,proto3" json:"private_ip" validate:"required"` // 内网IP // @gotags: json:"pay_type" PayType string `protobuf:"bytes,19,opt,name=pay_type,json=payType,proto3" json:"pay_type"` // 实例付费方式 // contains filtered or unexported fields }
func (*Resource) Descriptor
deprecated
func (*Resource) GetCategory ¶
func (*Resource) GetCreateAt ¶
func (*Resource) GetDescription ¶
func (*Resource) GetExpireAt ¶
func (*Resource) GetInstanceId ¶
func (*Resource) GetPayType ¶
func (*Resource) GetPrivateIp ¶
func (*Resource) GetPublicIp ¶
func (*Resource) GetSyncAccout ¶
func (*Resource) GetUpdateAt ¶
func (*Resource) ProtoMessage ¶
func (*Resource) ProtoMessage()
func (*Resource) ProtoReflect ¶
func (x *Resource) ProtoReflect() protoreflect.Message
type ServiceClient ¶
type ServiceClient interface { // 录入主机信息 CreateHost(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Host, error) // 查询主机列表信息 QueryHost(ctx context.Context, in *QueryHostRequest, opts ...grpc.CallOption) (*Set, error) // 主机详情查询 DesribeHost(ctx context.Context, in *DesribeHostRequest, opts ...grpc.CallOption) (*Host, error) // 主机信息修改 UpdateHost(ctx context.Context, in *UpdateHostRequest, opts ...grpc.CallOption) (*Host, error) // 删除主机, GRPC, delete event, DeleteHost(ctx context.Context, in *DeleteHostRequest, opts ...grpc.CallOption) (*Host, 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 { // 录入主机信息 CreateHost(context.Context, *Host) (*Host, error) // 查询主机列表信息 QueryHost(context.Context, *QueryHostRequest) (*Set, error) // 主机详情查询 DesribeHost(context.Context, *DesribeHostRequest) (*Host, error) // 主机信息修改 UpdateHost(context.Context, *UpdateHostRequest) (*Host, error) // 删除主机, GRPC, delete event, DeleteHost(context.Context, *DeleteHostRequest) (*Host, error) // contains filtered or unexported methods }
ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility
type Set ¶
type Set 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 (*Set) Descriptor
deprecated
func (*Set) ProtoMessage ¶
func (*Set) ProtoMessage()
func (*Set) ProtoReflect ¶
func (x *Set) ProtoReflect() protoreflect.Message
type UnimplementedServiceServer ¶
type UnimplementedServiceServer struct { }
UnimplementedServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedServiceServer) CreateHost ¶
func (UnimplementedServiceServer) DeleteHost ¶
func (UnimplementedServiceServer) DeleteHost(context.Context, *DeleteHostRequest) (*Host, error)
func (UnimplementedServiceServer) DesribeHost ¶
func (UnimplementedServiceServer) DesribeHost(context.Context, *DesribeHostRequest) (*Host, error)
func (UnimplementedServiceServer) QueryHost ¶
func (UnimplementedServiceServer) QueryHost(context.Context, *QueryHostRequest) (*Set, error)
func (UnimplementedServiceServer) UpdateHost ¶
func (UnimplementedServiceServer) UpdateHost(context.Context, *UpdateHostRequest) (*Host, error)
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.
type UpdateHostRequest ¶
type UpdateHostRequest struct { // @gotags: json:"update_mode" UpdateMode UpdateMode `protobuf:"varint,1,opt,name=update_mode,json=updateMode,proto3,enum=demo.UpdateMode" json:"update_mode"` // @gotags: json:"resource" Resource *Resource `protobuf:"bytes,2,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 NewPatchUpdateHostRequest ¶
func NewPatchUpdateHostRequest() *UpdateHostRequest
func NewPutUpdateHostRequest ¶
func NewPutUpdateHostRequest() *UpdateHostRequest
func (*UpdateHostRequest) Descriptor
deprecated
func (*UpdateHostRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateHostRequest.ProtoReflect.Descriptor instead.
func (*UpdateHostRequest) GetDescribe ¶
func (x *UpdateHostRequest) GetDescribe() *Describe
func (*UpdateHostRequest) GetResource ¶
func (x *UpdateHostRequest) GetResource() *Resource
func (*UpdateHostRequest) GetUpdateMode ¶
func (x *UpdateHostRequest) GetUpdateMode() UpdateMode
func (*UpdateHostRequest) ProtoMessage ¶
func (*UpdateHostRequest) ProtoMessage()
func (*UpdateHostRequest) ProtoReflect ¶
func (x *UpdateHostRequest) ProtoReflect() protoreflect.Message
func (*UpdateHostRequest) Reset ¶
func (x *UpdateHostRequest) Reset()
func (*UpdateHostRequest) String ¶
func (x *UpdateHostRequest) String() string
type UpdateMode ¶
type UpdateMode int32
const ( UpdateMode_PUT UpdateMode = 0 UpdateMode_PATCH UpdateMode = 1 )
func (UpdateMode) Descriptor ¶
func (UpdateMode) Descriptor() protoreflect.EnumDescriptor
func (UpdateMode) Enum ¶
func (x UpdateMode) Enum() *UpdateMode
func (UpdateMode) EnumDescriptor
deprecated
func (UpdateMode) EnumDescriptor() ([]byte, []int)
Deprecated: Use UpdateMode.Descriptor instead.
func (UpdateMode) Number ¶
func (x UpdateMode) Number() protoreflect.EnumNumber
func (UpdateMode) String ¶
func (x UpdateMode) String() string
func (UpdateMode) Type ¶
func (UpdateMode) Type() protoreflect.EnumType
type Vendor ¶
type Vendor int32
func (Vendor) Descriptor ¶
func (Vendor) Descriptor() protoreflect.EnumDescriptor
func (Vendor) EnumDescriptor
deprecated
func (Vendor) Number ¶
func (x Vendor) Number() protoreflect.EnumNumber
func (Vendor) Type ¶
func (Vendor) Type() protoreflect.EnumType