host

package
v0.0.0-...-10437d4 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = "host"
)

Variables

View Source
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.

View Source
var (
	UpdateMode_name = map[int32]string{
		0: "PUT",
		1: "PATCH",
	}
	UpdateMode_value = map[string]int32{
		"PUT":   0,
		"PATCH": 1,
	}
)

Enum value maps for UpdateMode.

View Source
var File_apps_host_pb_host_proto protoreflect.FileDescriptor
View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use Describe.ProtoReflect.Descriptor instead.

func (*Describe) GetCpu

func (x *Describe) GetCpu() int64

func (*Describe) GetGpuAmount

func (x *Describe) GetGpuAmount() int64

func (*Describe) GetGpuSpec

func (x *Describe) GetGpuSpec() string

func (*Describe) GetImageId

func (x *Describe) GetImageId() string

func (*Describe) GetInternetMaxBandwidthIn

func (x *Describe) GetInternetMaxBandwidthIn() int64

func (*Describe) GetInternetMaxBandwidthOut

func (x *Describe) GetInternetMaxBandwidthOut() int64

func (*Describe) GetKeyPairName

func (x *Describe) GetKeyPairName() string

func (*Describe) GetMemory

func (x *Describe) GetMemory() int64

func (*Describe) GetOsName

func (x *Describe) GetOsName() string

func (*Describe) GetOsType

func (x *Describe) GetOsType() string

func (*Describe) GetSecurityGroups

func (x *Describe) GetSecurityGroups() string

func (*Describe) GetSerialNumber

func (x *Describe) GetSerialNumber() string

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 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) Descriptor() ([]byte, []int)

Deprecated: Use Host.ProtoReflect.Descriptor instead.

func (*Host) GetDescribe

func (x *Host) GetDescribe() *Describe

func (*Host) GetDescribeHash

func (x *Host) GetDescribeHash() string

func (*Host) GetResource

func (x *Host) GetResource() *Resource

func (*Host) GetResourceHash

func (x *Host) GetResourceHash() string

func (*Host) Patch

func (h *Host) Patch(res *Resource, desc *Describe) error

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

func (*Host) Update

func (h *Host) Update(res *Resource, desc *Describe)

go 1.17 允许获取毫秒

func (*Host) Validate

func (h *Host) Validate() error

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) Descriptor() ([]byte, []int)

Deprecated: Use Resource.ProtoReflect.Descriptor instead.

func (*Resource) GetCategory

func (x *Resource) GetCategory() string

func (*Resource) GetCreateAt

func (x *Resource) GetCreateAt() int64

func (*Resource) GetDescription

func (x *Resource) GetDescription() string

func (*Resource) GetExpireAt

func (x *Resource) GetExpireAt() int64

func (*Resource) GetId

func (x *Resource) GetId() string

func (*Resource) GetInstanceId

func (x *Resource) GetInstanceId() string

func (*Resource) GetName

func (x *Resource) GetName() string

func (*Resource) GetPayType

func (x *Resource) GetPayType() string

func (*Resource) GetPrivateIp

func (x *Resource) GetPrivateIp() string

func (*Resource) GetPublicIp

func (x *Resource) GetPublicIp() string

func (*Resource) GetRegion

func (x *Resource) GetRegion() string

func (*Resource) GetStatus

func (x *Resource) GetStatus() string

func (*Resource) GetSyncAccout

func (x *Resource) GetSyncAccout() string

func (*Resource) GetSyncAt

func (x *Resource) GetSyncAt() int64

func (*Resource) GetTags

func (x *Resource) GetTags() map[string]string

func (*Resource) GetType

func (x *Resource) GetType() string

func (*Resource) GetUpdateAt

func (x *Resource) GetUpdateAt() int64

func (*Resource) GetVendor

func (x *Resource) GetVendor() Vendor

func (*Resource) GetZone

func (x *Resource) GetZone() string

func (*Resource) ProtoMessage

func (*Resource) ProtoMessage()

func (*Resource) ProtoReflect

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

func (*Resource) Reset

func (x *Resource) Reset()

func (*Resource) String

func (x *Resource) String() string

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 NewSet

func NewSet() *Set

func (*Set) Add

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

func (*Set) Descriptor deprecated

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

Deprecated: Use Set.ProtoReflect.Descriptor instead.

func (*Set) GetItems

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

func (*Set) GetTotal

func (x *Set) GetTotal() int64

func (*Set) ProtoMessage

func (*Set) ProtoMessage()

func (*Set) ProtoReflect

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

func (*Set) Reset

func (x *Set) Reset()

func (*Set) String

func (x *Set) String() string

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) CreateHost

func (UnimplementedServiceServer) DeleteHost

func (UnimplementedServiceServer) DesribeHost

func (UnimplementedServiceServer) QueryHost

func (UnimplementedServiceServer) UpdateHost

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

type Vendor

type Vendor int32
const (
	Vendor_ALI_CLOUD Vendor = 0
	Vendor_TX_CLOUD  Vendor = 1
	Vendor_HW_CLOUD  Vendor = 2
)

func (Vendor) Descriptor

func (Vendor) Descriptor() protoreflect.EnumDescriptor

func (Vendor) Enum

func (x Vendor) Enum() *Vendor

func (Vendor) EnumDescriptor deprecated

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

Deprecated: Use Vendor.Descriptor instead.

func (Vendor) Number

func (x Vendor) Number() protoreflect.EnumNumber

func (Vendor) String

func (x Vendor) String() string

func (Vendor) Type

func (Vendor) Type() protoreflect.EnumType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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