Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterRpcServer(s grpc.ServiceRegistrar, srv RpcServer)
- type PROVIDER
- func (PROVIDER) Descriptor() protoreflect.EnumDescriptor
- func (x PROVIDER) Enum() *PROVIDER
- func (PROVIDER) EnumDescriptor() ([]byte, []int)deprecated
- func (t PROVIDER) Equal(target PROVIDER) bool
- func (t PROVIDER) IsIn(targets ...PROVIDER) bool
- func (t PROVIDER) MarshalJSON() ([]byte, error)
- func (x PROVIDER) Number() protoreflect.EnumNumber
- func (x PROVIDER) String() string
- func (PROVIDER) Type() protoreflect.EnumType
- func (t *PROVIDER) UnmarshalJSON(b []byte) error
- type QueryResourceRequest
- type Resource
- func (*Resource) Descriptor() ([]byte, []int)deprecated
- func (x *Resource) GetMeta() *resource.Meta
- func (x *Resource) GetSpec() *Spec
- func (r *Resource) MakeDefault()
- func (*Resource) ProtoMessage()
- func (x *Resource) ProtoReflect() protoreflect.Message
- func (x *Resource) Reset()
- func (r *Resource) ShortDesc() string
- func (x *Resource) String() string
- type ResourceSet
- 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 RpcClient
- type RpcServer
- type Service
- type Spec
- func (*Spec) Descriptor() ([]byte, []int)deprecated
- func (x *Spec) GetAccount() string
- func (x *Spec) GetClass() string
- func (x *Spec) GetCpu() int32
- func (x *Spec) GetExtra() map[string]string
- func (x *Spec) GetMemory() int64
- func (x *Spec) GetName() string
- func (x *Spec) GetPrivateAddress() []string
- func (x *Spec) GetProvider() PROVIDER
- func (x *Spec) GetPublicAddress() []string
- func (x *Spec) GetRegion() string
- func (x *Spec) GetSecretId() string
- func (x *Spec) GetStatus() string
- func (x *Spec) GetStorage() int64
- func (x *Spec) GetType() TYPE
- func (x *Spec) GetZone() string
- func (*Spec) ProtoMessage()
- func (x *Spec) ProtoReflect() protoreflect.Message
- func (x *Spec) Reset()
- func (x *Spec) String() string
- 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 UnimplementedRpcServer
- type UnsafeRpcServer
Constants ¶
const ( Rpc_CreateResource_FullMethodName = "/go11.devcloud_mini.cmdb.resource.Rpc/CreateResource" Rpc_QueryResource_FullMethodName = "/go11.devcloud_mini.cmdb.resource.Rpc/QueryResource" )
const (
AppName = "resource"
)
Variables ¶
var ( TYPE_name = map[int32]string{ 0: "UNKONW", 1: "HOST", 2: "RDS", } TYPE_value = map[string]int32{ "UNKONW": 0, "HOST": 1, "RDS": 2, } )
Enum value maps for TYPE.
var ( PROVIDER_name = map[int32]string{ 0: "TENCENT", 1: "VMWARE", 2: "OPENSTACK", 3: "IDC", } PROVIDER_value = map[string]int32{ "TENCENT": 0, "VMWARE": 1, "OPENSTACK": 2, "IDC": 3, } )
Enum value maps for PROVIDER.
var File_cmdb_apps_resource_pb_model_proto protoreflect.FileDescriptor
var File_cmdb_apps_resource_pb_rpc_proto protoreflect.FileDescriptor
var Rpc_ServiceDesc = grpc.ServiceDesc{ ServiceName: "go11.devcloud_mini.cmdb.resource.Rpc", HandlerType: (*RpcServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreateResource", Handler: _Rpc_CreateResource_Handler, }, { MethodName: "QueryResource", Handler: _Rpc_QueryResource_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "cmdb/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 RegisterRpcServer ¶
func RegisterRpcServer(s grpc.ServiceRegistrar, srv RpcServer)
Types ¶
type PROVIDER ¶
type PROVIDER int32
func ParsePROVIDERFromString ¶
ParsePROVIDERFromString Parse PROVIDER from string
func (PROVIDER) Descriptor ¶
func (PROVIDER) Descriptor() protoreflect.EnumDescriptor
func (PROVIDER) EnumDescriptor
deprecated
func (PROVIDER) Number ¶
func (x PROVIDER) Number() protoreflect.EnumNumber
func (PROVIDER) Type ¶
func (PROVIDER) Type() protoreflect.EnumType
func (*PROVIDER) UnmarshalJSON ¶
UnmarshalJSON todo
type QueryResourceRequest ¶
type QueryResourceRequest struct {
// contains filtered or unexported fields
}
func NewQueryResourceRequest ¶
func NewQueryResourceRequest() *QueryResourceRequest
func (*QueryResourceRequest) Descriptor
deprecated
func (*QueryResourceRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryResourceRequest.ProtoReflect.Descriptor instead.
func (*QueryResourceRequest) ProtoMessage ¶
func (*QueryResourceRequest) ProtoMessage()
func (*QueryResourceRequest) ProtoReflect ¶
func (x *QueryResourceRequest) ProtoReflect() protoreflect.Message
func (*QueryResourceRequest) Reset ¶
func (x *QueryResourceRequest) Reset()
func (*QueryResourceRequest) String ¶
func (x *QueryResourceRequest) String() string
type Resource ¶
type Resource struct { // 元数据信息 // @gotags: json:"meta" bson:",inline" Meta *resource.Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta" bson:",inline"` // 资源的定义 // @gotags: json:"spec" bson:",inline" Spec *Spec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec" bson:",inline"` // contains filtered or unexported fields }
func NewResource ¶
func NewResource() *Resource
func (*Resource) Descriptor
deprecated
func (*Resource) MakeDefault ¶
func (r *Resource) MakeDefault()
func (*Resource) ProtoMessage ¶
func (*Resource) ProtoMessage()
func (*Resource) ProtoReflect ¶
func (x *Resource) ProtoReflect() protoreflect.Message
type ResourceSet ¶
type ResourceSet struct { // 总数 // @gotags: json:"total" bson:"total" Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"` // 清单 // @gotags: json:"items" bson:"items" Items []*Resource `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"` // contains filtered or unexported fields }
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 RpcClient ¶
type RpcClient interface { // 创建资源 CreateResource(ctx context.Context, in *Resource, opts ...grpc.CallOption) (*Resource, error) // 查询资源 QueryResource(ctx context.Context, in *QueryResourceRequest, 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 { // 创建资源 CreateResource(context.Context, *Resource) (*Resource, error) // 查询资源 QueryResource(context.Context, *QueryResourceRequest) (*ResourceSet, error) // contains filtered or unexported methods }
RpcServer is the server API for Rpc service. All implementations must embed UnimplementedRpcServer for forward compatibility
type Spec ¶
type Spec struct { // 通用属性 // 资源名称 // @gotags: json:"name" bson:"name" Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" bson:"name"` // 资源规格 // @gotags: json:"type" bson:"type" Type TYPE `protobuf:"varint,8,opt,name=type,proto3,enum=go11.devcloud_mini.cmdb.resource.TYPE" json:"type" bson:"type"` // 资源规格, io,xxx // @gotags: json:"class" bson:"class" Class string `protobuf:"bytes,7,opt,name=class,proto3" json:"class" bson:"class"` // 资源关联的secret id, 方便我们直接使用 资源关联的secret来进行管理 // @gotags: json:"secret_id" bson:"secret_id" SecretId string `protobuf:"bytes,2,opt,name=secret_id,json=secretId,proto3" json:"secret_id" bson:"secret_id"` // 资源属于哪个账号, 用于做账号过滤 // @gotags: json:"account" bson:"account" Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account" bson:"account"` // 资源属于哪个云商<过滤条件> // @gotags: json:"provider" bson:"provider" Provider PROVIDER `protobuf:"varint,4,opt,name=provider,proto3,enum=go11.devcloud_mini.cmdb.resource.PROVIDER" json:"provider" bson:"provider"` // 资源属于哪个地域 // @gotags: json:"region" bson:"region" Region string `protobuf:"bytes,5,opt,name=region,proto3" json:"region" bson:"region"` // 资源属于哪个可用区 // @gotags: json:"zone" bson:"zone" Zone string `protobuf:"bytes,6,opt,name=zone,proto3" json:"zone" bson:"zone"` // 资源属于哪个可用区 // @gotags: json:"status" bson:"status" Status string `protobuf:"bytes,9,opt,name=status,proto3" json:"status" bson:"status"` // 针对运维 IT 来说的特殊属性 // 网络 // 资源内网地址 // @gotags: json:"private_address" bson:"private_address" PrivateAddress []string `protobuf:"bytes,10,rep,name=private_address,json=privateAddress,proto3" json:"private_address" bson:"private_address"` // 资源公网地址 // @gotags: json:"public_address" bson:"public_address" PublicAddress []string `protobuf:"bytes,11,rep,name=public_address,json=publicAddress,proto3" json:"public_address" bson:"public_address"` // 计算 // 资源cpu // @gotags: json:"cpu" bson:"cpu" Cpu int32 `protobuf:"varint,12,opt,name=cpu,proto3" json:"cpu" bson:"cpu"` // 资源内存, 单位为M // @gotags: json:"memory" bson:"memory" Memory int64 `protobuf:"varint,13,opt,name=memory,proto3" json:"memory" bson:"memory"` // 存储, 单位G // 资源存储 // @gotags: json:"storage" bson:"storage" Storage int64 `protobuf:"varint,14,opt,name=storage,proto3" json:"storage" bson:"storage"` // 资源的其他属性, ECS: storage // @gotags: json:"extra" bson:"extra" Extra map[string]string `` /* 155-byte string literal not displayed */ // contains filtered or unexported fields }
资源通用属性, 非通用属性直接定义一个map来表示
func (*Spec) Descriptor
deprecated
func (*Spec) GetAccount ¶
func (*Spec) GetPrivateAddress ¶
func (*Spec) GetProvider ¶
func (*Spec) GetPublicAddress ¶
func (*Spec) GetSecretId ¶
func (*Spec) GetStorage ¶
func (*Spec) ProtoMessage ¶
func (*Spec) ProtoMessage()
func (*Spec) ProtoReflect ¶
func (x *Spec) ProtoReflect() protoreflect.Message
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 UnimplementedRpcServer ¶
type UnimplementedRpcServer struct { }
UnimplementedRpcServer must be embedded to have forward compatible implementations.
func (UnimplementedRpcServer) CreateResource ¶
func (UnimplementedRpcServer) QueryResource ¶
func (UnimplementedRpcServer) QueryResource(context.Context, *QueryResourceRequest) (*ResourceSet, error)
type UnsafeRpcServer ¶
type UnsafeRpcServer interface {
// contains filtered or unexported methods
}
UnsafeRpcServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RpcServer will result in compilation errors.