resource

package
v0.0.0-...-b68290d Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Rpc_CreateResource_FullMethodName = "/cmdb.resource.Rpc/CreateResource"
	Rpc_DescResource_FullMethodName   = "/cmdb.resource.Rpc/DescResource"
	Rpc_QueryResource_FullMethodName  = "/cmdb.resource.Rpc/QueryResource"
)
View Source
const AppName = "resource"

Variables

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

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

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

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

Deprecated: Use Meta.ProtoReflect.Descriptor instead.

func (*Meta) GetCreatedAt

func (x *Meta) GetCreatedAt() int64

func (*Meta) GetId

func (x *Meta) GetId() int64

func (*Meta) GetUpdatedAt

func (x *Meta) GetUpdatedAt() int64

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 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
const (
	QueryType_QUERY_TYPE_UNSPECIFIED QueryType = 0
	QueryType_QUERY_TYPE_VENDOR      QueryType = 1
)

func (QueryType) Descriptor

func (QueryType) Descriptor() protoreflect.EnumDescriptor

func (QueryType) Enum

func (x QueryType) Enum() *QueryType

func (QueryType) EnumDescriptor deprecated

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

Deprecated: Use QueryType.Descriptor instead.

func (QueryType) Number

func (x QueryType) Number() protoreflect.EnumNumber

func (QueryType) String

func (x QueryType) String() string

func (QueryType) Type

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

Deprecated: Use Resource.ProtoReflect.Descriptor instead.

func (*Resource) GetMeta

func (x *Resource) GetMeta() *Meta

func (*Resource) GetSpec

func (x *Resource) GetSpec() *Spec

func (*Resource) ProtoMessage

func (*Resource) ProtoMessage()

func (*Resource) ProtoReflect

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

func (*Resource) Reset

func (x *Resource) Reset()

func (*Resource) String

func (x *Resource) String() string

type 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 Service

type Service interface {
	RpcServer
	CreateTable(ctx context.Context) error
}

func GetSvc

func GetSvc() Service

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

Deprecated: Use Spec.ProtoReflect.Descriptor instead.

func (*Spec) GetCpu

func (x *Spec) GetCpu() int32

func (*Spec) GetExtra

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

func (*Spec) GetMemory

func (x *Spec) GetMemory() int64

func (*Spec) GetName

func (x *Spec) GetName() string

func (*Spec) GetPrivateAddress

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

func (*Spec) GetPublicAddress

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

func (*Spec) GetRegion

func (x *Spec) GetRegion() string

func (*Spec) GetResourceId

func (x *Spec) GetResourceId() string

func (*Spec) GetStatus

func (x *Spec) GetStatus() string

func (*Spec) GetStorage

func (x *Spec) GetStorage() int64

func (*Spec) GetType

func (x *Spec) GetType() Type

func (*Spec) GetVendor

func (x *Spec) GetVendor() Vendor

func (*Spec) GetZone

func (x *Spec) GetZone() 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 Type

type Type int32

Type 资源类型

const (
	Type_TYPE_UNSPECIFIED Type = 0
	Type_TYPE_ECS         Type = 1
	Type_TYPE_RDS         Type = 2
)

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

func (x Type) Number() protoreflect.EnumNumber

func (Type) String

func (x Type) String() string

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) CreateResource(context.Context, *Spec) (*Resource, error)

func (UnimplementedRpcServer) DescResource

func (UnimplementedRpcServer) QueryResource

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
const (
	Vendor_VENDOR_UNSPECIFIED Vendor = 0
	Vendor_VENDOR_ALI         Vendor = 1
	Vendor_VENDOR_TENCENT     Vendor = 2
)

func (Vendor) Descriptor

func (Vendor) Descriptor() protoreflect.EnumDescriptor

func (Vendor) Enum

func (x Vendor) Enum() *Vendor

func (Vendor) EnumDescriptor deprecated

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

Deprecated: Use Vendor.Descriptor instead.

func (Vendor) Number

func (x Vendor) Number() protoreflect.EnumNumber

func (Vendor) String

func (x Vendor) String() string

func (Vendor) Type

func (Vendor) Type() protoreflect.EnumType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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