Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)
- type Base
- func (*Base) Descriptor() ([]byte, []int)deprecated
- func (x *Base) GetCreateAt() int64
- func (x *Base) GetDescribeHash() string
- func (x *Base) GetDescribeHashChanged() bool
- func (x *Base) GetDomain() string
- func (x *Base) GetEnv() string
- func (x *Base) GetId() string
- func (x *Base) GetNamespace() string
- func (x *Base) GetRegion() string
- func (x *Base) GetResourceHash() string
- func (x *Base) GetResourceHashChanged() bool
- func (x *Base) GetResourceType() Type
- func (x *Base) GetSecretId() string
- func (x *Base) GetSharedPolicy() *SharedPolicy
- func (x *Base) GetSyncAt() int64
- func (x *Base) GetUsageMode() UsageMode
- func (x *Base) GetVendor() Vendor
- func (x *Base) GetZone() string
- func (*Base) ProtoMessage()
- func (x *Base) ProtoReflect() protoreflect.Message
- func (x *Base) Reset()
- func (x *Base) String() string
- type Information
- func (r *Information) AddTag(t *Tag)
- func (*Information) Descriptor() ([]byte, []int)deprecated
- func (x *Information) GetCategory() string
- func (x *Information) GetDescription() string
- func (x *Information) GetExpireAt() int64
- func (x *Information) GetName() string
- func (x *Information) GetPayType() string
- func (x *Information) GetPrivateIp() []string
- func (x *Information) GetPublicIp() []string
- func (x *Information) GetStatus() string
- func (x *Information) GetSyncAccount() string
- func (x *Information) GetTags() []*Tag
- func (x *Information) GetType() string
- func (x *Information) GetUpdateAt() int64
- func (i *Information) Hash() string
- func (i *Information) LoadPrivateIPString(s string)
- func (i *Information) LoadPublicIPString(s string)
- func (i *Information) PrivateIPToString() string
- func (*Information) ProtoMessage()
- func (x *Information) ProtoReflect() protoreflect.Message
- func (i *Information) PublicIPToString() string
- func (x *Information) Reset()
- func (x *Information) String() string
- type Operator
- type QueryTagRequest
- type Resource
- type ResourceSet
- func (s *ResourceSet) Add(item *Resource)
- func (*ResourceSet) Descriptor() ([]byte, []int)deprecated
- func (x *ResourceSet) GetItems() []*Resource
- func (x *ResourceSet) GetTotal() int64
- func (*ResourceSet) ProtoMessage()
- func (x *ResourceSet) ProtoReflect() protoreflect.Message
- func (x *ResourceSet) Reset()
- func (x *ResourceSet) String() string
- type SearchRequest
- func (req *SearchRequest) AddTag(t ...*TagSelector)
- func (*SearchRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SearchRequest) GetDomain() string
- func (x *SearchRequest) GetEnv() string
- func (x *SearchRequest) GetExactMatch() bool
- func (x *SearchRequest) GetKeywords() string
- func (x *SearchRequest) GetNamespace() string
- func (x *SearchRequest) GetPage() *request.PageRequest
- func (x *SearchRequest) GetStatus() string
- func (x *SearchRequest) GetSyncAccount() string
- func (x *SearchRequest) GetTags() []*TagSelector
- func (x *SearchRequest) GetType() Type
- func (x *SearchRequest) GetUsageMode() UsageMode
- func (x *SearchRequest) GetVendor() Vendor
- func (x *SearchRequest) GetWithTags() bool
- func (r *SearchRequest) HasTag() bool
- func (*SearchRequest) ProtoMessage()
- func (x *SearchRequest) ProtoReflect() protoreflect.Message
- func (x *SearchRequest) Reset()
- func (x *SearchRequest) String() string
- type ServiceClient
- type ServiceServer
- type SharedPolicy
- func (*SharedPolicy) Descriptor() ([]byte, []int)deprecated
- func (x *SharedPolicy) GetTagKey() string
- func (x *SharedPolicy) GetTagValues() []string
- func (*SharedPolicy) ProtoMessage()
- func (x *SharedPolicy) ProtoReflect() protoreflect.Message
- func (x *SharedPolicy) Reset()
- func (x *SharedPolicy) String() string
- type Tag
- func (*Tag) Descriptor() ([]byte, []int)deprecated
- func (x *Tag) GetDescribe() string
- func (x *Tag) GetHidden() bool
- func (x *Tag) GetIsCost() bool
- func (x *Tag) GetKey() string
- func (x *Tag) GetMeta() map[string]string
- func (x *Tag) GetResourceId() string
- func (x *Tag) GetType() TagType
- func (x *Tag) GetValue() string
- func (x *Tag) GetWeight() int64
- func (*Tag) ProtoMessage()
- func (x *Tag) ProtoReflect() protoreflect.Message
- func (x *Tag) Reset()
- func (x *Tag) String() string
- type TagSelector
- func (*TagSelector) Descriptor() ([]byte, []int)deprecated
- func (x *TagSelector) GetKey() string
- func (x *TagSelector) GetOperator() string
- func (x *TagSelector) GetValues() []string
- func (*TagSelector) ProtoMessage()
- func (x *TagSelector) ProtoReflect() protoreflect.Message
- func (s *TagSelector) RelationShip() string
- func (x *TagSelector) Reset()
- func (x *TagSelector) String() string
- type TagSet
- type TagType
- func (TagType) Descriptor() protoreflect.EnumDescriptor
- func (x TagType) Enum() *TagType
- func (TagType) EnumDescriptor() ([]byte, []int)deprecated
- func (t TagType) Equal(target TagType) bool
- func (t TagType) IsIn(targets ...TagType) bool
- func (t TagType) MarshalJSON() ([]byte, error)
- func (x TagType) Number() protoreflect.EnumNumber
- func (x TagType) String() string
- func (TagType) Type() protoreflect.EnumType
- func (t *TagType) UnmarshalJSON(b []byte) error
- type Type
- func (Type) Descriptor() protoreflect.EnumDescriptor
- func (x Type) Enum() *Type
- func (Type) EnumDescriptor() ([]byte, []int)deprecated
- func (t Type) Equal(target Type) bool
- func (t Type) IsIn(targets ...Type) bool
- func (t Type) MarshalJSON() ([]byte, error)
- func (x Type) Number() protoreflect.EnumNumber
- func (x Type) String() string
- func (Type) Type() protoreflect.EnumType
- func (t *Type) UnmarshalJSON(b []byte) error
- type UnimplementedServiceServer
- type UnsafeServiceServer
- type UpdateAction
- func (UpdateAction) Descriptor() protoreflect.EnumDescriptor
- func (x UpdateAction) Enum() *UpdateAction
- func (UpdateAction) EnumDescriptor() ([]byte, []int)deprecated
- func (t UpdateAction) Equal(target UpdateAction) bool
- func (t UpdateAction) IsIn(targets ...UpdateAction) bool
- func (t UpdateAction) MarshalJSON() ([]byte, error)
- func (x UpdateAction) Number() protoreflect.EnumNumber
- func (x UpdateAction) String() string
- func (UpdateAction) Type() protoreflect.EnumType
- func (t *UpdateAction) UnmarshalJSON(b []byte) error
- type UpdateTagRequest
- func (*UpdateTagRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateTagRequest) GetAction() UpdateAction
- func (x *UpdateTagRequest) GetId() string
- func (x *UpdateTagRequest) GetTags() []*Tag
- func (*UpdateTagRequest) ProtoMessage()
- func (x *UpdateTagRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateTagRequest) Reset()
- func (x *UpdateTagRequest) String() string
- type UsageMode
- func (UsageMode) Descriptor() protoreflect.EnumDescriptor
- func (x UsageMode) Enum() *UsageMode
- func (UsageMode) EnumDescriptor() ([]byte, []int)deprecated
- func (t UsageMode) Equal(target UsageMode) bool
- func (t UsageMode) IsIn(targets ...UsageMode) bool
- func (t UsageMode) MarshalJSON() ([]byte, error)
- func (x UsageMode) Number() protoreflect.EnumNumber
- func (x UsageMode) String() string
- func (UsageMode) Type() protoreflect.EnumType
- func (t *UsageMode) UnmarshalJSON(b []byte) error
- type Vendor
- func (Vendor) Descriptor() protoreflect.EnumDescriptor
- func (x Vendor) Enum() *Vendor
- func (Vendor) EnumDescriptor() ([]byte, []int)deprecated
- func (t Vendor) Equal(target Vendor) bool
- func (t Vendor) IsIn(targets ...Vendor) bool
- func (t Vendor) MarshalJSON() ([]byte, error)
- func (x Vendor) Number() protoreflect.EnumNumber
- func (x Vendor) String() string
- func (Vendor) Type() protoreflect.EnumType
- func (t *Vendor) UnmarshalJSON(b []byte) error
Constants ¶
const ( Operator_EQUAL = "=" Operator_NOT_EQUAL = "!=" Operator_LIKE_EQUAL = "=~" Operator_NOT_LIKE_EQUAL = "!~" )
const (
AppName = "resource"
)
Variables ¶
var ( UpdateAction_name = map[int32]string{ 0: "ADD", 1: "REMOVE", } UpdateAction_value = map[string]int32{ "ADD": 0, "REMOVE": 1, } )
Enum value maps for UpdateAction.
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.
var ( Type_name = map[int32]string{ 0: "HOST", 1: "RDS", 99: "BILL", } Type_value = map[string]int32{ "HOST": 0, "RDS": 1, "BILL": 99, } )
Enum value maps for Type.
var ( UsageMode_name = map[int32]string{ 0: "SHARED", 1: "MONOPOLY", } UsageMode_value = map[string]int32{ "SHARED": 0, "MONOPOLY": 1, } )
Enum value maps for UsageMode.
var ( TagType_name = map[int32]string{ 0: "USER", 1: "THIRD", 2: "SYSTEM", } TagType_value = map[string]int32{ "USER": 0, "THIRD": 1, "SYSTEM": 2, } )
Enum value maps for TagType.
var File_apps_resource_pb_resource_proto protoreflect.FileDescriptor
var Service_ServiceDesc = grpc.ServiceDesc{ ServiceName: "cmdb.resource.Service", HandlerType: (*ServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Search", Handler: _Service_Search_Handler, }, { MethodName: "QueryTag", Handler: _Service_QueryTag_Handler, }, { MethodName: "UpdateTag", Handler: _Service_UpdateTag_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "apps/resource/pb/resource.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 Base ¶
type Base struct { // 全局唯一Id, 直接使用个云商自己的Id, 云商内部唯一 // @gotags: json:"id" validate:"required" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 同步时间, 什么时候被录入该系统 // @gotags: json:"sync_at" SyncAt int64 `protobuf:"varint,2,opt,name=sync_at,json=syncAt,proto3" json:"sync_at,omitempty"` // 用于同步的凭证ID, 需要凭证才能读取或操作云商的资源 // @gotags: json:"secret_id" SecretId string `protobuf:"bytes,3,opt,name=secret_id,json=secretId,proto3" json:"secret_id,omitempty"` // 厂商 // @gotags: json:"vendor" Vendor Vendor `protobuf:"varint,4,opt,name=vendor,proto3,enum=cmdb.resource.Vendor" json:"vendor,omitempty"` // 资源类型 // @gotags: json:"resource_type" ResourceType Type `protobuf:"varint,5,opt,name=resource_type,json=resourceType,proto3,enum=cmdb.resource.Type" json:"resource_type,omitempty"` // 地域 // @gotags: json:"region" Region string `protobuf:"bytes,6,opt,name=region,proto3" json:"region,omitempty"` // 区域 // @gotags: json:"zone" Zone string `protobuf:"bytes,7,opt,name=zone,proto3" json:"zone,omitempty"` // 创建时间, 生产时间 // @gotags: json:"create_at" CreateAt int64 `protobuf:"varint,8,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty"` // 基础数据Hash, 通用属性Hash, 有比对是否需要被更新, 提升效率 // @gotags: json:"resource_hash" ResourceHash string `protobuf:"bytes,10,opt,name=resource_hash,json=resourceHash,proto3" json:"resource_hash,omitempty"` // 描述数据Hash, 资源特有属性, 就是其他的模型表, 比如主机, GPU // @gotags: json:"describe_hash" DescribeHash string `protobuf:"bytes,11,opt,name=describe_hash,json=describeHash,proto3" json:"describe_hash,omitempty"` // Resource信息是否有变化 // @gotags: json:"resource_hash_changed,omitempty" ResourceHashChanged bool `protobuf:"varint,12,opt,name=resource_hash_changed,json=resourceHashChanged,proto3" json:"resource_hash_changed,omitempty"` // Describe信息释放有变化 // @gotags: json:"describe_hash_changed,omitempty" DescribeHashChanged bool `protobuf:"varint,13,opt,name=describe_hash_changed,json=describeHashChanged,proto3" json:"describe_hash_changed,omitempty"` // 资源所属空间, 所欲那个项目 // @gotags: json:"namespace" Namespace string `protobuf:"bytes,14,opt,name=namespace,proto3" json:"namespace,omitempty"` // 资源所属环境 // @gotags: json:"env" Env string `protobuf:"bytes,15,opt,name=env,proto3" json:"env,omitempty"` // 使用方式(可选) // @gotags: json:"usage_mode" UsageMode UsageMode `protobuf:"varint,16,opt,name=usage_mode,json=usageMode,proto3,enum=cmdb.resource.UsageMode" json:"usage_mode,omitempty"` // @gotags: json:"shared_policy" SharedPolicy *SharedPolicy `protobuf:"bytes,17,opt,name=shared_policy,json=sharedPolicy,proto3" json:"shared_policy,omitempty"` // 资源所属域, 一个组织或者一个公司, 做多租户模型 // @gotags: json:"domain" Domain string `protobuf:"bytes,18,opt,name=domain,proto3" json:"domain,omitempty"` // contains filtered or unexported fields }
func (*Base) Descriptor
deprecated
func (*Base) GetCreateAt ¶
func (*Base) GetDescribeHash ¶
func (*Base) GetDescribeHashChanged ¶
func (*Base) GetNamespace ¶
func (*Base) GetResourceHash ¶
func (*Base) GetResourceHashChanged ¶
func (*Base) GetResourceType ¶
func (*Base) GetSecretId ¶
func (*Base) GetSharedPolicy ¶
func (x *Base) GetSharedPolicy() *SharedPolicy
func (*Base) GetUsageMode ¶
func (*Base) ProtoMessage ¶
func (*Base) ProtoMessage()
func (*Base) ProtoReflect ¶
func (x *Base) ProtoReflect() protoreflect.Message
type Information ¶
type Information struct { // 过期时间 // @gotags: json:"expire_at" ExpireAt int64 `protobuf:"varint,1,opt,name=expire_at,json=expireAt,proto3" json:"expire_at,omitempty"` // 种类, 计算型, 内存型 // @gotags: json:"category" Category string `protobuf:"bytes,2,opt,name=category,proto3" json:"category,omitempty"` // 规格, small(1u1g), 根据云商的概念 // @gotags: json:"type" Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` // 资源名称 // @gotags: json:"name" Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` // 资源描述 // @gotags: json:"description" Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` // 服务商中的状态, 需要统一多个云商的状态 // @gotags: json:"status" Status string `protobuf:"bytes,6,opt,name=status,proto3" json:"status,omitempty"` // 资源标签, key=value 一个表情 // @gotags: json:"tags" Tags []*Tag `protobuf:"bytes,7,rep,name=tags,proto3" json:"tags,omitempty"` // 更新时间 // @gotags: json:"update_at" UpdateAt int64 `protobuf:"varint,8,opt,name=update_at,json=updateAt,proto3" json:"update_at,omitempty"` // 资源所属的账号 // @gotags: json:"sync_account" SyncAccount string `protobuf:"bytes,9,opt,name=sync_account,json=syncAccount,proto3" json:"sync_account,omitempty"` // 公网IP, 或者域名 // @gotags: json:"public_ip" PublicIp []string `protobuf:"bytes,10,rep,name=public_ip,json=publicIp,proto3" json:"public_ip,omitempty"` // 内网IP, 或者域名 // @gotags: json:"private_ip" PrivateIp []string `protobuf:"bytes,11,rep,name=private_ip,json=privateIp,proto3" json:"private_ip,omitempty"` // 实例付费方式, 按量, 包年包月, 买断(自己针对IDC) // @gotags: json:"pay_type" PayType string `protobuf:"bytes,12,opt,name=pay_type,json=payType,proto3" json:"pay_type,omitempty"` // contains filtered or unexported fields }
通过属性, 可能变化, 用于快速解索资源
func (*Information) AddTag ¶
func (r *Information) AddTag(t *Tag)
func (*Information) Descriptor
deprecated
func (*Information) Descriptor() ([]byte, []int)
Deprecated: Use Information.ProtoReflect.Descriptor instead.
func (*Information) GetCategory ¶
func (x *Information) GetCategory() string
func (*Information) GetDescription ¶
func (x *Information) GetDescription() string
func (*Information) GetExpireAt ¶
func (x *Information) GetExpireAt() int64
func (*Information) GetName ¶
func (x *Information) GetName() string
func (*Information) GetPayType ¶
func (x *Information) GetPayType() string
func (*Information) GetPrivateIp ¶
func (x *Information) GetPrivateIp() []string
func (*Information) GetPublicIp ¶
func (x *Information) GetPublicIp() []string
func (*Information) GetStatus ¶
func (x *Information) GetStatus() string
func (*Information) GetSyncAccount ¶
func (x *Information) GetSyncAccount() string
func (*Information) GetTags ¶
func (x *Information) GetTags() []*Tag
func (*Information) GetType ¶
func (x *Information) GetType() string
func (*Information) GetUpdateAt ¶
func (x *Information) GetUpdateAt() int64
func (*Information) Hash ¶
func (i *Information) Hash() string
func (*Information) LoadPrivateIPString ¶
func (i *Information) LoadPrivateIPString(s string)
func (*Information) LoadPublicIPString ¶
func (i *Information) LoadPublicIPString(s string)
func (*Information) PrivateIPToString ¶
func (i *Information) PrivateIPToString() string
func (*Information) ProtoMessage ¶
func (*Information) ProtoMessage()
func (*Information) ProtoReflect ¶
func (x *Information) ProtoReflect() protoreflect.Message
func (*Information) PublicIPToString ¶
func (i *Information) PublicIPToString() string
func (*Information) Reset ¶
func (x *Information) Reset()
func (*Information) String ¶
func (x *Information) String() string
type QueryTagRequest ¶
type QueryTagRequest struct { // 资源id // @gotags: json:"resource_ids" ResourceIds []string `protobuf:"bytes,1,rep,name=resource_ids,json=resourceIds,proto3" json:"resource_ids,omitempty"` // contains filtered or unexported fields }
func (*QueryTagRequest) Descriptor
deprecated
func (*QueryTagRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryTagRequest.ProtoReflect.Descriptor instead.
func (*QueryTagRequest) GetResourceIds ¶
func (x *QueryTagRequest) GetResourceIds() []string
func (*QueryTagRequest) ProtoMessage ¶
func (*QueryTagRequest) ProtoMessage()
func (*QueryTagRequest) ProtoReflect ¶
func (x *QueryTagRequest) ProtoReflect() protoreflect.Message
func (*QueryTagRequest) Reset ¶
func (x *QueryTagRequest) Reset()
func (*QueryTagRequest) String ¶
func (x *QueryTagRequest) String() string
type Resource ¶
type Resource struct { // 资源元数据信息, 固有属性, 比如云商 // @gotags: json:"base" Base *Base `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` // 资源信息, 通用信息, 允许变化, 比如IP // @gotags: json:"information" Information *Information `protobuf:"bytes,2,opt,name=information,proto3" json:"information,omitempty"` // contains filtered or unexported fields }
用于资源的快速解锁
func NewDefaultResource ¶
func NewDefaultResource() *Resource
func (*Resource) Descriptor
deprecated
func (*Resource) GetInformation ¶
func (x *Resource) GetInformation() *Information
func (*Resource) ProtoMessage ¶
func (*Resource) ProtoMessage()
func (*Resource) ProtoReflect ¶
func (x *Resource) ProtoReflect() protoreflect.Message
type ResourceSet ¶
type ResourceSet struct { // @gotags: json:"total" Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` // @gotags: json:"items" Items []*Resource `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` // 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) ProtoMessage ¶
func (*ResourceSet) ProtoMessage()
func (*ResourceSet) ProtoReflect ¶
func (x *ResourceSet) ProtoReflect() protoreflect.Message
func (*ResourceSet) Reset ¶
func (x *ResourceSet) Reset()
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,omitempty"` // 资源所属域 // @gotags: json:"domain" Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"` // 资源所属空间 // @gotags: json:"namespace" Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` // 资源所属环境 // @gotags: json:"env" Env string `protobuf:"bytes,4,opt,name=env,proto3" json:"env,omitempty"` // 使用方式 // @gotags: json:"usage_mode" UsageMode *UsageMode `protobuf:"varint,5,opt,name=usage_mode,json=usageMode,proto3,enum=cmdb.resource.UsageMode,oneof" json:"usage_mode,omitempty"` // 厂商 // @gotags: json:"vendor" Vendor *Vendor `protobuf:"varint,6,opt,name=vendor,proto3,enum=cmdb.resource.Vendor,oneof" json:"vendor,omitempty"` // 同步的账号 // @gotags: json:"sync_account" SyncAccount string `protobuf:"bytes,7,opt,name=sync_account,json=syncAccount,proto3" json:"sync_account,omitempty"` // 资源类型, optional protoc编译过后--> 指针类型, 意思允许为空指针 // @gotags: json:"type" Type *Type `protobuf:"varint,8,opt,name=type,proto3,enum=cmdb.resource.Type,oneof" json:"type,omitempty"` // 服务商中的状态 // @gotags: json:"status" Status string `protobuf:"bytes,9,opt,name=status,proto3" json:"status,omitempty"` // 资源标签 // @gotags: json:"tags" Tags []*TagSelector `protobuf:"bytes,10,rep,name=tags,proto3" json:"tags,omitempty"` // 是否返回资源的标签, 如果标签很多,你有不想要, 可以控制返回该资源的标签? // 提升性能, 避免以下不必要数据的传输 // @gotags: json:"with_tags" WithTags bool `protobuf:"varint,11,opt,name=with_tags,json=withTags,proto3" json:"with_tags,omitempty"` // 关键字参数 // @gotags: json:"keywords" Keywords string `protobuf:"bytes,14,opt,name=keywords,proto3" json:"keywords,omitempty"` // 是否精确匹配, 比如你要匹配IP, 10,10.1.1 10.10.1.1xx // @gotags: json:"exact_match" ExactMatch bool `protobuf:"varint,15,opt,name=exact_match,json=exactMatch,proto3" json:"exact_match,omitempty"` // contains filtered or unexported fields }
func NewSearchRequestFromHTTP ¶
func NewSearchRequestFromHTTP(r *http.Request) (*SearchRequest, error)
keywords=xx&domain=xx&tag=app=~app1,app2,app3
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) GetExactMatch ¶
func (x *SearchRequest) GetExactMatch() bool
func (*SearchRequest) GetKeywords ¶
func (x *SearchRequest) GetKeywords() string
func (*SearchRequest) GetNamespace ¶
func (x *SearchRequest) GetNamespace() string
func (*SearchRequest) GetPage ¶
func (x *SearchRequest) GetPage() *request.PageRequest
func (*SearchRequest) GetStatus ¶
func (x *SearchRequest) GetStatus() string
func (*SearchRequest) GetSyncAccount ¶
func (x *SearchRequest) GetSyncAccount() string
func (*SearchRequest) GetTags ¶
func (x *SearchRequest) GetTags() []*TagSelector
func (*SearchRequest) GetType ¶
func (x *SearchRequest) GetType() Type
func (*SearchRequest) GetUsageMode ¶
func (x *SearchRequest) GetUsageMode() UsageMode
func (*SearchRequest) GetVendor ¶
func (x *SearchRequest) GetVendor() Vendor
func (*SearchRequest) GetWithTags ¶
func (x *SearchRequest) GetWithTags() bool
func (*SearchRequest) HasTag ¶
func (r *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 ServiceClient ¶
type ServiceClient interface { Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*ResourceSet, error) QueryTag(ctx context.Context, in *QueryTagRequest, opts ...grpc.CallOption) (*TagSet, error) UpdateTag(ctx context.Context, in *UpdateTagRequest, opts ...grpc.CallOption) (*Resource, 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 { Search(context.Context, *SearchRequest) (*ResourceSet, error) QueryTag(context.Context, *QueryTagRequest) (*TagSet, error) UpdateTag(context.Context, *UpdateTagRequest) (*Resource, error) // contains filtered or unexported methods }
ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility
type SharedPolicy ¶
type SharedPolicy struct { // @gotags: json:"tag_key" TagKey string `protobuf:"bytes,1,opt,name=tag_key,json=tagKey,proto3" json:"tag_key,omitempty"` // @gotags: json:"tag_values" TagValues []string `protobuf:"bytes,2,rep,name=tag_values,json=tagValues,proto3" json:"tag_values,omitempty"` // 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 Tag ¶
type Tag struct { // 标签属于的资源, 通过resource_id来进行关联, 根据数据库设计有关系 // @gotags: json:"resource_id" ResourceId string `protobuf:"bytes,1,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"` // 标签的类型 // @gotags: json:"type" Type TagType `protobuf:"varint,2,opt,name=type,proto3,enum=cmdb.resource.TagType" json:"type,omitempty"` // 标签的Key // @gotags: json:"key" validate:"lte=255,required" Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` // 标签的值, 可读性不好, appid=0xxx0111 // @gotags: json:"value" validate:"lte=255,required" Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` // 标签的值的描述, 通常用于展示, 财务系统a // @gotags: json:"describe" Describe string `protobuf:"bytes,5,opt,name=describe,proto3" json:"describe,omitempty"` // 标签权重, 针对同一个key, 多个value场景, 默认值1 // 有一个资源A, 费用100, 被多个业务方共同使用, 出业务成本, 面临这个成本如何分摊的问题? // 为了让分摊更加灵活, 添加标签的权重, 更加权重的值做具体分摊比例计算, 比如 a:1(1/4), b:2(2/4), c:1(1/4) // 默认公平分摊, 默认就是1, 更加自由使用量俩进行分摊, 外部系统(监控系统) 通过使用计算出权重, 设置过来 // @gotags: json:"weight" Weight int64 `protobuf:"varint,6,opt,name=weight,proto3" json:"weight,omitempty"` // 标签是否纳入成本统计, 比如监控标签就不需要纳入到成本统计 // @gotags: json:"is_cost" IsCost bool `protobuf:"varint,7,opt,name=is_cost,json=isCost,proto3" json:"is_cost,omitempty"` // 标签是否隐藏, 用于控制是否在前端展示 // @gotags: json:"hidden" Hidden bool `protobuf:"varint,8,opt,name=hidden,proto3" json:"hidden,omitempty"` // 标签meta信息, 比如前端需要设置标签的颜色 // @gotags: json:"meta" Meta map[string]string `` /* 150-byte string literal not displayed */ // contains filtered or unexported fields }
func NewDefaultTag ¶
func NewDefaultTag() *Tag
func (*Tag) Descriptor
deprecated
func (*Tag) GetDescribe ¶
func (*Tag) GetResourceId ¶
func (*Tag) ProtoMessage ¶
func (*Tag) ProtoMessage()
func (*Tag) ProtoReflect ¶
func (x *Tag) ProtoReflect() protoreflect.Message
type TagSelector ¶
type TagSelector struct { // 匹配的key, 支持LIKE匹配 // @gotags: json:"key" Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // 匹配符 // @gotags: json:"operator" Operator string `protobuf:"bytes,2,opt,name=operator,proto3" json:"operator,omitempty"` // 匹配的值, 支持多个值匹配 // @gotags: json:"values" Values []string `protobuf:"bytes,3,rep,name=values,proto3" json:"values,omitempty"` // contains filtered or unexported fields }
Tag选择器, 通过key value进行匹配, app-atrr1, app-atrr2 以下连个标签共同组成一套业务逻辑, 需要过滤: promethues.io 开头的标签 promethues.io/port = "xxxx" promethues.io/metric_path = "xxxx"
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) GetOperator ¶
func (x *TagSelector) GetOperator() 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,omitempty"` // @gotags: json:"items" Items []*Tag `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` // contains filtered or unexported fields }
func (*TagSet) Descriptor
deprecated
func (*TagSet) ProtoMessage ¶
func (*TagSet) ProtoMessage()
func (*TagSet) ProtoReflect ¶
func (x *TagSet) ProtoReflect() protoreflect.Message
type TagType ¶
type TagType int32
func ParseTagTypeFromString ¶
ParseTagTypeFromString Parse TagType from string
func (TagType) Descriptor ¶
func (TagType) Descriptor() protoreflect.EnumDescriptor
func (TagType) EnumDescriptor
deprecated
func (TagType) Number ¶
func (x TagType) Number() protoreflect.EnumNumber
func (TagType) Type ¶
func (TagType) Type() protoreflect.EnumType
type Type ¶
type Type int32
func ParseTypeFromString ¶
ParseTypeFromString Parse Type from string
func (Type) Descriptor ¶
func (Type) Descriptor() protoreflect.EnumDescriptor
func (Type) EnumDescriptor
deprecated
func (Type) Number ¶
func (x Type) Number() protoreflect.EnumNumber
func (Type) Type ¶
func (Type) Type() protoreflect.EnumType
type UnimplementedServiceServer ¶
type UnimplementedServiceServer struct { }
UnimplementedServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedServiceServer) QueryTag ¶
func (UnimplementedServiceServer) QueryTag(context.Context, *QueryTagRequest) (*TagSet, error)
func (UnimplementedServiceServer) Search ¶
func (UnimplementedServiceServer) Search(context.Context, *SearchRequest) (*ResourceSet, error)
func (UnimplementedServiceServer) UpdateTag ¶
func (UnimplementedServiceServer) UpdateTag(context.Context, *UpdateTagRequest) (*Resource, 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 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) Descriptor() protoreflect.EnumDescriptor
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) MarshalJSON ¶
func (t UpdateAction) MarshalJSON() ([]byte, error)
MarshalJSON todo
func (UpdateAction) Number ¶
func (x UpdateAction) Number() protoreflect.EnumNumber
func (UpdateAction) String ¶
func (x UpdateAction) String() string
func (UpdateAction) Type ¶
func (UpdateAction) Type() protoreflect.EnumType
func (*UpdateAction) UnmarshalJSON ¶
func (t *UpdateAction) UnmarshalJSON(b []byte) error
UnmarshalJSON todo
type UpdateTagRequest ¶
type UpdateTagRequest struct { // 资源id, 你要修改那个资源的标签 // @gotags: json:"id" validate:"required" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 资源id // @gotags: json:"action" Action UpdateAction `protobuf:"varint,2,opt,name=action,proto3,enum=cmdb.resource.UpdateAction" json:"action,omitempty"` // 需要修改的资源标签 // @gotags: json:"tags" validate:"required" Tags []*Tag `protobuf:"bytes,3,rep,name=tags,proto3" json:"tags,omitempty"` // contains filtered or unexported fields }
func (*UpdateTagRequest) Descriptor
deprecated
func (*UpdateTagRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateTagRequest.ProtoReflect.Descriptor instead.
func (*UpdateTagRequest) GetAction ¶
func (x *UpdateTagRequest) GetAction() UpdateAction
func (*UpdateTagRequest) GetId ¶
func (x *UpdateTagRequest) GetId() string
func (*UpdateTagRequest) GetTags ¶
func (x *UpdateTagRequest) GetTags() []*Tag
func (*UpdateTagRequest) ProtoMessage ¶
func (*UpdateTagRequest) ProtoMessage()
func (*UpdateTagRequest) ProtoReflect ¶
func (x *UpdateTagRequest) ProtoReflect() protoreflect.Message
func (*UpdateTagRequest) Reset ¶
func (x *UpdateTagRequest) Reset()
func (*UpdateTagRequest) String ¶
func (x *UpdateTagRequest) String() string
type UsageMode ¶
type UsageMode int32
使用方式
func ParseUsageModeFromString ¶
ParseUsageModeFromString Parse UsageMode from string
func (UsageMode) Descriptor ¶
func (UsageMode) Descriptor() protoreflect.EnumDescriptor
func (UsageMode) EnumDescriptor
deprecated
func (UsageMode) Number ¶
func (x UsageMode) Number() protoreflect.EnumNumber
func (UsageMode) Type ¶
func (UsageMode) Type() protoreflect.EnumType
func (*UsageMode) UnmarshalJSON ¶
UnmarshalJSON todo
type Vendor ¶
type Vendor int32
func ParseVendorFromString ¶
ParseVendorFromString Parse Vendor from string
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