Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterRpcServer(s grpc.ServiceRegistrar, srv RpcServer)
- type DescResourceRequest
- func (*DescResourceRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DescResourceRequest) GetResourceId() string
- func (*DescResourceRequest) ProtoMessage()
- func (x *DescResourceRequest) ProtoReflect() protoreflect.Message
- func (x *DescResourceRequest) Reset()
- func (x *DescResourceRequest) String() string
- type Meta
- type QueryResourceRequest
- func (*QueryResourceRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryResourceRequest) GetKeyword() string
- func (x *QueryResourceRequest) GetPageNum() int64
- func (x *QueryResourceRequest) GetPageSize() int64
- func (x *QueryResourceRequest) GetType() Type
- func (*QueryResourceRequest) ProtoMessage()
- func (x *QueryResourceRequest) ProtoReflect() protoreflect.Message
- func (x *QueryResourceRequest) Reset()
- func (x *QueryResourceRequest) String() string
- type QueryType
- type Resource
- 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) 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) GetPublicAddress() []string
- func (x *Spec) GetRegion() string
- func (x *Spec) GetResourceId() string
- func (x *Spec) GetStatus() string
- func (x *Spec) GetStorage() int64
- func (x *Spec) GetType() Type
- func (x *Spec) GetVendor() Vendor
- 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
- type UnimplementedRpcServer
- type UnsafeRpcServer
- type Vendor
Constants ¶
const ( Rpc_CreateResource_FullMethodName = "/cmdb.resource.Rpc/CreateResource" Rpc_DescResource_FullMethodName = "/cmdb.resource.Rpc/DescResource" Rpc_QueryResource_FullMethodName = "/cmdb.resource.Rpc/QueryResource" )
const AppName = "resource"
Variables ¶
var ( Vendor_name = map[int32]string{ 0: "VENDOR_UNSPECIFIED", 1: "VENDOR_ALI", 2: "VENDOR_TENCENT", } Vendor_value = map[string]int32{ "VENDOR_UNSPECIFIED": 0, "VENDOR_ALI": 1, "VENDOR_TENCENT": 2, } )
Enum value maps for Vendor.
var ( Type_name = map[int32]string{ 0: "TYPE_UNSPECIFIED", 1: "TYPE_ECS", 2: "TYPE_RDS", } Type_value = map[string]int32{ "TYPE_UNSPECIFIED": 0, "TYPE_ECS": 1, "TYPE_RDS": 2, } )
Enum value maps for Type.
var ( QueryType_name = map[int32]string{ 0: "QUERY_TYPE_UNSPECIFIED", 1: "QUERY_TYPE_VENDOR", } QueryType_value = map[string]int32{ "QUERY_TYPE_UNSPECIFIED": 0, "QUERY_TYPE_VENDOR": 1, } )
Enum value maps for QueryType.
var File_apps_resource_pb_model_proto protoreflect.FileDescriptor
var File_apps_resource_pb_rpc_proto protoreflect.FileDescriptor
var Rpc_ServiceDesc = grpc.ServiceDesc{ ServiceName: "cmdb.resource.Rpc", HandlerType: (*RpcServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreateResource", Handler: _Rpc_CreateResource_Handler, }, { MethodName: "DescResource", Handler: _Rpc_DescResource_Handler, }, { MethodName: "QueryResource", Handler: _Rpc_QueryResource_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 RegisterRpcServer ¶
func RegisterRpcServer(s grpc.ServiceRegistrar, srv RpcServer)
Types ¶
type DescResourceRequest ¶
type DescResourceRequest struct { // @gotags: validate:"required" ResourceId string `protobuf:"bytes,1,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty" validate:"required"` // contains filtered or unexported fields }
func (*DescResourceRequest) Descriptor
deprecated
func (*DescResourceRequest) Descriptor() ([]byte, []int)
Deprecated: Use DescResourceRequest.ProtoReflect.Descriptor instead.
func (*DescResourceRequest) GetResourceId ¶
func (x *DescResourceRequest) GetResourceId() string
func (*DescResourceRequest) ProtoMessage ¶
func (*DescResourceRequest) ProtoMessage()
func (*DescResourceRequest) ProtoReflect ¶
func (x *DescResourceRequest) ProtoReflect() protoreflect.Message
func (*DescResourceRequest) Reset ¶
func (x *DescResourceRequest) Reset()
func (*DescResourceRequest) String ¶
func (x *DescResourceRequest) String() string
type Meta ¶
type Meta struct { // @gotags: json:"created_at" gorm:"primaryKey" Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"created_at" gorm:"primaryKey"` // @gotags: json:"created_at" gorm:"autoCreateTime" CreatedAt int64 `protobuf:"varint,2,opt,name=created_at,json=createdAt,proto3" json:"created_at" gorm:"autoCreateTime"` // @gotags: json:"updated_at" gorm:"autoUpdateTime" UpdatedAt int64 `protobuf:"varint,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at" gorm:"autoUpdateTime"` // contains filtered or unexported fields }
func (*Meta) Descriptor
deprecated
func (*Meta) GetCreatedAt ¶
func (*Meta) GetUpdatedAt ¶
func (*Meta) ProtoMessage ¶
func (*Meta) ProtoMessage()
func (*Meta) ProtoReflect ¶
func (x *Meta) ProtoReflect() protoreflect.Message
type QueryResourceRequest ¶
type QueryResourceRequest struct { // @gotags: validate:"required" PageNum int64 `protobuf:"varint,1,opt,name=page_num,json=pageNum,proto3" json:"page_num,omitempty" validate:"required"` // @gotags: validate:"required" PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty" validate:"required"` Type Type `protobuf:"varint,3,opt,name=type,proto3,enum=cmdb.resource.Type" json:"type,omitempty"` Keyword string `protobuf:"bytes,4,opt,name=keyword,proto3" json:"keyword,omitempty"` // contains filtered or unexported fields }
func (*QueryResourceRequest) Descriptor
deprecated
func (*QueryResourceRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryResourceRequest.ProtoReflect.Descriptor instead.
func (*QueryResourceRequest) GetKeyword ¶
func (x *QueryResourceRequest) GetKeyword() string
func (*QueryResourceRequest) GetPageNum ¶
func (x *QueryResourceRequest) GetPageNum() int64
func (*QueryResourceRequest) GetPageSize ¶
func (x *QueryResourceRequest) GetPageSize() int64
func (*QueryResourceRequest) GetType ¶
func (x *QueryResourceRequest) GetType() Type
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 QueryType ¶
type QueryType int32
func (QueryType) Descriptor ¶
func (QueryType) Descriptor() protoreflect.EnumDescriptor
func (QueryType) EnumDescriptor
deprecated
func (QueryType) Number ¶
func (x QueryType) Number() protoreflect.EnumNumber
func (QueryType) Type ¶
func (QueryType) Type() protoreflect.EnumType
type Resource ¶
type Resource struct { // @gotags: gorm:"embedded" Meta *Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta,omitempty" gorm:"embedded"` // @gotags: gorm:"embedded" Spec *Spec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec,omitempty" gorm:"embedded"` // contains filtered or unexported fields }
func (*Resource) Descriptor
deprecated
func (*Resource) ProtoMessage ¶
func (*Resource) ProtoMessage()
func (*Resource) ProtoReflect ¶
func (x *Resource) ProtoReflect() protoreflect.Message
type ResourceSet ¶
type ResourceSet struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Items []*Resource `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` // 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 *Spec, opts ...grpc.CallOption) (*Resource, error) DescResource(ctx context.Context, in *DescResourceRequest, 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, *Spec) (*Resource, error) DescResource(context.Context, *DescResourceRequest) (*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 { // --------------------------------------------- 通用属性 --------------------------------------------- Vendor Vendor `protobuf:"varint,1,opt,name=vendor,proto3,enum=cmdb.resource.Vendor" json:"vendor,omitempty"` Type Type `protobuf:"varint,2,opt,name=type,proto3,enum=cmdb.resource.Type" json:"type,omitempty"` // @gotags: gorm:"unique" ResourceId string `protobuf:"bytes,3,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty" gorm:"unique"` Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` Region string `protobuf:"bytes,5,opt,name=region,proto3" json:"region,omitempty"` Zone string `protobuf:"bytes,6,opt,name=zone,proto3" json:"zone,omitempty"` Status string `protobuf:"bytes,7,opt,name=status,proto3" json:"status,omitempty"` // --------------------------------------------- 运维属性 --------------------------------------------- // @gotags: gorm:"json" PrivateAddress []string `protobuf:"bytes,8,rep,name=private_address,json=privateAddress,proto3" json:"private_address,omitempty" gorm:"json"` // @gotags: gorm:"json" PublicAddress []string `protobuf:"bytes,9,rep,name=public_address,json=publicAddress,proto3" json:"public_address,omitempty" gorm:"json"` Cpu int32 `protobuf:"varint,10,opt,name=cpu,proto3" json:"cpu,omitempty"` Memory int64 `protobuf:"varint,11,opt,name=memory,proto3" json:"memory,omitempty"` Storage int64 `protobuf:"varint,12,opt,name=storage,proto3" json:"storage,omitempty"` // --------------------------------------------- 其他属性 --------------------------------------------- // @gotags: gorm:"json" Extra map[string]string `` /* 164-byte string literal not displayed */ // contains filtered or unexported fields }
func (*Spec) Descriptor
deprecated
func (*Spec) GetPrivateAddress ¶
func (*Spec) GetPublicAddress ¶
func (*Spec) GetResourceId ¶
func (*Spec) GetStorage ¶
func (*Spec) ProtoMessage ¶
func (*Spec) ProtoMessage()
func (*Spec) ProtoReflect ¶
func (x *Spec) ProtoReflect() protoreflect.Message
type Type ¶
type Type int32
Type 资源类型
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) DescResource ¶
func (UnimplementedRpcServer) DescResource(context.Context, *DescResourceRequest) (*Resource, error)
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.
type Vendor ¶
type Vendor int32
func (Vendor) Descriptor ¶
func (Vendor) Descriptor() protoreflect.EnumDescriptor
func (Vendor) EnumDescriptor
deprecated
func (Vendor) Number ¶
func (x Vendor) Number() protoreflect.EnumNumber
func (Vendor) Type ¶
func (Vendor) Type() protoreflect.EnumType