resource

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: 19 Imported by: 0

README

资源管理

资源的统一搜索

资源关系

资源付费模式

阿里云:

  • Subscription:预付费。
  • PayAsYouGo:后付费。
  • PrePaid:包年包月。
  • PostPaid:按量付费

腾讯云:

  • prePay
  • postPay

华为云:

  • 1:包年/包月
  • 3:按需
  • 10:预留实例

统一为:

  • PRE_PAY:包年包月。
  • POST_PAY:按量付费

资源标签管理

应用标签

应用在部署时 需要申请对应的资源, 申请完成后 需要补充标签:

比如 deploy

  • deploy = "app1-v1"
  • deploy = "app2-v1"
监控标签

我们使用2个标签:

  • prometheus.io/node/enabled = "true" meta:{"point": "9100:/metrics"}
  • prometheus.io/appv1/enabled = "true" meta:{"point": "9100:/metrics"}

比如搜索 prometheus.io/%/enabled = "true"

[
    {
        "targets": ["10.0.10.2:9100", "10.0.10.3:9100", "10.0.10.4:9100", "10.0.10.5:9100"],
        "labels": {
            "domain": "admin",
            "namespace": "default",
            "env": "prod",
            "accout": "acount11",
            "vendor": "ali_yun",
            "region": "hangzou",
            "instance_id":"ins-xxxxx"
        }
    },
    ...
]

资源生命周期管理

资源申请
资源释放逻辑

create cluster app-v1 devcloud.com/deploy = app-v1 [h1, h2, bucket1, mysql01, dba]

资源状态

  • 3天的 滞留期, 资源无人使用的最大窗口,
  • 超过3天都未使用, 将进入待观察期(4天), 资源会停止服务
  • 当资源超过观察期都还未有人处理,会直接释放, 并记录资源状态 (记录保存期,365天)

Documentation

Index

Constants

View Source
const (
	PROMETHEUS_SCRAPE = "prometheus.io/%/enabled"
	PROMETHEUS_PORT   = "prometheus.io/%s/port"
	PROMETHEUS_PATH   = "prometheus.io/%s/path"
)
View Source
const (
	Operator_EQUAL          = "="
	Operator_NOT_EQUAL      = "!="
	Operator_LIKE_EQUAL     = "=~"
	Operator_NOT_LIKE_EQUAL = "!~"
)
View Source
const (
	AppName = "resource"
)

Variables

View Source
var (
	VENDOR_name = map[int32]string{
		0: "ALIYUN",
		1: "TENCENT",
		2: "HUAWEI",
		3: "VSPHERE",
		4: "AMAZON",
	}
	VENDOR_value = map[string]int32{
		"ALIYUN":  0,
		"TENCENT": 1,
		"HUAWEI":  2,
		"VSPHERE": 3,
		"AMAZON":  4,
	}
)

Enum value maps for VENDOR.

View Source
var (
	TYPE_name = map[int32]string{
		0:   "HOST",
		1:   "RDS",
		2:   "REDIS",
		3:   "BUCKET",
		4:   "DISK",
		5:   "LB",
		6:   "DOMAIN",
		7:   "EIP",
		8:   "MONGODB",
		100: "DATABASE",
		101: "ACCOUNT",
		199: "OTHER",
		200: "BILL",
		201: "ORDER",
	}
	TYPE_value = map[string]int32{
		"HOST":     0,
		"RDS":      1,
		"REDIS":    2,
		"BUCKET":   3,
		"DISK":     4,
		"LB":       5,
		"DOMAIN":   6,
		"EIP":      7,
		"MONGODB":  8,
		"DATABASE": 100,
		"ACCOUNT":  101,
		"OTHER":    199,
		"BILL":     200,
		"ORDER":    201,
	}
)

Enum value maps for TYPE.

View Source
var (
	PAY_MODE_name = map[int32]string{
		0: "PRE_PAY",
		1: "POST_PAY",
		2: "RESERVED_PAY",
		3: "SPOT_PAY",
		9: "NULL",
	}
	PAY_MODE_value = map[string]int32{
		"PRE_PAY":      0,
		"POST_PAY":     1,
		"RESERVED_PAY": 2,
		"SPOT_PAY":     3,
		"NULL":         9,
	}
)

Enum value maps for PAY_MODE.

View Source
var (
	USAGE_MODE_name = map[int32]string{
		0: "SHARED",
		1: "MONOPOLY",
	}
	USAGE_MODE_value = map[string]int32{
		"SHARED":   0,
		"MONOPOLY": 1,
	}
)

Enum value maps for USAGE_MODE.

View Source
var (
	TAG_PURPOSE_name = map[int32]string{
		0: "GROUP",
		1: "SYSTEM",
		2: "MONITOR",
		3: "THIRDPARTY",
	}
	TAG_PURPOSE_value = map[string]int32{
		"GROUP":      0,
		"SYSTEM":     1,
		"MONITOR":    2,
		"THIRDPARTY": 3,
	}
)

Enum value maps for TAG_PURPOSE.

View Source
var (
	UpdateAction_name = map[int32]string{
		0: "ADD",
		1: "REMOVE",
	}
	UpdateAction_value = map[string]int32{
		"ADD":    0,
		"REMOVE": 1,
	}
)

Enum value maps for UpdateAction.

View Source
var File_apps_resource_pb_resource_proto protoreflect.FileDescriptor
View Source
var File_apps_resource_pb_rpc_proto protoreflect.FileDescriptor
View Source
var RPC_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "infraboard.cmdb.resource.RPC",
	HandlerType: (*RPCServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Search",
			Handler:    _RPC_Search_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/resource/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 GenResourceHashId

func GenResourceHashId(t TYPE, unitkeys ...string) string

GenResourceHashId 生成资源的短hashId

func RegisterRPCServer

func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)

Types

type AccountGetter

type AccountGetter struct {
	// contains filtered or unexported fields
}

func (*AccountGetter) GetAccountId

func (ag *AccountGetter) GetAccountId() string

func (*AccountGetter) WithAccountId

func (ag *AccountGetter) WithAccountId(id string)

type ContentHash

type ContentHash struct {

	// 规格数据Hash
	// @gotags: json:"spec_hash"
	SpecHash string `protobuf:"bytes,1,opt,name=spec_hash,json=specHash,proto3" json:"spec_hash"`
	// 费用数据Hash
	// @gotags: json:"cost_hash"
	CostHash string `protobuf:"bytes,2,opt,name=cost_hash,json=costHash,proto3" json:"cost_hash"`
	// 状态数据Hash
	// @gotags: json:"status_hash"
	StatusHash string `protobuf:"bytes,3,opt,name=status_hash,json=statusHash,proto3" json:"status_hash"`
	// 标签数据Hash
	// @gotags: json:"tag_hash"
	TagHash string `protobuf:"bytes,4,opt,name=tag_hash,json=tagHash,proto3" json:"tag_hash"`
	// 关系数据Hash
	// @gotags: json:"relation_hash"
	RelationHash string `protobuf:"bytes,5,opt,name=relation_hash,json=relationHash,proto3" json:"relation_hash"`
	// 资源自定义属性Hash
	// @gotags: json:"custom_hash"
	CustomHash string `protobuf:"bytes,6,opt,name=custom_hash,json=customHash,proto3" json:"custom_hash"`
	// contains filtered or unexported fields
}

func (*ContentHash) Descriptor deprecated

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

Deprecated: Use ContentHash.ProtoReflect.Descriptor instead.

func (*ContentHash) GetCostHash

func (x *ContentHash) GetCostHash() string

func (*ContentHash) GetCustomHash

func (x *ContentHash) GetCustomHash() string

func (*ContentHash) GetRelationHash

func (x *ContentHash) GetRelationHash() string

func (*ContentHash) GetSpecHash

func (x *ContentHash) GetSpecHash() string

func (*ContentHash) GetStatusHash

func (x *ContentHash) GetStatusHash() string

func (*ContentHash) GetTagHash

func (x *ContentHash) GetTagHash() string

func (*ContentHash) ProtoMessage

func (*ContentHash) ProtoMessage()

func (*ContentHash) ProtoReflect

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

func (*ContentHash) Reset

func (x *ContentHash) Reset()

func (*ContentHash) String

func (x *ContentHash) String() string

type Cost

type Cost struct {

	// 实例付费方式
	// @gotags: json:"pay_mode"
	PayMode PAY_MODE `protobuf:"varint,1,opt,name=pay_mode,json=payMode,proto3,enum=infraboard.cmdb.resource.PAY_MODE" json:"pay_mode"`
	// 付费方式详情
	// @gotags: json:"pay_mode_detail"
	PayModeDetail string `protobuf:"bytes,2,opt,name=pay_mode_detail,json=payModeDetail,proto3" json:"pay_mode_detail"`
	// 官网价,原价(分)
	// @gotags: json:"sale_price"
	SalePrice float64 `protobuf:"fixed64,3,opt,name=sale_price,json=salePrice,proto3" json:"sale_price"`
	// 实际支付金额(分)
	// @gotags: json:"real_cost"
	RealCost float64 `protobuf:"fixed64,4,opt,name=real_cost,json=realCost,proto3" json:"real_cost"`
	// 折扣率
	// @gotags: json:"policy"
	Policy float64 `protobuf:"fixed64,5,opt,name=policy,proto3" json:"policy"`
	// 单价(分)
	// @gotags: json:"unit_price"
	UnitPrice float64 `protobuf:"fixed64,6,opt,name=unit_price,json=unitPrice,proto3" json:"unit_price"`
	// contains filtered or unexported fields
}

资产价格, 包年包月 记录月

func (*Cost) Descriptor deprecated

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

Deprecated: Use Cost.ProtoReflect.Descriptor instead.

func (*Cost) GetPayMode

func (x *Cost) GetPayMode() PAY_MODE

func (*Cost) GetPayModeDetail

func (x *Cost) GetPayModeDetail() string

func (*Cost) GetPolicy

func (x *Cost) GetPolicy() float64

func (*Cost) GetRealCost

func (x *Cost) GetRealCost() float64

func (*Cost) GetSalePrice

func (x *Cost) GetSalePrice() float64

func (*Cost) GetUnitPrice

func (x *Cost) GetUnitPrice() float64

func (*Cost) ProtoMessage

func (*Cost) ProtoMessage()

func (*Cost) ProtoReflect

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

func (*Cost) Reset

func (x *Cost) Reset()

func (*Cost) String

func (x *Cost) String() string

type DeleteRecord

type DeleteRecord struct {

	// 资源Id
	// @gotags: json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
	// 资源描述
	// @gotags: json:"describe"
	Describe string `protobuf:"bytes,2,opt,name=describe,proto3" json:"describe"`
	// 资源是否删除成功
	// @gotags: json:"success"
	Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success"`
	// 删除失败的原因
	// @gotags: json:"reason"
	Reason string `protobuf:"bytes,4,opt,name=reason,proto3" json:"reason"`
	// contains filtered or unexported fields
}

func (*DeleteRecord) Descriptor deprecated

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

Deprecated: Use DeleteRecord.ProtoReflect.Descriptor instead.

func (*DeleteRecord) GetDescribe

func (x *DeleteRecord) GetDescribe() string

func (*DeleteRecord) GetId

func (x *DeleteRecord) GetId() string

func (*DeleteRecord) GetReason

func (x *DeleteRecord) GetReason() string

func (*DeleteRecord) GetSuccess

func (x *DeleteRecord) GetSuccess() bool

func (*DeleteRecord) ProtoMessage

func (*DeleteRecord) ProtoMessage()

func (*DeleteRecord) ProtoReflect

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

func (*DeleteRecord) Reset

func (x *DeleteRecord) Reset()

func (*DeleteRecord) String

func (x *DeleteRecord) String() string

type DeleteRequest

type DeleteRequest struct {

	// 资源Id列表
	// @gotags: json:"resource_ids"
	ResourceIds []string `protobuf:"bytes,1,rep,name=resource_ids,json=resourceIds,proto3" json:"resource_ids"`
	// contains filtered or unexported fields
}

func (*DeleteRequest) Descriptor deprecated

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetResourceIds

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

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

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

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

func (*DeleteRequest) Validate

func (r *DeleteRequest) Validate() error

type DeleteResponse

type DeleteResponse struct {

	// 删除记录
	// @gotags: json:"delete_records"
	DeleteRecords []*DeleteRecord `protobuf:"bytes,1,rep,name=delete_records,json=deleteRecords,proto3" json:"delete_records"`
	// 删除失败统计
	// @gotags: json:"failed_count"
	FailedCount int64 `protobuf:"varint,2,opt,name=failed_count,json=failedCount,proto3" json:"failed_count"`
	// 删除成功统计
	// @gotags: json:"success_count"
	SuccessCount int64 `protobuf:"varint,3,opt,name=success_count,json=successCount,proto3" json:"success_count"`
	// contains filtered or unexported fields
}

func (*DeleteResponse) Descriptor deprecated

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

Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.

func (*DeleteResponse) GetDeleteRecords

func (x *DeleteResponse) GetDeleteRecords() []*DeleteRecord

func (*DeleteResponse) GetFailedCount

func (x *DeleteResponse) GetFailedCount() int64

func (*DeleteResponse) GetSuccessCount

func (x *DeleteResponse) GetSuccessCount() int64

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) ProtoReflect

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

func (*DeleteResponse) Reset

func (x *DeleteResponse) Reset()

func (*DeleteResponse) String

func (x *DeleteResponse) String() string

type Meta

type Meta struct {

	// 全局唯一Id, 直接使用个云商自己的Id
	// @gotags: json:"id" validate:"required"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" validate:"required"`
	// 资源所属域
	// @gotags: json:"domain" validate:"required"
	Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain" validate:"required"`
	// 资源所属空间
	// @gotags: json:"namespace" validate:"required"
	Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace" validate:"required"`
	// 资源所属环境
	// @gotags: json:"env"
	Env string `protobuf:"bytes,4,opt,name=env,proto3" json:"env"`
	// 创建时间
	// @gotags: json:"create_at"
	CreateAt int64 `protobuf:"varint,5,opt,name=create_at,json=createAt,proto3" json:"create_at"`
	// 删除时间
	// @gotags: json:"detete_at"
	DeteteAt int64 `protobuf:"varint,6,opt,name=detete_at,json=deteteAt,proto3" json:"detete_at"`
	// 删除人
	// @gotags: json:"detete_by"
	DeteteBy string `protobuf:"bytes,7,opt,name=detete_by,json=deteteBy,proto3" json:"detete_by"`
	// 同步时间
	// @gotags: json:"sync_at" validate:"required"
	SyncAt int64 `protobuf:"varint,8,opt,name=sync_at,json=syncAt,proto3" json:"sync_at" validate:"required"`
	// 同步人
	// @gotags: json:"sync_by"
	SyncBy string `protobuf:"bytes,9,opt,name=sync_by,json=syncBy,proto3" json:"sync_by"`
	// 用于同步的凭证ID
	// @gotags: json:"credential_id"
	CredentialId string `protobuf:"bytes,10,opt,name=credential_id,json=credentialId,proto3" json:"credential_id"`
	// 序列号
	// @gotags: json:"serial_number"
	SerialNumber string `protobuf:"bytes,11,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number"`
	// 使用方式
	// @gotags: json:"usage_mode"
	UsageMode USAGE_MODE `protobuf:"varint,12,opt,name=usage_mode,json=usageMode,proto3,enum=infraboard.cmdb.resource.USAGE_MODE" json:"usage_mode"`
	// 共享策略, 当一个资源被多个应用共享时, 可以指定允许的应用
	// @gotags: json:"shared_policy" gorm:"serializer:json"
	SharedPolicy *SharedPolicy `protobuf:"bytes,13,opt,name=shared_policy,json=sharedPolicy,proto3" json:"shared_policy" gorm:"serializer:json"`
	// 扩展字段
	// @gotags: json:"extra" gorm:"serializer:json"
	Extra map[string]string `` /* 165-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Meta) Descriptor deprecated

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

Deprecated: Use Meta.ProtoReflect.Descriptor instead.

func (*Meta) GetCreateAt

func (x *Meta) GetCreateAt() int64

func (*Meta) GetCredentialId

func (x *Meta) GetCredentialId() string

func (*Meta) GetDeteteAt

func (x *Meta) GetDeteteAt() int64

func (*Meta) GetDeteteBy

func (x *Meta) GetDeteteBy() string

func (*Meta) GetDomain

func (x *Meta) GetDomain() string

func (*Meta) GetEnv

func (x *Meta) GetEnv() string

func (*Meta) GetExtra

func (x *Meta) GetExtra() map[string]string

func (*Meta) GetId

func (x *Meta) GetId() string

func (*Meta) GetNamespace

func (x *Meta) GetNamespace() string

func (*Meta) GetSerialNumber

func (x *Meta) GetSerialNumber() string

func (*Meta) GetSharedPolicy

func (x *Meta) GetSharedPolicy() *SharedPolicy

func (*Meta) GetSyncAt

func (x *Meta) GetSyncAt() int64

func (*Meta) GetSyncBy

func (x *Meta) GetSyncBy() string

func (*Meta) GetUsageMode

func (x *Meta) GetUsageMode() USAGE_MODE

func (*Meta) ProtoMessage

func (*Meta) ProtoMessage()

func (*Meta) ProtoReflect

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

func (*Meta) Reset

func (x *Meta) Reset()

func (*Meta) String

func (x *Meta) String() string

type Operator

type Operator string

type PAY_MODE

type PAY_MODE int32
const (
	// 预付费, 包年包月
	PAY_MODE_PRE_PAY PAY_MODE = 0
	// 按需
	PAY_MODE_POST_PAY PAY_MODE = 1
	// 预定
	PAY_MODE_RESERVED_PAY PAY_MODE = 2
	// 竞价付费
	PAY_MODE_SPOT_PAY PAY_MODE = 3
	// 没有标识
	PAY_MODE_NULL PAY_MODE = 9
)

func ParsePAY_MODEFromString

func ParsePAY_MODEFromString(str string) (PAY_MODE, error)

ParsePAY_MODEFromString Parse PAY_MODE from string

func (PAY_MODE) Descriptor

func (PAY_MODE) Descriptor() protoreflect.EnumDescriptor

func (PAY_MODE) Enum

func (x PAY_MODE) Enum() *PAY_MODE

func (PAY_MODE) EnumDescriptor deprecated

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

Deprecated: Use PAY_MODE.Descriptor instead.

func (PAY_MODE) Equal

func (t PAY_MODE) Equal(target PAY_MODE) bool

Equal type compare

func (PAY_MODE) IsIn

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

IsIn todo

func (PAY_MODE) MarshalJSON

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

MarshalJSON todo

func (PAY_MODE) Number

func (x PAY_MODE) Number() protoreflect.EnumNumber

func (PAY_MODE) String

func (x PAY_MODE) String() string

func (PAY_MODE) Type

func (*PAY_MODE) UnmarshalJSON

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

UnmarshalJSON todo

type PrometheusTarget

type PrometheusTarget struct {
	Targets []string          `json:"targets"`
	Labels  map[string]string `json:"labels"`
}

type RPCClient

type RPCClient interface {
	Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*ResourceSet, 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 {
	Search(context.Context, *SearchRequest) (*ResourceSet, error)
	// contains filtered or unexported methods
}

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

type Resource

type Resource struct {

	// 资源元数据信息
	// @gotags: json:"meta"
	Meta *Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta"`
	// 资源规格信息
	// @gotags: json:"spec"
	Spec *Spec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec"`
	// 资源费用
	// @gotags: json:"cost"
	Cost *Cost `protobuf:"bytes,3,opt,name=cost,proto3" json:"cost"`
	// 资源状态
	// @gotags: json:"status"
	Status *Status `protobuf:"bytes,4,opt,name=status,proto3" json:"status"`
	// 关联资源
	// @gotags: json:"related_resources"
	RelatedResources []*Resource `protobuf:"bytes,6,rep,name=related_resources,json=relatedResources,proto3" json:"related_resources"`
	// 资源内容的hash,用来控制那些需要更新
	// @gotags: json:"content_hash,omitempty"
	ContentHash *ContentHash `protobuf:"bytes,10,opt,name=content_hash,json=contentHash,proto3" json:"content_hash,omitempty"`
	// contains filtered or unexported fields
}

func NewDefaultResource

func NewDefaultResource(rt TYPE) *Resource

func (*Resource) AddTag

func (r *Resource) AddTag(t *Tag)

func (*Resource) Descriptor deprecated

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

Deprecated: Use Resource.ProtoReflect.Descriptor instead.

func (*Resource) GetContentHash

func (x *Resource) GetContentHash() *ContentHash

func (*Resource) GetCost

func (x *Resource) GetCost() *Cost

func (*Resource) GetMeta

func (x *Resource) GetMeta() *Meta

func (*Resource) GetRelatedResources

func (x *Resource) GetRelatedResources() []*Resource

func (*Resource) GetSpec

func (x *Resource) GetSpec() *Spec

func (*Resource) GetStatus

func (x *Resource) GetStatus() *Status

func (*Resource) GetTagValueOne

func (r *Resource) GetTagValueOne(key string) string

func (*Resource) MarshalJSON

func (c *Resource) MarshalJSON() ([]byte, error)

func (*Resource) PrometheusEndpont

func (r *Resource) PrometheusEndpont() (string, error)

func (*Resource) PrometheusTarget

func (r *Resource) PrometheusTarget() (*PrometheusTarget, error)

func (*Resource) ProtoMessage

func (*Resource) ProtoMessage()

func (*Resource) ProtoReflect

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

func (*Resource) Reset

func (x *Resource) Reset()

func (*Resource) SortTag

func (i *Resource) SortTag()

func (*Resource) String

func (x *Resource) String() string

func (*Resource) Validate

func (r *Resource) Validate() error

type ResourceSet

type ResourceSet struct {

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

func NewResourceSet

func NewResourceSet() *ResourceSet

func (*ResourceSet) Add

func (s *ResourceSet) Add(item *Resource)

func (*ResourceSet) Descriptor deprecated

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

Deprecated: Use ResourceSet.ProtoReflect.Descriptor instead.

func (*ResourceSet) GetItems

func (x *ResourceSet) GetItems() []*Resource

func (*ResourceSet) GetTotal

func (x *ResourceSet) GetTotal() int64

func (*ResourceSet) Metas

func (s *ResourceSet) Metas() (metas []*Meta)

func (*ResourceSet) PrometheusFormat

func (s *ResourceSet) PrometheusFormat() (targets []*PrometheusTarget)

func (*ResourceSet) ProtoMessage

func (*ResourceSet) ProtoMessage()

func (*ResourceSet) ProtoReflect

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

func (*ResourceSet) Reset

func (x *ResourceSet) Reset()

func (*ResourceSet) ResourceIds

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

func (*ResourceSet) String

func (x *ResourceSet) String() string

type SearchRequest

type SearchRequest struct {

	// 分页参数
	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// 资源所属域
	// @gotags: json:"domain"
	Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain"`
	// 资源所属空间
	// @gotags: json:"namespace"
	Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace"`
	// 资源所属环境
	// @gotags: json:"env"
	Env string `protobuf:"bytes,4,opt,name=env,proto3" json:"env"`
	// 使用方式
	// @gotags: json:"usage_mode"
	UsageMode *USAGE_MODE `` /* 126-byte string literal not displayed */
	// 厂商
	// @gotags: json:"vendor"
	Vendor *VENDOR `protobuf:"varint,6,opt,name=vendor,proto3,enum=infraboard.cmdb.resource.VENDOR,oneof" json:"vendor"`
	// 资源所属账号
	// @gotags: json:"owner"
	Owner string `protobuf:"bytes,7,opt,name=owner,proto3" json:"owner"`
	// 资源类型
	// @gotags: json:"type"
	Type *TYPE `protobuf:"varint,8,opt,name=type,proto3,enum=infraboard.cmdb.resource.TYPE,oneof" json:"type"`
	// 服务商中的状态
	// @gotags: json:"status"
	Status string `protobuf:"bytes,9,opt,name=status,proto3" json:"status"`
	// 资源标签
	// @gotags: json:"tags"
	Tags []*TagSelector `protobuf:"bytes,10,rep,name=tags,proto3" json:"tags"`
	// 是否返回资源的标签
	// @gotags: json:"with_tags"
	WithTags bool `protobuf:"varint,11,opt,name=with_tags,json=withTags,proto3" json:"with_tags"`
	// 关联资源查询深度, -1表示查询所有, 默认为0,表示不查询关联资源
	// @gotags: json:"relation_deep"
	RelationDeep int32 `protobuf:"varint,12,opt,name=relation_deep,json=relationDeep,proto3" json:"relation_deep"`
	// 关键字参数
	// @gotags: json:"keywords"
	Keywords string `protobuf:"bytes,14,opt,name=keywords,proto3" json:"keywords"`
	// contains filtered or unexported fields
}

func NewSearchRequest

func NewSearchRequest() *SearchRequest

func NewSearchRequestFromHTTP

func NewSearchRequestFromHTTP(r *http.Request) (*SearchRequest, error)

func (*SearchRequest) AddTag

func (req *SearchRequest) AddTag(t ...*TagSelector)

func (*SearchRequest) Descriptor deprecated

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

Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.

func (*SearchRequest) GetDomain

func (x *SearchRequest) GetDomain() string

func (*SearchRequest) GetEnv

func (x *SearchRequest) GetEnv() string

func (*SearchRequest) GetKeywords

func (x *SearchRequest) GetKeywords() string

func (*SearchRequest) GetNamespace

func (x *SearchRequest) GetNamespace() string

func (*SearchRequest) GetOwner

func (x *SearchRequest) GetOwner() string

func (*SearchRequest) GetPage

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

func (*SearchRequest) GetRelationDeep

func (x *SearchRequest) GetRelationDeep() int32

func (*SearchRequest) GetStatus

func (x *SearchRequest) GetStatus() string

func (*SearchRequest) GetTags

func (x *SearchRequest) GetTags() []*TagSelector

func (*SearchRequest) GetType

func (x *SearchRequest) GetType() TYPE

func (*SearchRequest) GetUsageMode

func (x *SearchRequest) GetUsageMode() USAGE_MODE

func (*SearchRequest) GetVendor

func (x *SearchRequest) GetVendor() VENDOR

func (*SearchRequest) GetWithTags

func (x *SearchRequest) GetWithTags() bool

func (*SearchRequest) HasTag

func (req *SearchRequest) HasTag() bool

func (*SearchRequest) ProtoMessage

func (*SearchRequest) ProtoMessage()

func (*SearchRequest) ProtoReflect

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

func (*SearchRequest) Reset

func (x *SearchRequest) Reset()

func (*SearchRequest) String

func (x *SearchRequest) String() string

type Service

type Service interface {
	Put(context.Context, *Resource) (*Resource, error)
	Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
	RPCServer
}

type SharedPolicy

type SharedPolicy struct {

	// 分享的维度
	// @gotags: json:"tag_key"
	TagKey string `protobuf:"bytes,1,opt,name=tag_key,json=tagKey,proto3" json:"tag_key"`
	// 分享给哪些值
	// @gotags: json:"tag_values"
	TagValues []string `protobuf:"bytes,2,rep,name=tag_values,json=tagValues,proto3" json:"tag_values"`
	// contains filtered or unexported fields
}

共享策略

func (*SharedPolicy) Descriptor deprecated

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

Deprecated: Use SharedPolicy.ProtoReflect.Descriptor instead.

func (*SharedPolicy) GetTagKey

func (x *SharedPolicy) GetTagKey() string

func (*SharedPolicy) GetTagValues

func (x *SharedPolicy) GetTagValues() []string

func (*SharedPolicy) ProtoMessage

func (*SharedPolicy) ProtoMessage()

func (*SharedPolicy) ProtoReflect

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

func (*SharedPolicy) Reset

func (x *SharedPolicy) Reset()

func (*SharedPolicy) String

func (x *SharedPolicy) String() string

type Spec

type Spec struct {

	// 厂商
	// @gotags: json:"vendor"
	Vendor VENDOR `protobuf:"varint,1,opt,name=vendor,proto3,enum=infraboard.cmdb.resource.VENDOR" json:"vendor"`
	// 资源类型
	// @gotags: json:"resource_type"
	ResourceType TYPE `protobuf:"varint,2,opt,name=resource_type,json=resourceType,proto3,enum=infraboard.cmdb.resource.TYPE" json:"resource_type"`
	// 地域
	// @gotags: json:"region"
	Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region"`
	// 区域
	// @gotags: json:"zone"
	Zone string `protobuf:"bytes,4,opt,name=zone,proto3" json:"zone"`
	// 资源所属账号
	// @gotags: json:"owner"
	Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner"`
	// 名称
	// @gotags: json:"name"
	Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name"`
	// 种类
	// @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:"description"
	Description string `protobuf:"bytes,9,opt,name=description,proto3" json:"description"`
	// 过期时间
	// @gotags: json:"expire_at"
	ExpireAt int64 `protobuf:"varint,10,opt,name=expire_at,json=expireAt,proto3" json:"expire_at"`
	// 更新时间
	// @gotags: json:"update_at"
	UpdateAt int64 `protobuf:"varint,11,opt,name=update_at,json=updateAt,proto3" json:"update_at"`
	// 是否开启实例释放保护
	// @gotags: json:"release_protection"
	ReleaseProtection *bool `protobuf:"varint,12,opt,name=release_protection,json=releaseProtection,proto3,oneof" json:"release_protection"`
	// 资源占用Cpu数量
	// @gotags: json:"cpu"
	Cpu int32 `protobuf:"varint,15,opt,name=cpu,proto3" json:"cpu"`
	// GPU数量
	// @gotags: json:"gpu"
	Gpu int32 `protobuf:"varint,16,opt,name=gpu,proto3" json:"gpu"`
	// 资源使用的内存
	// @gotags: json:"memory"
	Memory int32 `protobuf:"varint,17,opt,name=memory,proto3" json:"memory"`
	// 资源使用的存储
	// @gotags: json:"storage"
	Storage int32 `protobuf:"varint,18,opt,name=storage,proto3" json:"storage"`
	// 公网IP带宽, 单位M
	// @gotags: json:"band_width"
	BandWidth int32 `protobuf:"varint,19,opt,name=band_width,json=bandWidth,proto3" json:"band_width"`
	// 资源标签
	// @gotags: json:"tags"
	Tags []*Tag `protobuf:"bytes,25,rep,name=tags,proto3" json:"tags"`
	// 额外的通用属性
	// @gotags: json:"extra" gorm:"serializer:json"
	Extra map[string]string `` /* 165-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Spec) Descriptor deprecated

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

Deprecated: Use Spec.ProtoReflect.Descriptor instead.

func (*Spec) GetBandWidth

func (x *Spec) GetBandWidth() int32

func (*Spec) GetCategory

func (x *Spec) GetCategory() string

func (*Spec) GetCpu

func (x *Spec) GetCpu() int32

func (*Spec) GetDescription

func (x *Spec) GetDescription() string

func (*Spec) GetExpireAt

func (x *Spec) GetExpireAt() int64

func (*Spec) GetExtra

func (x *Spec) GetExtra() map[string]string

func (*Spec) GetGpu

func (x *Spec) GetGpu() int32

func (*Spec) GetMemory

func (x *Spec) GetMemory() int32

func (*Spec) GetName

func (x *Spec) GetName() string

func (*Spec) GetOwner

func (x *Spec) GetOwner() string

func (*Spec) GetRegion

func (x *Spec) GetRegion() string

func (*Spec) GetReleaseProtection

func (x *Spec) GetReleaseProtection() bool

func (*Spec) GetResourceType

func (x *Spec) GetResourceType() TYPE

func (*Spec) GetStorage

func (x *Spec) GetStorage() int32

func (*Spec) GetTags

func (x *Spec) GetTags() []*Tag

func (*Spec) GetType

func (x *Spec) GetType() string

func (*Spec) GetUpdateAt

func (x *Spec) GetUpdateAt() int64

func (*Spec) GetVendor

func (x *Spec) GetVendor() VENDOR

func (*Spec) GetZone

func (x *Spec) GetZone() string

func (*Spec) Hash

func (i *Spec) Hash() 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 Status

type Status struct {

	// 资源当前状态
	// @gotags: json:"phase"
	Phase string `protobuf:"bytes,1,opt,name=phase,proto3" json:"phase"`
	// 资源当前状态描述
	// @gotags: json:"describe"
	Describe string `protobuf:"bytes,2,opt,name=describe,proto3" json:"describe"`
	// 实例锁定模式; Unlock:正常;ManualLock:手动触发锁定;LockByExpiration:实例过期自动锁定;LockByRestoration:实例回滚前的自动锁定;LockByDiskQuota:实例空间满自动锁定
	// @gotags: json:"lock_mode"
	LockMode string `protobuf:"bytes,3,opt,name=lock_mode,json=lockMode,proto3" json:"lock_mode"`
	// 锁定原因
	// @gotags: json:"lock_reason"
	LockReason string `protobuf:"bytes,4,opt,name=lock_reason,json=lockReason,proto3" json:"lock_reason"`
	// 资源访问地址
	// 公网地址, 或者域名
	// @gotags: json:"public_address" gorm:"serializer:json"
	PublicAddress []string `protobuf:"bytes,5,rep,name=public_address,json=publicAddress,proto3" json:"public_address" gorm:"serializer:json"`
	// 内网地址, 或者域名
	// @gotags: json:"private_address" gorm:"serializer:json"
	PrivateAddress []string `protobuf:"bytes,6,rep,name=private_address,json=privateAddress,proto3" json:"private_address" gorm:"serializer:json"`
	// contains filtered or unexported fields
}

资源当前状态

func (*Status) Descriptor deprecated

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

Deprecated: Use Status.ProtoReflect.Descriptor instead.

func (*Status) GetDescribe

func (x *Status) GetDescribe() string

func (*Status) GetLockMode

func (x *Status) GetLockMode() string

func (*Status) GetLockReason

func (x *Status) GetLockReason() string

func (*Status) GetPhase

func (x *Status) GetPhase() string

func (*Status) GetPrivateAddress

func (x *Status) GetPrivateAddress() []string

func (*Status) GetPublicAddress

func (x *Status) GetPublicAddress() []string

func (*Status) LoadPrivateIPString

func (i *Status) LoadPrivateIPString(s string)

func (*Status) LoadPublicIPString

func (i *Status) LoadPublicIPString(s string)

func (*Status) PrivateIPToString

func (i *Status) PrivateIPToString() string

func (*Status) ProtoMessage

func (*Status) ProtoMessage()

func (*Status) ProtoReflect

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

func (*Status) PublicIPToString

func (i *Status) PublicIPToString() string

func (*Status) Reset

func (x *Status) Reset()

func (*Status) String

func (x *Status) String() string

type TAG_PURPOSE

type TAG_PURPOSE int32

标签用途

const (
	// 用于资源分组
	TAG_PURPOSE_GROUP TAG_PURPOSE = 0
	// 系统使用标签, 表示被其他系统引用, 比如应用关联标签
	TAG_PURPOSE_SYSTEM TAG_PURPOSE = 1
	// 用于资源监控
	TAG_PURPOSE_MONITOR TAG_PURPOSE = 2
	// 来自第三方的标签, 比如同步时的第三方提供的标签
	TAG_PURPOSE_THIRDPARTY TAG_PURPOSE = 3
)

func ParseTAG_PURPOSEFromString

func ParseTAG_PURPOSEFromString(str string) (TAG_PURPOSE, error)

ParseTAG_PURPOSEFromString Parse TAG_PURPOSE from string

func (TAG_PURPOSE) Descriptor

func (TAG_PURPOSE) Enum

func (x TAG_PURPOSE) Enum() *TAG_PURPOSE

func (TAG_PURPOSE) EnumDescriptor deprecated

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

Deprecated: Use TAG_PURPOSE.Descriptor instead.

func (TAG_PURPOSE) Equal

func (t TAG_PURPOSE) Equal(target TAG_PURPOSE) bool

Equal type compare

func (TAG_PURPOSE) IsIn

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

IsIn todo

func (TAG_PURPOSE) MarshalJSON

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

MarshalJSON todo

func (TAG_PURPOSE) Number

func (x TAG_PURPOSE) Number() protoreflect.EnumNumber

func (TAG_PURPOSE) String

func (x TAG_PURPOSE) String() string

func (TAG_PURPOSE) Type

func (*TAG_PURPOSE) UnmarshalJSON

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

UnmarshalJSON todo

type TYPE

type TYPE int32
const (
	// 业务资源
	TYPE_HOST    TYPE = 0
	TYPE_RDS     TYPE = 1
	TYPE_REDIS   TYPE = 2
	TYPE_BUCKET  TYPE = 3
	TYPE_DISK    TYPE = 4
	TYPE_LB      TYPE = 5
	TYPE_DOMAIN  TYPE = 6
	TYPE_EIP     TYPE = 7
	TYPE_MONGODB TYPE = 8
	// 子资源
	TYPE_DATABASE TYPE = 100
	TYPE_ACCOUNT  TYPE = 101
	// 未知资源
	TYPE_OTHER TYPE = 199
	// 辅助资源
	TYPE_BILL  TYPE = 200
	TYPE_ORDER TYPE = 201
)

func ParseTYPEFromString

func ParseTYPEFromString(str string) (TYPE, error)

ParseTYPEFromString Parse TYPE from string

func (TYPE) Descriptor

func (TYPE) Descriptor() protoreflect.EnumDescriptor

func (TYPE) Enum

func (x TYPE) Enum() *TYPE

func (TYPE) EnumDescriptor deprecated

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

Deprecated: Use TYPE.Descriptor instead.

func (TYPE) Equal

func (t TYPE) Equal(target TYPE) bool

Equal type compare

func (TYPE) IsIn

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

IsIn todo

func (TYPE) MarshalJSON

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

MarshalJSON todo

func (TYPE) Number

func (x TYPE) Number() protoreflect.EnumNumber

func (TYPE) String

func (x TYPE) String() string

func (TYPE) Type

func (TYPE) Type() protoreflect.EnumType

func (*TYPE) UnmarshalJSON

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

UnmarshalJSON todo

type Tag

type Tag struct {

	// 标签的类型
	// @gotags: json:"purpose"
	Purpose TAG_PURPOSE `protobuf:"varint,1,opt,name=purpose,proto3,enum=infraboard.cmdb.resource.TAG_PURPOSE" json:"purpose"`
	// 标签的Key
	// @gotags: json:"key" validate:"lte=255,required"
	Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key" validate:"lte=255,required"`
	// 标签的值
	// @gotags: json:"value" validate:"lte=255,required"
	Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value" validate:"lte=255,required"`
	// 标签的值的描述, 通常用于展示
	// @gotags: json:"describe"
	Describe string `protobuf:"bytes,4,opt,name=describe,proto3" json:"describe"`
	// 标签权重, 针对同一个key, 多个value场景, 默认值1
	// @gotags: json:"weight"
	Weight int64 `protobuf:"varint,5,opt,name=weight,proto3" json:"weight"`
	// 是否是只读标签
	// @gotags: json:"read_only"
	ReadOnly bool `protobuf:"varint,6,opt,name=read_only,json=readOnly,proto3" json:"read_only"`
	// 标签是否隐藏, 用于控制是否在前端展示
	// @gotags: json:"hidden"
	Hidden bool `protobuf:"varint,7,opt,name=hidden,proto3" json:"hidden"`
	// 标签删除时间
	// @gotags: json:"delete_at"
	DeleteAt int64 `protobuf:"varint,8,opt,name=delete_at,json=deleteAt,proto3" json:"delete_at"`
	// 标签删除人
	// @gotags: json:"delete_by"
	DeleteBy bool `protobuf:"varint,9,opt,name=delete_by,json=deleteBy,proto3" json:"delete_by"`
	// 标签更新时间
	// @gotags: json:"update_at"
	UpdateAt int64 `protobuf:"varint,10,opt,name=update_at,json=updateAt,proto3" json:"update_at"`
	// 标签更新人
	// @gotags: json:"update_by"
	UpdateBy bool `protobuf:"varint,11,opt,name=update_by,json=updateBy,proto3" json:"update_by"`
	// 标签meta信息, 比如前端需要设置标签的颜色
	// @gotags: json:"meta" gorm:"serializer:json"
	Meta map[string]string `` /* 163-byte string literal not displayed */
	// contains filtered or unexported fields
}

func NewDefaultTag

func NewDefaultTag() *Tag

func NewGroupTag

func NewGroupTag(key, value string) *Tag

func (*Tag) Descriptor deprecated

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

Deprecated: Use Tag.ProtoReflect.Descriptor instead.

func (*Tag) GetDeleteAt

func (x *Tag) GetDeleteAt() int64

func (*Tag) GetDeleteBy

func (x *Tag) GetDeleteBy() bool

func (*Tag) GetDescribe

func (x *Tag) GetDescribe() string

func (*Tag) GetHidden

func (x *Tag) GetHidden() bool

func (*Tag) GetKey

func (x *Tag) GetKey() string

func (*Tag) GetMeta

func (x *Tag) GetMeta() map[string]string

func (*Tag) GetPurpose

func (x *Tag) GetPurpose() TAG_PURPOSE

func (*Tag) GetReadOnly

func (x *Tag) GetReadOnly() bool

func (*Tag) GetUpdateAt

func (x *Tag) GetUpdateAt() int64

func (*Tag) GetUpdateBy

func (x *Tag) GetUpdateBy() bool

func (*Tag) GetValue

func (x *Tag) GetValue() string

func (*Tag) GetWeight

func (x *Tag) GetWeight() int64

func (*Tag) ProtoMessage

func (*Tag) ProtoMessage()

func (*Tag) ProtoReflect

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

func (*Tag) Reset

func (x *Tag) Reset()

func (*Tag) String

func (x *Tag) String() string

type TagSelector

type TagSelector struct {

	// 匹配的key, 支持LIKE匹配
	// @gotags: json:"key" validate:"required"
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key" validate:"required"`
	// 匹配符
	// @gotags: json:"opertor"
	Opertor string `protobuf:"bytes,2,opt,name=opertor,proto3" json:"opertor"`
	// 匹配的值
	// @gotags: json:"values"
	Values []string `protobuf:"bytes,3,rep,name=values,proto3" json:"values"`
	// contains filtered or unexported fields
}

func NewPrometheusScrapeTag

func NewPrometheusScrapeTag() *TagSelector

func NewTagsFromString

func NewTagsFromString(tagStr string) (tags []*TagSelector, err error)

key1=v1,v2,v3&key2=~v1,v2,v3

func ParExpr

func ParExpr(str string) (*TagSelector, error)

func (*TagSelector) Descriptor deprecated

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

Deprecated: Use TagSelector.ProtoReflect.Descriptor instead.

func (*TagSelector) GetKey

func (x *TagSelector) GetKey() string

func (*TagSelector) GetOpertor

func (x *TagSelector) GetOpertor() string

func (*TagSelector) GetValues

func (x *TagSelector) GetValues() []string

func (*TagSelector) ProtoMessage

func (*TagSelector) ProtoMessage()

func (*TagSelector) ProtoReflect

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

func (*TagSelector) RelationShip

func (s *TagSelector) RelationShip() string

func (*TagSelector) Reset

func (x *TagSelector) Reset()

func (*TagSelector) String

func (x *TagSelector) String() string

type TagSet

type TagSet struct {

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

func NewTagSet

func NewTagSet() *TagSet

func (*TagSet) Descriptor deprecated

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

Deprecated: Use TagSet.ProtoReflect.Descriptor instead.

func (*TagSet) GetItems

func (x *TagSet) GetItems() []*Tag

func (*TagSet) GetTotal

func (x *TagSet) GetTotal() int64

func (*TagSet) ProtoMessage

func (*TagSet) ProtoMessage()

func (*TagSet) ProtoReflect

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

func (*TagSet) Reset

func (x *TagSet) Reset()

func (*TagSet) String

func (x *TagSet) String() string

type USAGE_MODE

type USAGE_MODE int32

使用方式

const (
	// 共享使用
	USAGE_MODE_SHARED USAGE_MODE = 0
	// 独占使用
	USAGE_MODE_MONOPOLY USAGE_MODE = 1
)

func ParseUSAGE_MODEFromString

func ParseUSAGE_MODEFromString(str string) (USAGE_MODE, error)

ParseUSAGE_MODEFromString Parse USAGE_MODE from string

func (USAGE_MODE) Descriptor

func (USAGE_MODE) Descriptor() protoreflect.EnumDescriptor

func (USAGE_MODE) Enum

func (x USAGE_MODE) Enum() *USAGE_MODE

func (USAGE_MODE) EnumDescriptor deprecated

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

Deprecated: Use USAGE_MODE.Descriptor instead.

func (USAGE_MODE) Equal

func (t USAGE_MODE) Equal(target USAGE_MODE) bool

Equal type compare

func (USAGE_MODE) IsIn

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

IsIn todo

func (USAGE_MODE) MarshalJSON

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

MarshalJSON todo

func (USAGE_MODE) Number

func (x USAGE_MODE) Number() protoreflect.EnumNumber

func (USAGE_MODE) String

func (x USAGE_MODE) String() string

func (USAGE_MODE) Type

func (*USAGE_MODE) UnmarshalJSON

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

UnmarshalJSON todo

type UnimplementedRPCServer

type UnimplementedRPCServer struct {
}

UnimplementedRPCServer must be embedded to have forward compatible implementations.

func (UnimplementedRPCServer) Search

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.

type UpdateAction

type UpdateAction int32
const (
	// 添加
	UpdateAction_ADD UpdateAction = 0
	// 移除
	UpdateAction_REMOVE UpdateAction = 1
)

func ParseUpdateActionFromString

func ParseUpdateActionFromString(str string) (UpdateAction, error)

ParseUpdateActionFromString Parse UpdateAction from string

func (UpdateAction) Descriptor

func (UpdateAction) Enum

func (x UpdateAction) Enum() *UpdateAction

func (UpdateAction) EnumDescriptor deprecated

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

Deprecated: Use UpdateAction.Descriptor instead.

func (UpdateAction) Equal

func (t UpdateAction) Equal(target UpdateAction) bool

Equal type compare

func (UpdateAction) IsIn

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

IsIn todo

func (UpdateAction) MarshalJSON

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

MarshalJSON todo

func (UpdateAction) Number

func (UpdateAction) String

func (x UpdateAction) String() string

func (UpdateAction) Type

func (*UpdateAction) UnmarshalJSON

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

UnmarshalJSON todo

type VENDOR

type VENDOR int32
const (
	VENDOR_ALIYUN  VENDOR = 0
	VENDOR_TENCENT VENDOR = 1
	VENDOR_HUAWEI  VENDOR = 2
	VENDOR_VSPHERE VENDOR = 3
	VENDOR_AMAZON  VENDOR = 4
)

func ParseVENDORFromString

func ParseVENDORFromString(str string) (VENDOR, error)

ParseVENDORFromString Parse VENDOR from string

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) Equal

func (t VENDOR) Equal(target VENDOR) bool

Equal type compare

func (VENDOR) IsIn

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

IsIn todo

func (VENDOR) MarshalJSON

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

MarshalJSON todo

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

func (*VENDOR) UnmarshalJSON

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

UnmarshalJSON todo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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