From ac8baa536fe29d87046313e0cbf60dabb6fbce70 Mon Sep 17 00:00:00 2001 From: yumaojun03 <719118794@qq.com> Date: Sun, 2 Mar 2025 16:29:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85Makefile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- devcloud-mini/Makefile | 13 + devcloud-mini/cmdb/Makefile | 54 + devcloud-mini/cmdb/apps/resource/README.md | 5 +- .../cmdb/apps/resource/service.pb.go | 920 ++++++++++++++++++ .../cmdb/apps/resource/service.proto | 147 +++ .../cmdb/apps/resource/service_enum.pb.go | 100 ++ .../cmdb/apps/resource/service_grpc.pb.go | 163 ++++ .../cmdb/apps/resource/service.pb.go | 920 ++++++++++++++++++ .../cmdb/apps/resource/service_grpc.pb.go | 163 ++++ 9 files changed, 2484 insertions(+), 1 deletion(-) create mode 100644 devcloud-mini/Makefile create mode 100644 devcloud-mini/cmdb/Makefile create mode 100644 devcloud-mini/cmdb/apps/resource/service.pb.go create mode 100644 devcloud-mini/cmdb/apps/resource/service.proto create mode 100644 devcloud-mini/cmdb/apps/resource/service_enum.pb.go create mode 100644 devcloud-mini/cmdb/apps/resource/service_grpc.pb.go create mode 100644 devcloud-mini/gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/service.pb.go create mode 100644 devcloud-mini/gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/service_grpc.pb.go diff --git a/devcloud-mini/Makefile b/devcloud-mini/Makefile new file mode 100644 index 0000000..5d22ffc --- /dev/null +++ b/devcloud-mini/Makefile @@ -0,0 +1,13 @@ +PROJECT_NAME := cmdb +OUTPUT_NAME := cmdb +MAIN_FILE := main.go +PKG := gitlab.com/go-course-project/go17/devcloud-mini + +gen: ## Init Service + @protoc -I=. --go_out=. --go_opt=module=${PKG} --go-grpc_out=. --go-grpc_opt=module=${PKG} cmdb/apps/*/*.proto + @go fmt ./... + @protoc-go-inject-tag -input='cmdb/apps/*/*.pb.go' + @mcube enum -p -m cmdb/apps/*/*.pb.go + +help: ## Display this help screen + @grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' \ No newline at end of file diff --git a/devcloud-mini/cmdb/Makefile b/devcloud-mini/cmdb/Makefile new file mode 100644 index 0000000..8894ee3 --- /dev/null +++ b/devcloud-mini/cmdb/Makefile @@ -0,0 +1,54 @@ +PROJECT_NAME := cmdb +OUTPUT_NAME := cmdb +MAIN_FILE := main.go +PKG := gitlab.com/go-course-project/go17/devcloud-mini/cmdb + +.PHONY: all dep lint vet test test-coverage build clean + +all: build + +dep: ## Get the dependencies + @go mod tidy + +lint: ## Lint Golang files + @golint -set_exit_status ${PKG_LIST} + +vet: ## Run go vet + @go vet ${PKG_LIST} + +test: ## Run unittests + @go test -short ${PKG_LIST} + +test-coverage: ## Run tests with coverage + @go test -short -coverprofile cover.out -covermode=atomic ${PKG_LIST} + @cat cover.out >> coverage.txt + +build: dep ## Build the binary file + @go build -a -o dist/${OUTPUT_NAME} -ldflags "-s -w" -ldflags "-X '${VERSION_PATH}.GIT_BRANCH=${BUILD_BRANCH}' -X '${VERSION_PATH}.GIT_COMMIT=${BUILD_COMMIT}' -X '${VERSION_PATH}.BUILD_TIME=${BUILD_TIME}' -X '${VERSION_PATH}.GO_VERSION=${BUILD_GO_VERSION}'" ${MAIN_FILE} + +linux: dep ## Build the binary file + @GOOS=linux GOARCH=amd64 go build -a -o dist/${OUTPUT_NAME} -ldflags "-s -w" -ldflags "-X '${VERSION_PATH}.GIT_BRANCH=${BUILD_BRANCH}' -X '${VERSION_PATH}.GIT_COMMIT=${BUILD_COMMIT}' -X '${VERSION_PATH}.BUILD_TIME=${BUILD_TIME}' -X '${VERSION_PATH}.GO_VERSION=${BUILD_GO_VERSION}'" ${MAIN_FILE} + +init: dep ## Inital project + @go run main.go init + +run: dep ## Run Server + @go run main.go start + +clean: ## Remove previous build + @go clean . + @rm -f dist/${PROJECT_NAME} + +install: ## Install depence go package + @go install github.com/infraboard/mcube/v2/cmd/mcube@latest + @go install google.golang.org/protobuf/cmd/protoc-gen-go@latest + @go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest + @go install github.com/favadi/protoc-go-inject-tag@latest + +pb: ## Copy mcube protobuf files to common/pb + @mkdir -pv common/pb/github.com/infraboard/mcube/v2/pb + @cp -r ${MCUBE_PKG_PATH}/pb/* common/pb/github.com/infraboard/mcube/v2/pb + @sudo rm -rf common/pb/github.com/infraboard/mcube/v2/pb/*/*.go + +help: ## Display this help screen + @grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' \ No newline at end of file diff --git a/devcloud-mini/cmdb/apps/resource/README.md b/devcloud-mini/cmdb/apps/resource/README.md index 7f95b96..5ead7c2 100644 --- a/devcloud-mini/cmdb/apps/resource/README.md +++ b/devcloud-mini/cmdb/apps/resource/README.md @@ -1 +1,4 @@ -# 资源管理模块 \ No newline at end of file +# 资源管理模块 + +# CRUD + diff --git a/devcloud-mini/cmdb/apps/resource/service.pb.go b/devcloud-mini/cmdb/apps/resource/service.pb.go new file mode 100644 index 0000000..f5e7308 --- /dev/null +++ b/devcloud-mini/cmdb/apps/resource/service.pb.go @@ -0,0 +1,920 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.5 +// protoc v5.29.3 +// source: cmdb/apps/resource/service.proto + +package resource + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type VENDOR int32 + +const ( + VENDOR_ALIYUN VENDOR = 0 + VENDOR_TENCENT VENDOR = 1 + VENDOR_HUAWEI VENDOR = 2 + VENDOR_VSPHERE VENDOR = 3 + VENDOR_AMAZON VENDOR = 4 +) + +// Enum value maps for VENDOR. +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, + } +) + +func (x VENDOR) Enum() *VENDOR { + p := new(VENDOR) + *p = x + return p +} + +func (x VENDOR) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VENDOR) Descriptor() protoreflect.EnumDescriptor { + return file_cmdb_apps_resource_service_proto_enumTypes[0].Descriptor() +} + +func (VENDOR) Type() protoreflect.EnumType { + return &file_cmdb_apps_resource_service_proto_enumTypes[0] +} + +func (x VENDOR) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VENDOR.Descriptor instead. +func (VENDOR) EnumDescriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{0} +} + +type TYPE int32 + +const ( + TYPE_HOST TYPE = 0 + TYPE_RDS TYPE = 1 +) + +// Enum value maps for TYPE. +var ( + TYPE_name = map[int32]string{ + 0: "HOST", + 1: "RDS", + } + TYPE_value = map[string]int32{ + "HOST": 0, + "RDS": 1, + } +) + +func (x TYPE) Enum() *TYPE { + p := new(TYPE) + *p = x + return p +} + +func (x TYPE) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TYPE) Descriptor() protoreflect.EnumDescriptor { + return file_cmdb_apps_resource_service_proto_enumTypes[1].Descriptor() +} + +func (TYPE) Type() protoreflect.EnumType { + return &file_cmdb_apps_resource_service_proto_enumTypes[1] +} + +func (x TYPE) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TYPE.Descriptor instead. +func (TYPE) EnumDescriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{1} +} + +type SearchRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // 页大小 + PageSize int64 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // 页码 + PageNumber int64 `protobuf:"varint,2,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"` + // 名称做模糊搜索 + Keywords string `protobuf:"bytes,3,opt,name=keywords,proto3" json:"keywords,omitempty"` + // 资源类型 + Type *TYPE `protobuf:"varint,4,opt,name=type,proto3,enum=go17.cmdb.resource.TYPE,oneof" json:"type,omitempty"` + // 标签 + Tag map[string]string `protobuf:"bytes,5,rep,name=tag,proto3" json:"tag,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchRequest) Reset() { + *x = SearchRequest{} + mi := &file_cmdb_apps_resource_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest) ProtoMessage() {} + +func (x *SearchRequest) ProtoReflect() protoreflect.Message { + mi := &file_cmdb_apps_resource_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead. +func (*SearchRequest) Descriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{0} +} + +func (x *SearchRequest) GetPageSize() int64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *SearchRequest) GetPageNumber() int64 { + if x != nil { + return x.PageNumber + } + return 0 +} + +func (x *SearchRequest) GetKeywords() string { + if x != nil { + return x.Keywords + } + return "" +} + +func (x *SearchRequest) GetType() TYPE { + if x != nil && x.Type != nil { + return *x.Type + } + return TYPE_HOST +} + +func (x *SearchRequest) GetTag() map[string]string { + if x != nil { + return x.Tag + } + return nil +} + +type ResourceSet struct { + state protoimpl.MessageState `protogen:"open.v1"` + // 总量 + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + // 资源清单 + Items []*Resource `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceSet) Reset() { + *x = ResourceSet{} + mi := &file_cmdb_apps_resource_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceSet) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceSet) ProtoMessage() {} + +func (x *ResourceSet) ProtoReflect() protoreflect.Message { + mi := &file_cmdb_apps_resource_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResourceSet.ProtoReflect.Descriptor instead. +func (*ResourceSet) Descriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{1} +} + +func (x *ResourceSet) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ResourceSet) GetItems() []*Resource { + if x != nil { + return x.Items + } + return nil +} + +type Resource struct { + state protoimpl.MessageState `protogen:"open.v1"` + Meta *Meta `protobuf:"bytes,1,opt,name=Meta,proto3" json:"Meta,omitempty"` + Spec *Spec `protobuf:"bytes,2,opt,name=Spec,proto3" json:"Spec,omitempty"` + Status *Status `protobuf:"bytes,3,opt,name=Status,proto3" json:"Status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Resource) Reset() { + *x = Resource{} + mi := &file_cmdb_apps_resource_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Resource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Resource) ProtoMessage() {} + +func (x *Resource) ProtoReflect() protoreflect.Message { + mi := &file_cmdb_apps_resource_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Resource.ProtoReflect.Descriptor instead. +func (*Resource) Descriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{2} +} + +func (x *Resource) GetMeta() *Meta { + if x != nil { + return x.Meta + } + return nil +} + +func (x *Resource) GetSpec() *Spec { + if x != nil { + return x.Spec + } + return nil +} + +func (x *Resource) GetStatus() *Status { + if x != nil { + return x.Status + } + return nil +} + +type Meta struct { + state protoimpl.MessageState `protogen:"open.v1"` + // 全局唯一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"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Meta) Reset() { + *x = Meta{} + mi := &file_cmdb_apps_resource_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Meta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Meta) ProtoMessage() {} + +func (x *Meta) ProtoReflect() protoreflect.Message { + mi := &file_cmdb_apps_resource_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Meta.ProtoReflect.Descriptor instead. +func (*Meta) Descriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{3} +} + +func (x *Meta) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Meta) GetDomain() string { + if x != nil { + return x.Domain + } + return "" +} + +func (x *Meta) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +func (x *Meta) GetEnv() string { + if x != nil { + return x.Env + } + return "" +} + +func (x *Meta) GetCreateAt() int64 { + if x != nil { + return x.CreateAt + } + return 0 +} + +func (x *Meta) GetDeteteAt() int64 { + if x != nil { + return x.DeteteAt + } + return 0 +} + +func (x *Meta) GetDeteteBy() string { + if x != nil { + return x.DeteteBy + } + return "" +} + +func (x *Meta) GetSyncAt() int64 { + if x != nil { + return x.SyncAt + } + return 0 +} + +func (x *Meta) GetSyncBy() string { + if x != nil { + return x.SyncBy + } + return "" +} + +func (x *Meta) GetCredentialId() string { + if x != nil { + return x.CredentialId + } + return "" +} + +func (x *Meta) GetSerialNumber() string { + if x != nil { + return x.SerialNumber + } + return "" +} + +type Spec struct { + state protoimpl.MessageState `protogen:"open.v1"` + // 厂商 + // @gotags: json:"vendor" + Vendor VENDOR `protobuf:"varint,1,opt,name=vendor,proto3,enum=go17.cmdb.resource.VENDOR" json:"vendor"` + // 资源类型 + // @gotags: json:"resource_type" + ResourceType TYPE `protobuf:"varint,2,opt,name=resource_type,json=resourceType,proto3,enum=go17.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:"type" + Type string `protobuf:"bytes,7,opt,name=type,proto3" json:"type"` + // 描述 + // @gotags: json:"description" + Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description"` + // 资源占用Cpu数量 + // @gotags: json:"cpu" + Cpu int32 `protobuf:"varint,9,opt,name=cpu,proto3" json:"cpu"` + // 资源使用的内存 + // @gotags: json:"memory" + Memory int64 `protobuf:"varint,10,opt,name=memory,proto3" json:"memory"` + // 资源使用的存储 + // @gotags: json:"storage" + Storage int64 `protobuf:"varint,11,opt,name=storage,proto3" json:"storage"` + // 公网IP带宽, 单位M + // @gotags: json:"band_width" + BandWidth int64 `protobuf:"varint,12,opt,name=band_width,json=bandWidth,proto3" json:"band_width"` + // 资源标签 + // @gotags: json:"tags" + Tags map[string]string `protobuf:"bytes,13,rep,name=tags,proto3" json:"tags" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // 额外的通用属性 + // @gotags: json:"extra" gorm:"serializer:json" + Extra map[string]string `protobuf:"bytes,14,rep,name=extra,proto3" json:"extra" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value" gorm:"serializer:json"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Spec) Reset() { + *x = Spec{} + mi := &file_cmdb_apps_resource_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Spec) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Spec) ProtoMessage() {} + +func (x *Spec) ProtoReflect() protoreflect.Message { + mi := &file_cmdb_apps_resource_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Spec.ProtoReflect.Descriptor instead. +func (*Spec) Descriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{4} +} + +func (x *Spec) GetVendor() VENDOR { + if x != nil { + return x.Vendor + } + return VENDOR_ALIYUN +} + +func (x *Spec) GetResourceType() TYPE { + if x != nil { + return x.ResourceType + } + return TYPE_HOST +} + +func (x *Spec) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +func (x *Spec) GetZone() string { + if x != nil { + return x.Zone + } + return "" +} + +func (x *Spec) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *Spec) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Spec) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Spec) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Spec) GetCpu() int32 { + if x != nil { + return x.Cpu + } + return 0 +} + +func (x *Spec) GetMemory() int64 { + if x != nil { + return x.Memory + } + return 0 +} + +func (x *Spec) GetStorage() int64 { + if x != nil { + return x.Storage + } + return 0 +} + +func (x *Spec) GetBandWidth() int64 { + if x != nil { + return x.BandWidth + } + return 0 +} + +func (x *Spec) GetTags() map[string]string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *Spec) GetExtra() map[string]string { + if x != nil { + return x.Extra + } + return nil +} + +type Status struct { + state protoimpl.MessageState `protogen:"open.v1"` + // 资源当前状态 + // @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"` + // 资源访问地址 + // 公网地址, 或者域名 + // @gotags: json:"public_address" gorm:"serializer:json" + PublicAddress []string `protobuf:"bytes,3,rep,name=public_address,json=publicAddress,proto3" json:"public_address" gorm:"serializer:json"` + // 内网地址, 或者域名 + // @gotags: json:"private_address" gorm:"serializer:json" + PrivateAddress []string `protobuf:"bytes,4,rep,name=private_address,json=privateAddress,proto3" json:"private_address" gorm:"serializer:json"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Status) Reset() { + *x = Status{} + mi := &file_cmdb_apps_resource_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Status) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Status) ProtoMessage() {} + +func (x *Status) ProtoReflect() protoreflect.Message { + mi := &file_cmdb_apps_resource_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Status.ProtoReflect.Descriptor instead. +func (*Status) Descriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{5} +} + +func (x *Status) GetPhase() string { + if x != nil { + return x.Phase + } + return "" +} + +func (x *Status) GetDescribe() string { + if x != nil { + return x.Describe + } + return "" +} + +func (x *Status) GetPublicAddress() []string { + if x != nil { + return x.PublicAddress + } + return nil +} + +func (x *Status) GetPrivateAddress() []string { + if x != nil { + return x.PrivateAddress + } + return nil +} + +var File_cmdb_apps_resource_service_proto protoreflect.FileDescriptor + +var file_cmdb_apps_resource_service_proto_rawDesc = string([]byte{ + 0x0a, 0x20, 0x63, 0x6d, 0x64, 0x62, 0x2f, 0x61, 0x70, 0x70, 0x73, 0x2f, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x12, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x9b, 0x02, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x65, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, + 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, + 0x64, 0x73, 0x12, 0x31, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x54, 0x59, 0x50, 0x45, 0x48, 0x00, 0x52, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x88, 0x01, 0x01, 0x12, 0x3c, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x05, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x61, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, + 0x74, 0x61, 0x67, 0x1a, 0x36, 0x0a, 0x08, 0x54, 0x61, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x22, 0x57, 0x0a, 0x0b, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x53, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x32, 0x0a, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, + 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x9a, 0x01, + 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x4d, 0x65, + 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, + 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x4d, 0x65, + 0x74, 0x61, 0x52, 0x04, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x2c, 0x0a, 0x04, 0x53, 0x70, 0x65, 0x63, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, + 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x70, 0x65, 0x63, + 0x52, 0x04, 0x53, 0x70, 0x65, 0x63, 0x12, 0x32, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, + 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xb1, 0x02, 0x0a, 0x04, 0x4d, + 0x65, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x6e, + 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x6e, 0x76, 0x12, 0x1b, 0x0a, 0x09, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x74, 0x65, + 0x74, 0x65, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x74, + 0x65, 0x74, 0x65, 0x41, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x74, 0x65, 0x74, 0x65, 0x5f, + 0x62, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x74, 0x65, 0x74, 0x65, + 0x42, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x63, 0x41, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x73, + 0x79, 0x6e, 0x63, 0x5f, 0x62, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, + 0x6e, 0x63, 0x42, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x65, 0x72, + 0x69, 0x61, 0x6c, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xce, + 0x04, 0x0a, 0x04, 0x53, 0x70, 0x65, 0x63, 0x12, 0x32, 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, + 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x56, 0x45, 0x4e, + 0x44, 0x4f, 0x52, 0x52, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x12, 0x3d, 0x0a, 0x0d, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x54, 0x59, 0x50, 0x45, 0x52, 0x0c, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, + 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, + 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, + 0x72, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, + 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x61, + 0x6e, 0x64, 0x5f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x62, 0x61, 0x6e, 0x64, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x36, 0x0a, 0x04, 0x74, 0x61, 0x67, + 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, + 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x70, 0x65, + 0x63, 0x2e, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x74, 0x61, 0x67, + 0x73, 0x12, 0x39, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x1a, 0x37, 0x0a, 0x09, + 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x45, 0x78, 0x74, 0x72, 0x61, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0x8a, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, + 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x61, 0x73, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x25, 0x0a, 0x0e, + 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x72, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2a, 0x46, 0x0a, 0x06, + 0x56, 0x45, 0x4e, 0x44, 0x4f, 0x52, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x4c, 0x49, 0x59, 0x55, 0x4e, + 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x54, 0x45, 0x4e, 0x43, 0x45, 0x4e, 0x54, 0x10, 0x01, 0x12, + 0x0a, 0x0a, 0x06, 0x48, 0x55, 0x41, 0x57, 0x45, 0x49, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x56, + 0x53, 0x50, 0x48, 0x45, 0x52, 0x45, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x4d, 0x41, 0x5a, + 0x4f, 0x4e, 0x10, 0x04, 0x2a, 0x19, 0x0a, 0x04, 0x54, 0x59, 0x50, 0x45, 0x12, 0x08, 0x0a, 0x04, + 0x48, 0x4f, 0x53, 0x54, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x44, 0x53, 0x10, 0x01, 0x32, + 0x97, 0x01, 0x0a, 0x03, 0x52, 0x70, 0x63, 0x12, 0x4c, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x12, 0x21, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x53, 0x65, 0x74, 0x12, 0x42, 0x0a, 0x04, 0x53, 0x61, 0x76, 0x65, 0x12, 0x1c, 0x2e, + 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x1a, 0x1c, 0x2e, 0x67, 0x6f, + 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x44, 0x5a, 0x42, 0x67, 0x69, 0x74, + 0x6c, 0x61, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x75, 0x72, 0x73, + 0x65, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x6f, 0x31, 0x37, 0x2f, 0x64, + 0x65, 0x76, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x6d, 0x69, 0x6e, 0x69, 0x2f, 0x63, 0x6d, 0x64, + 0x62, 0x2f, 0x61, 0x70, 0x70, 0x73, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +}) + +var ( + file_cmdb_apps_resource_service_proto_rawDescOnce sync.Once + file_cmdb_apps_resource_service_proto_rawDescData []byte +) + +func file_cmdb_apps_resource_service_proto_rawDescGZIP() []byte { + file_cmdb_apps_resource_service_proto_rawDescOnce.Do(func() { + file_cmdb_apps_resource_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cmdb_apps_resource_service_proto_rawDesc), len(file_cmdb_apps_resource_service_proto_rawDesc))) + }) + return file_cmdb_apps_resource_service_proto_rawDescData +} + +var file_cmdb_apps_resource_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_cmdb_apps_resource_service_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_cmdb_apps_resource_service_proto_goTypes = []any{ + (VENDOR)(0), // 0: go17.cmdb.resource.VENDOR + (TYPE)(0), // 1: go17.cmdb.resource.TYPE + (*SearchRequest)(nil), // 2: go17.cmdb.resource.SearchRequest + (*ResourceSet)(nil), // 3: go17.cmdb.resource.ResourceSet + (*Resource)(nil), // 4: go17.cmdb.resource.Resource + (*Meta)(nil), // 5: go17.cmdb.resource.Meta + (*Spec)(nil), // 6: go17.cmdb.resource.Spec + (*Status)(nil), // 7: go17.cmdb.resource.Status + nil, // 8: go17.cmdb.resource.SearchRequest.TagEntry + nil, // 9: go17.cmdb.resource.Spec.TagsEntry + nil, // 10: go17.cmdb.resource.Spec.ExtraEntry +} +var file_cmdb_apps_resource_service_proto_depIdxs = []int32{ + 1, // 0: go17.cmdb.resource.SearchRequest.type:type_name -> go17.cmdb.resource.TYPE + 8, // 1: go17.cmdb.resource.SearchRequest.tag:type_name -> go17.cmdb.resource.SearchRequest.TagEntry + 4, // 2: go17.cmdb.resource.ResourceSet.items:type_name -> go17.cmdb.resource.Resource + 5, // 3: go17.cmdb.resource.Resource.Meta:type_name -> go17.cmdb.resource.Meta + 6, // 4: go17.cmdb.resource.Resource.Spec:type_name -> go17.cmdb.resource.Spec + 7, // 5: go17.cmdb.resource.Resource.Status:type_name -> go17.cmdb.resource.Status + 0, // 6: go17.cmdb.resource.Spec.vendor:type_name -> go17.cmdb.resource.VENDOR + 1, // 7: go17.cmdb.resource.Spec.resource_type:type_name -> go17.cmdb.resource.TYPE + 9, // 8: go17.cmdb.resource.Spec.tags:type_name -> go17.cmdb.resource.Spec.TagsEntry + 10, // 9: go17.cmdb.resource.Spec.extra:type_name -> go17.cmdb.resource.Spec.ExtraEntry + 2, // 10: go17.cmdb.resource.Rpc.Search:input_type -> go17.cmdb.resource.SearchRequest + 4, // 11: go17.cmdb.resource.Rpc.Save:input_type -> go17.cmdb.resource.Resource + 3, // 12: go17.cmdb.resource.Rpc.Search:output_type -> go17.cmdb.resource.ResourceSet + 4, // 13: go17.cmdb.resource.Rpc.Save:output_type -> go17.cmdb.resource.Resource + 12, // [12:14] is the sub-list for method output_type + 10, // [10:12] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_cmdb_apps_resource_service_proto_init() } +func file_cmdb_apps_resource_service_proto_init() { + if File_cmdb_apps_resource_service_proto != nil { + return + } + file_cmdb_apps_resource_service_proto_msgTypes[0].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_cmdb_apps_resource_service_proto_rawDesc), len(file_cmdb_apps_resource_service_proto_rawDesc)), + NumEnums: 2, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cmdb_apps_resource_service_proto_goTypes, + DependencyIndexes: file_cmdb_apps_resource_service_proto_depIdxs, + EnumInfos: file_cmdb_apps_resource_service_proto_enumTypes, + MessageInfos: file_cmdb_apps_resource_service_proto_msgTypes, + }.Build() + File_cmdb_apps_resource_service_proto = out.File + file_cmdb_apps_resource_service_proto_goTypes = nil + file_cmdb_apps_resource_service_proto_depIdxs = nil +} diff --git a/devcloud-mini/cmdb/apps/resource/service.proto b/devcloud-mini/cmdb/apps/resource/service.proto new file mode 100644 index 0000000..f0edae5 --- /dev/null +++ b/devcloud-mini/cmdb/apps/resource/service.proto @@ -0,0 +1,147 @@ +syntax = "proto3"; + +package go17.cmdb.resource; +option go_package="gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource"; + +service Rpc { + // 资源搜索 + rpc Search(SearchRequest) returns(ResourceSet); + // Save 更新与创建同时 + rpc Save(Resource) returns(Resource); +} + +message SearchRequest { + // 页大小 + int64 page_size = 1; + // 页码 + int64 page_number = 2; + // 名称做模糊搜索 + string keywords = 3; + // 资源类型 + optional TYPE type = 4; + // 标签 + map tag = 5; +} + +message ResourceSet { + // 总量 + int64 total = 1; + // 资源清单 + repeated Resource items = 2; +} + +message Resource { + Meta Meta = 1; + Spec Spec = 2; + Status Status = 3; +} + +message Meta { + // 全局唯一Id, 直接使用个云商自己的Id + // @gotags: json:"id" validate:"required" + string id = 1; + // 资源所属域 + // @gotags: json:"domain" validate:"required" + string domain = 2; + // 资源所属空间 + // @gotags: json:"namespace" validate:"required" + string namespace = 3; + // 资源所属环境 + // @gotags: json:"env" + string env = 4; + // 创建时间 + // @gotags: json:"create_at" + int64 create_at = 5; + // 删除时间 + // @gotags: json:"detete_at" + int64 detete_at = 6; + // 删除人 + // @gotags: json:"detete_by" + string detete_by = 7; + // 同步时间 + // @gotags: json:"sync_at" validate:"required" + int64 sync_at = 8; + // 同步人 + // @gotags: json:"sync_by" + string sync_by = 9; + // 用于同步的凭证ID + // @gotags: json:"credential_id" + string credential_id = 10; + // 序列号 + // @gotags: json:"serial_number" + string serial_number = 11; +} + +enum VENDOR { + ALIYUN = 0; + TENCENT = 1; + HUAWEI = 2; + VSPHERE = 3; + AMAZON = 4; +} + +enum TYPE { + HOST = 0; + RDS = 1; +} + +message Spec { + // 厂商 + // @gotags: json:"vendor" + VENDOR vendor = 1; + // 资源类型 + // @gotags: json:"resource_type" + TYPE resource_type = 2; + // 地域 + // @gotags: json:"region" + string region = 3; + // 区域 + // @gotags: json:"zone" + string zone = 4; + // 资源所属账号 + // @gotags: json:"owner" + string owner = 5; + // 名称 + // @gotags: json:"name" + string name = 6; + // 规格 + // @gotags: json:"type" + string type = 7; + // 描述 + // @gotags: json:"description" + string description = 8; + // 资源占用Cpu数量 + // @gotags: json:"cpu" + int32 cpu = 9; + // 资源使用的内存 + // @gotags: json:"memory" + int64 memory = 10; + // 资源使用的存储 + // @gotags: json:"storage" + int64 storage = 11; + // 公网IP带宽, 单位M + // @gotags: json:"band_width" + int64 band_width = 12; + // 资源标签 + // @gotags: json:"tags" + map tags = 13; + // 额外的通用属性 + // @gotags: json:"extra" gorm:"serializer:json" + map extra = 14; +} + +message Status { + // 资源当前状态 + // @gotags: json:"phase" + string phase = 1; + // 资源当前状态描述 + // @gotags: json:"describe" + string describe = 2; + // 资源访问地址 + // 公网地址, 或者域名 + // @gotags: json:"public_address" gorm:"serializer:json" + repeated string public_address = 3; + // 内网地址, 或者域名 + // @gotags: json:"private_address" gorm:"serializer:json" + repeated string private_address = 4; +} \ No newline at end of file diff --git a/devcloud-mini/cmdb/apps/resource/service_enum.pb.go b/devcloud-mini/cmdb/apps/resource/service_enum.pb.go new file mode 100644 index 0000000..62ff0ab --- /dev/null +++ b/devcloud-mini/cmdb/apps/resource/service_enum.pb.go @@ -0,0 +1,100 @@ +// Code generated by github.com/infraboard/mcube/v2 +// DO NOT EDIT + +package resource + +import ( + "bytes" + "fmt" + "strings" +) + +// ParseVENDORFromString Parse VENDOR from string +func ParseVENDORFromString(str string) (VENDOR, error) { + key := strings.Trim(string(str), `"`) + v, ok := VENDOR_value[strings.ToUpper(key)] + if !ok { + return 0, fmt.Errorf("unknown VENDOR: %s", str) + } + + return VENDOR(v), nil +} + +// Equal type compare +func (t VENDOR) Equal(target VENDOR) bool { + return t == target +} + +// IsIn todo +func (t VENDOR) IsIn(targets ...VENDOR) bool { + for _, target := range targets { + if t.Equal(target) { + return true + } + } + + return false +} + +// MarshalJSON todo +func (t VENDOR) MarshalJSON() ([]byte, error) { + b := bytes.NewBufferString(`"`) + b.WriteString(strings.ToUpper(t.String())) + b.WriteString(`"`) + return b.Bytes(), nil +} + +// UnmarshalJSON todo +func (t *VENDOR) UnmarshalJSON(b []byte) error { + ins, err := ParseVENDORFromString(string(b)) + if err != nil { + return err + } + *t = ins + return nil +} + +// ParseTYPEFromString Parse TYPE from string +func ParseTYPEFromString(str string) (TYPE, error) { + key := strings.Trim(string(str), `"`) + v, ok := TYPE_value[strings.ToUpper(key)] + if !ok { + return 0, fmt.Errorf("unknown TYPE: %s", str) + } + + return TYPE(v), nil +} + +// Equal type compare +func (t TYPE) Equal(target TYPE) bool { + return t == target +} + +// IsIn todo +func (t TYPE) IsIn(targets ...TYPE) bool { + for _, target := range targets { + if t.Equal(target) { + return true + } + } + + return false +} + +// MarshalJSON todo +func (t TYPE) MarshalJSON() ([]byte, error) { + b := bytes.NewBufferString(`"`) + b.WriteString(strings.ToUpper(t.String())) + b.WriteString(`"`) + return b.Bytes(), nil +} + +// UnmarshalJSON todo +func (t *TYPE) UnmarshalJSON(b []byte) error { + ins, err := ParseTYPEFromString(string(b)) + if err != nil { + return err + } + *t = ins + return nil +} diff --git a/devcloud-mini/cmdb/apps/resource/service_grpc.pb.go b/devcloud-mini/cmdb/apps/resource/service_grpc.pb.go new file mode 100644 index 0000000..7dc9fa8 --- /dev/null +++ b/devcloud-mini/cmdb/apps/resource/service_grpc.pb.go @@ -0,0 +1,163 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 +// source: cmdb/apps/resource/service.proto + +package resource + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + Rpc_Search_FullMethodName = "/go17.cmdb.resource.Rpc/Search" + Rpc_Save_FullMethodName = "/go17.cmdb.resource.Rpc/Save" +) + +// 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. +type RpcClient interface { + // 资源搜索 + Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*ResourceSet, error) + // Save 更新与创建同时 + Save(ctx context.Context, in *Resource, opts ...grpc.CallOption) (*Resource, error) +} + +type rpcClient struct { + cc grpc.ClientConnInterface +} + +func NewRpcClient(cc grpc.ClientConnInterface) RpcClient { + return &rpcClient{cc} +} + +func (c *rpcClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*ResourceSet, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ResourceSet) + err := c.cc.Invoke(ctx, Rpc_Search_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *rpcClient) Save(ctx context.Context, in *Resource, opts ...grpc.CallOption) (*Resource, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Resource) + err := c.cc.Invoke(ctx, Rpc_Save_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RpcServer is the server API for Rpc service. +// All implementations must embed UnimplementedRpcServer +// for forward compatibility. +type RpcServer interface { + // 资源搜索 + Search(context.Context, *SearchRequest) (*ResourceSet, error) + // Save 更新与创建同时 + Save(context.Context, *Resource) (*Resource, error) + mustEmbedUnimplementedRpcServer() +} + +// UnimplementedRpcServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedRpcServer struct{} + +func (UnimplementedRpcServer) Search(context.Context, *SearchRequest) (*ResourceSet, error) { + return nil, status.Errorf(codes.Unimplemented, "method Search not implemented") +} +func (UnimplementedRpcServer) Save(context.Context, *Resource) (*Resource, error) { + return nil, status.Errorf(codes.Unimplemented, "method Save not implemented") +} +func (UnimplementedRpcServer) mustEmbedUnimplementedRpcServer() {} +func (UnimplementedRpcServer) testEmbeddedByValue() {} + +// 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 UnsafeRpcServer interface { + mustEmbedUnimplementedRpcServer() +} + +func RegisterRpcServer(s grpc.ServiceRegistrar, srv RpcServer) { + // If the following call pancis, it indicates UnimplementedRpcServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&Rpc_ServiceDesc, srv) +} + +func _Rpc_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RpcServer).Search(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Rpc_Search_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RpcServer).Search(ctx, req.(*SearchRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Rpc_Save_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Resource) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RpcServer).Save(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Rpc_Save_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RpcServer).Save(ctx, req.(*Resource)) + } + return interceptor(ctx, in, info, handler) +} + +// 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) +var Rpc_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "go17.cmdb.resource.Rpc", + HandlerType: (*RpcServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Search", + Handler: _Rpc_Search_Handler, + }, + { + MethodName: "Save", + Handler: _Rpc_Save_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cmdb/apps/resource/service.proto", +} diff --git a/devcloud-mini/gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/service.pb.go b/devcloud-mini/gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/service.pb.go new file mode 100644 index 0000000..a7687f2 --- /dev/null +++ b/devcloud-mini/gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/service.pb.go @@ -0,0 +1,920 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.5 +// protoc v5.29.3 +// source: cmdb/apps/resource/service.proto + +package resource + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type VENDOR int32 + +const ( + VENDOR_ALIYUN VENDOR = 0 + VENDOR_TENCENT VENDOR = 1 + VENDOR_HUAWEI VENDOR = 2 + VENDOR_VSPHERE VENDOR = 3 + VENDOR_AMAZON VENDOR = 4 +) + +// Enum value maps for VENDOR. +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, + } +) + +func (x VENDOR) Enum() *VENDOR { + p := new(VENDOR) + *p = x + return p +} + +func (x VENDOR) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VENDOR) Descriptor() protoreflect.EnumDescriptor { + return file_cmdb_apps_resource_service_proto_enumTypes[0].Descriptor() +} + +func (VENDOR) Type() protoreflect.EnumType { + return &file_cmdb_apps_resource_service_proto_enumTypes[0] +} + +func (x VENDOR) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VENDOR.Descriptor instead. +func (VENDOR) EnumDescriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{0} +} + +type TYPE int32 + +const ( + TYPE_HOST TYPE = 0 + TYPE_RDS TYPE = 1 +) + +// Enum value maps for TYPE. +var ( + TYPE_name = map[int32]string{ + 0: "HOST", + 1: "RDS", + } + TYPE_value = map[string]int32{ + "HOST": 0, + "RDS": 1, + } +) + +func (x TYPE) Enum() *TYPE { + p := new(TYPE) + *p = x + return p +} + +func (x TYPE) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TYPE) Descriptor() protoreflect.EnumDescriptor { + return file_cmdb_apps_resource_service_proto_enumTypes[1].Descriptor() +} + +func (TYPE) Type() protoreflect.EnumType { + return &file_cmdb_apps_resource_service_proto_enumTypes[1] +} + +func (x TYPE) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TYPE.Descriptor instead. +func (TYPE) EnumDescriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{1} +} + +type SearchRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // 页大小 + PageSize int64 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // 页码 + PageNumber int64 `protobuf:"varint,2,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"` + // 名称做模糊搜索 + Keywords string `protobuf:"bytes,3,opt,name=keywords,proto3" json:"keywords,omitempty"` + // 资源类型 + Type *TYPE `protobuf:"varint,4,opt,name=type,proto3,enum=go17.cmdb.resource.TYPE,oneof" json:"type,omitempty"` + // 标签 + Tag map[string]string `protobuf:"bytes,5,rep,name=tag,proto3" json:"tag,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchRequest) Reset() { + *x = SearchRequest{} + mi := &file_cmdb_apps_resource_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest) ProtoMessage() {} + +func (x *SearchRequest) ProtoReflect() protoreflect.Message { + mi := &file_cmdb_apps_resource_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead. +func (*SearchRequest) Descriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{0} +} + +func (x *SearchRequest) GetPageSize() int64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *SearchRequest) GetPageNumber() int64 { + if x != nil { + return x.PageNumber + } + return 0 +} + +func (x *SearchRequest) GetKeywords() string { + if x != nil { + return x.Keywords + } + return "" +} + +func (x *SearchRequest) GetType() TYPE { + if x != nil && x.Type != nil { + return *x.Type + } + return TYPE_HOST +} + +func (x *SearchRequest) GetTag() map[string]string { + if x != nil { + return x.Tag + } + return nil +} + +type ResourceSet struct { + state protoimpl.MessageState `protogen:"open.v1"` + // 总量 + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + // 资源清单 + Items []*Resource `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceSet) Reset() { + *x = ResourceSet{} + mi := &file_cmdb_apps_resource_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceSet) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceSet) ProtoMessage() {} + +func (x *ResourceSet) ProtoReflect() protoreflect.Message { + mi := &file_cmdb_apps_resource_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResourceSet.ProtoReflect.Descriptor instead. +func (*ResourceSet) Descriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{1} +} + +func (x *ResourceSet) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ResourceSet) GetItems() []*Resource { + if x != nil { + return x.Items + } + return nil +} + +type Resource struct { + state protoimpl.MessageState `protogen:"open.v1"` + Meta *Meta `protobuf:"bytes,1,opt,name=Meta,proto3" json:"Meta,omitempty"` + Spec *Spec `protobuf:"bytes,2,opt,name=Spec,proto3" json:"Spec,omitempty"` + Status *Status `protobuf:"bytes,3,opt,name=Status,proto3" json:"Status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Resource) Reset() { + *x = Resource{} + mi := &file_cmdb_apps_resource_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Resource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Resource) ProtoMessage() {} + +func (x *Resource) ProtoReflect() protoreflect.Message { + mi := &file_cmdb_apps_resource_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Resource.ProtoReflect.Descriptor instead. +func (*Resource) Descriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{2} +} + +func (x *Resource) GetMeta() *Meta { + if x != nil { + return x.Meta + } + return nil +} + +func (x *Resource) GetSpec() *Spec { + if x != nil { + return x.Spec + } + return nil +} + +func (x *Resource) GetStatus() *Status { + if x != nil { + return x.Status + } + return nil +} + +type Meta struct { + state protoimpl.MessageState `protogen:"open.v1"` + // 全局唯一Id, 直接使用个云商自己的Id + // @gotags: json:"id" validate:"required" + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // 资源所属域 + // @gotags: json:"domain" validate:"required" + Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"` + // 资源所属空间 + // @gotags: json:"namespace" validate:"required" + 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:"create_at" + CreateAt int64 `protobuf:"varint,5,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty"` + // 删除时间 + // @gotags: json:"detete_at" + DeteteAt int64 `protobuf:"varint,6,opt,name=detete_at,json=deteteAt,proto3" json:"detete_at,omitempty"` + // 删除人 + // @gotags: json:"detete_by" + DeteteBy string `protobuf:"bytes,7,opt,name=detete_by,json=deteteBy,proto3" json:"detete_by,omitempty"` + // 同步时间 + // @gotags: json:"sync_at" validate:"required" + SyncAt int64 `protobuf:"varint,8,opt,name=sync_at,json=syncAt,proto3" json:"sync_at,omitempty"` + // 同步人 + // @gotags: json:"sync_by" + SyncBy string `protobuf:"bytes,9,opt,name=sync_by,json=syncBy,proto3" json:"sync_by,omitempty"` + // 用于同步的凭证ID + // @gotags: json:"credential_id" + CredentialId string `protobuf:"bytes,10,opt,name=credential_id,json=credentialId,proto3" json:"credential_id,omitempty"` + // 序列号 + // @gotags: json:"serial_number" + SerialNumber string `protobuf:"bytes,11,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Meta) Reset() { + *x = Meta{} + mi := &file_cmdb_apps_resource_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Meta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Meta) ProtoMessage() {} + +func (x *Meta) ProtoReflect() protoreflect.Message { + mi := &file_cmdb_apps_resource_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Meta.ProtoReflect.Descriptor instead. +func (*Meta) Descriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{3} +} + +func (x *Meta) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Meta) GetDomain() string { + if x != nil { + return x.Domain + } + return "" +} + +func (x *Meta) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +func (x *Meta) GetEnv() string { + if x != nil { + return x.Env + } + return "" +} + +func (x *Meta) GetCreateAt() int64 { + if x != nil { + return x.CreateAt + } + return 0 +} + +func (x *Meta) GetDeteteAt() int64 { + if x != nil { + return x.DeteteAt + } + return 0 +} + +func (x *Meta) GetDeteteBy() string { + if x != nil { + return x.DeteteBy + } + return "" +} + +func (x *Meta) GetSyncAt() int64 { + if x != nil { + return x.SyncAt + } + return 0 +} + +func (x *Meta) GetSyncBy() string { + if x != nil { + return x.SyncBy + } + return "" +} + +func (x *Meta) GetCredentialId() string { + if x != nil { + return x.CredentialId + } + return "" +} + +func (x *Meta) GetSerialNumber() string { + if x != nil { + return x.SerialNumber + } + return "" +} + +type Spec struct { + state protoimpl.MessageState `protogen:"open.v1"` + // 厂商 + // @gotags: json:"vendor" + Vendor VENDOR `protobuf:"varint,1,opt,name=vendor,proto3,enum=go17.cmdb.resource.VENDOR" json:"vendor,omitempty"` + // 资源类型 + // @gotags: json:"resource_type" + ResourceType TYPE `protobuf:"varint,2,opt,name=resource_type,json=resourceType,proto3,enum=go17.cmdb.resource.TYPE" json:"resource_type,omitempty"` + // 地域 + // @gotags: json:"region" + Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"` + // 区域 + // @gotags: json:"zone" + Zone string `protobuf:"bytes,4,opt,name=zone,proto3" json:"zone,omitempty"` + // 资源所属账号 + // @gotags: json:"owner" + Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"` + // 名称 + // @gotags: json:"name" + Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` + // 规格 + // @gotags: json:"type" + Type string `protobuf:"bytes,7,opt,name=type,proto3" json:"type,omitempty"` + // 描述 + // @gotags: json:"description" + Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description,omitempty"` + // 资源占用Cpu数量 + // @gotags: json:"cpu" + Cpu int32 `protobuf:"varint,9,opt,name=cpu,proto3" json:"cpu,omitempty"` + // 资源使用的内存 + // @gotags: json:"memory" + Memory int64 `protobuf:"varint,10,opt,name=memory,proto3" json:"memory,omitempty"` + // 资源使用的存储 + // @gotags: json:"storage" + Storage int64 `protobuf:"varint,11,opt,name=storage,proto3" json:"storage,omitempty"` + // 公网IP带宽, 单位M + // @gotags: json:"band_width" + BandWidth int64 `protobuf:"varint,12,opt,name=band_width,json=bandWidth,proto3" json:"band_width,omitempty"` + // 资源标签 + // @gotags: json:"tags" + Tags map[string]string `protobuf:"bytes,13,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // 额外的通用属性 + // @gotags: json:"extra" gorm:"serializer:json" + Extra map[string]string `protobuf:"bytes,14,rep,name=extra,proto3" json:"extra,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Spec) Reset() { + *x = Spec{} + mi := &file_cmdb_apps_resource_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Spec) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Spec) ProtoMessage() {} + +func (x *Spec) ProtoReflect() protoreflect.Message { + mi := &file_cmdb_apps_resource_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Spec.ProtoReflect.Descriptor instead. +func (*Spec) Descriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{4} +} + +func (x *Spec) GetVendor() VENDOR { + if x != nil { + return x.Vendor + } + return VENDOR_ALIYUN +} + +func (x *Spec) GetResourceType() TYPE { + if x != nil { + return x.ResourceType + } + return TYPE_HOST +} + +func (x *Spec) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +func (x *Spec) GetZone() string { + if x != nil { + return x.Zone + } + return "" +} + +func (x *Spec) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *Spec) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Spec) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Spec) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Spec) GetCpu() int32 { + if x != nil { + return x.Cpu + } + return 0 +} + +func (x *Spec) GetMemory() int64 { + if x != nil { + return x.Memory + } + return 0 +} + +func (x *Spec) GetStorage() int64 { + if x != nil { + return x.Storage + } + return 0 +} + +func (x *Spec) GetBandWidth() int64 { + if x != nil { + return x.BandWidth + } + return 0 +} + +func (x *Spec) GetTags() map[string]string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *Spec) GetExtra() map[string]string { + if x != nil { + return x.Extra + } + return nil +} + +type Status struct { + state protoimpl.MessageState `protogen:"open.v1"` + // 资源当前状态 + // @gotags: json:"phase" + Phase string `protobuf:"bytes,1,opt,name=phase,proto3" json:"phase,omitempty"` + // 资源当前状态描述 + // @gotags: json:"describe" + Describe string `protobuf:"bytes,2,opt,name=describe,proto3" json:"describe,omitempty"` + // 资源访问地址 + // 公网地址, 或者域名 + // @gotags: json:"public_address" gorm:"serializer:json" + PublicAddress []string `protobuf:"bytes,3,rep,name=public_address,json=publicAddress,proto3" json:"public_address,omitempty"` + // 内网地址, 或者域名 + // @gotags: json:"private_address" gorm:"serializer:json" + PrivateAddress []string `protobuf:"bytes,4,rep,name=private_address,json=privateAddress,proto3" json:"private_address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Status) Reset() { + *x = Status{} + mi := &file_cmdb_apps_resource_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Status) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Status) ProtoMessage() {} + +func (x *Status) ProtoReflect() protoreflect.Message { + mi := &file_cmdb_apps_resource_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Status.ProtoReflect.Descriptor instead. +func (*Status) Descriptor() ([]byte, []int) { + return file_cmdb_apps_resource_service_proto_rawDescGZIP(), []int{5} +} + +func (x *Status) GetPhase() string { + if x != nil { + return x.Phase + } + return "" +} + +func (x *Status) GetDescribe() string { + if x != nil { + return x.Describe + } + return "" +} + +func (x *Status) GetPublicAddress() []string { + if x != nil { + return x.PublicAddress + } + return nil +} + +func (x *Status) GetPrivateAddress() []string { + if x != nil { + return x.PrivateAddress + } + return nil +} + +var File_cmdb_apps_resource_service_proto protoreflect.FileDescriptor + +var file_cmdb_apps_resource_service_proto_rawDesc = string([]byte{ + 0x0a, 0x20, 0x63, 0x6d, 0x64, 0x62, 0x2f, 0x61, 0x70, 0x70, 0x73, 0x2f, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x12, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x9b, 0x02, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x65, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, + 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, + 0x64, 0x73, 0x12, 0x31, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x54, 0x59, 0x50, 0x45, 0x48, 0x00, 0x52, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x88, 0x01, 0x01, 0x12, 0x3c, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x05, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x61, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, + 0x74, 0x61, 0x67, 0x1a, 0x36, 0x0a, 0x08, 0x54, 0x61, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x22, 0x57, 0x0a, 0x0b, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x53, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x32, 0x0a, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, + 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x9a, 0x01, + 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x4d, 0x65, + 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, + 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x4d, 0x65, + 0x74, 0x61, 0x52, 0x04, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x2c, 0x0a, 0x04, 0x53, 0x70, 0x65, 0x63, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, + 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x70, 0x65, 0x63, + 0x52, 0x04, 0x53, 0x70, 0x65, 0x63, 0x12, 0x32, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, + 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xb1, 0x02, 0x0a, 0x04, 0x4d, + 0x65, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x6e, + 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x6e, 0x76, 0x12, 0x1b, 0x0a, 0x09, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x74, 0x65, + 0x74, 0x65, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x74, + 0x65, 0x74, 0x65, 0x41, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x74, 0x65, 0x74, 0x65, 0x5f, + 0x62, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x74, 0x65, 0x74, 0x65, + 0x42, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x63, 0x41, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x73, + 0x79, 0x6e, 0x63, 0x5f, 0x62, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, + 0x6e, 0x63, 0x42, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x65, 0x72, + 0x69, 0x61, 0x6c, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xce, + 0x04, 0x0a, 0x04, 0x53, 0x70, 0x65, 0x63, 0x12, 0x32, 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, + 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x56, 0x45, 0x4e, + 0x44, 0x4f, 0x52, 0x52, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x12, 0x3d, 0x0a, 0x0d, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x54, 0x59, 0x50, 0x45, 0x52, 0x0c, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, + 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, + 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, + 0x72, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, + 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x61, + 0x6e, 0x64, 0x5f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x62, 0x61, 0x6e, 0x64, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x36, 0x0a, 0x04, 0x74, 0x61, 0x67, + 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, + 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x70, 0x65, + 0x63, 0x2e, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x74, 0x61, 0x67, + 0x73, 0x12, 0x39, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x1a, 0x37, 0x0a, 0x09, + 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x45, 0x78, 0x74, 0x72, 0x61, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0x8a, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, + 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x61, 0x73, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x25, 0x0a, 0x0e, + 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x72, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2a, 0x46, 0x0a, 0x06, + 0x56, 0x45, 0x4e, 0x44, 0x4f, 0x52, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x4c, 0x49, 0x59, 0x55, 0x4e, + 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x54, 0x45, 0x4e, 0x43, 0x45, 0x4e, 0x54, 0x10, 0x01, 0x12, + 0x0a, 0x0a, 0x06, 0x48, 0x55, 0x41, 0x57, 0x45, 0x49, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x56, + 0x53, 0x50, 0x48, 0x45, 0x52, 0x45, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x4d, 0x41, 0x5a, + 0x4f, 0x4e, 0x10, 0x04, 0x2a, 0x19, 0x0a, 0x04, 0x54, 0x59, 0x50, 0x45, 0x12, 0x08, 0x0a, 0x04, + 0x48, 0x4f, 0x53, 0x54, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x44, 0x53, 0x10, 0x01, 0x32, + 0x97, 0x01, 0x0a, 0x03, 0x52, 0x70, 0x63, 0x12, 0x4c, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x12, 0x21, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x53, 0x65, 0x74, 0x12, 0x42, 0x0a, 0x04, 0x53, 0x61, 0x76, 0x65, 0x12, 0x1c, 0x2e, + 0x67, 0x6f, 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x1a, 0x1c, 0x2e, 0x67, 0x6f, + 0x31, 0x37, 0x2e, 0x63, 0x6d, 0x64, 0x62, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x44, 0x5a, 0x42, 0x67, 0x69, 0x74, + 0x6c, 0x61, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x75, 0x72, 0x73, + 0x65, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x6f, 0x31, 0x37, 0x2f, 0x64, + 0x65, 0x76, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x6d, 0x69, 0x6e, 0x69, 0x2f, 0x63, 0x6d, 0x64, + 0x62, 0x2f, 0x61, 0x70, 0x70, 0x73, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +}) + +var ( + file_cmdb_apps_resource_service_proto_rawDescOnce sync.Once + file_cmdb_apps_resource_service_proto_rawDescData []byte +) + +func file_cmdb_apps_resource_service_proto_rawDescGZIP() []byte { + file_cmdb_apps_resource_service_proto_rawDescOnce.Do(func() { + file_cmdb_apps_resource_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cmdb_apps_resource_service_proto_rawDesc), len(file_cmdb_apps_resource_service_proto_rawDesc))) + }) + return file_cmdb_apps_resource_service_proto_rawDescData +} + +var file_cmdb_apps_resource_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_cmdb_apps_resource_service_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_cmdb_apps_resource_service_proto_goTypes = []any{ + (VENDOR)(0), // 0: go17.cmdb.resource.VENDOR + (TYPE)(0), // 1: go17.cmdb.resource.TYPE + (*SearchRequest)(nil), // 2: go17.cmdb.resource.SearchRequest + (*ResourceSet)(nil), // 3: go17.cmdb.resource.ResourceSet + (*Resource)(nil), // 4: go17.cmdb.resource.Resource + (*Meta)(nil), // 5: go17.cmdb.resource.Meta + (*Spec)(nil), // 6: go17.cmdb.resource.Spec + (*Status)(nil), // 7: go17.cmdb.resource.Status + nil, // 8: go17.cmdb.resource.SearchRequest.TagEntry + nil, // 9: go17.cmdb.resource.Spec.TagsEntry + nil, // 10: go17.cmdb.resource.Spec.ExtraEntry +} +var file_cmdb_apps_resource_service_proto_depIdxs = []int32{ + 1, // 0: go17.cmdb.resource.SearchRequest.type:type_name -> go17.cmdb.resource.TYPE + 8, // 1: go17.cmdb.resource.SearchRequest.tag:type_name -> go17.cmdb.resource.SearchRequest.TagEntry + 4, // 2: go17.cmdb.resource.ResourceSet.items:type_name -> go17.cmdb.resource.Resource + 5, // 3: go17.cmdb.resource.Resource.Meta:type_name -> go17.cmdb.resource.Meta + 6, // 4: go17.cmdb.resource.Resource.Spec:type_name -> go17.cmdb.resource.Spec + 7, // 5: go17.cmdb.resource.Resource.Status:type_name -> go17.cmdb.resource.Status + 0, // 6: go17.cmdb.resource.Spec.vendor:type_name -> go17.cmdb.resource.VENDOR + 1, // 7: go17.cmdb.resource.Spec.resource_type:type_name -> go17.cmdb.resource.TYPE + 9, // 8: go17.cmdb.resource.Spec.tags:type_name -> go17.cmdb.resource.Spec.TagsEntry + 10, // 9: go17.cmdb.resource.Spec.extra:type_name -> go17.cmdb.resource.Spec.ExtraEntry + 2, // 10: go17.cmdb.resource.Rpc.Search:input_type -> go17.cmdb.resource.SearchRequest + 4, // 11: go17.cmdb.resource.Rpc.Save:input_type -> go17.cmdb.resource.Resource + 3, // 12: go17.cmdb.resource.Rpc.Search:output_type -> go17.cmdb.resource.ResourceSet + 4, // 13: go17.cmdb.resource.Rpc.Save:output_type -> go17.cmdb.resource.Resource + 12, // [12:14] is the sub-list for method output_type + 10, // [10:12] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_cmdb_apps_resource_service_proto_init() } +func file_cmdb_apps_resource_service_proto_init() { + if File_cmdb_apps_resource_service_proto != nil { + return + } + file_cmdb_apps_resource_service_proto_msgTypes[0].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_cmdb_apps_resource_service_proto_rawDesc), len(file_cmdb_apps_resource_service_proto_rawDesc)), + NumEnums: 2, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cmdb_apps_resource_service_proto_goTypes, + DependencyIndexes: file_cmdb_apps_resource_service_proto_depIdxs, + EnumInfos: file_cmdb_apps_resource_service_proto_enumTypes, + MessageInfos: file_cmdb_apps_resource_service_proto_msgTypes, + }.Build() + File_cmdb_apps_resource_service_proto = out.File + file_cmdb_apps_resource_service_proto_goTypes = nil + file_cmdb_apps_resource_service_proto_depIdxs = nil +} diff --git a/devcloud-mini/gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/service_grpc.pb.go b/devcloud-mini/gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/service_grpc.pb.go new file mode 100644 index 0000000..7dc9fa8 --- /dev/null +++ b/devcloud-mini/gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/service_grpc.pb.go @@ -0,0 +1,163 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 +// source: cmdb/apps/resource/service.proto + +package resource + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + Rpc_Search_FullMethodName = "/go17.cmdb.resource.Rpc/Search" + Rpc_Save_FullMethodName = "/go17.cmdb.resource.Rpc/Save" +) + +// 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. +type RpcClient interface { + // 资源搜索 + Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*ResourceSet, error) + // Save 更新与创建同时 + Save(ctx context.Context, in *Resource, opts ...grpc.CallOption) (*Resource, error) +} + +type rpcClient struct { + cc grpc.ClientConnInterface +} + +func NewRpcClient(cc grpc.ClientConnInterface) RpcClient { + return &rpcClient{cc} +} + +func (c *rpcClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*ResourceSet, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ResourceSet) + err := c.cc.Invoke(ctx, Rpc_Search_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *rpcClient) Save(ctx context.Context, in *Resource, opts ...grpc.CallOption) (*Resource, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Resource) + err := c.cc.Invoke(ctx, Rpc_Save_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RpcServer is the server API for Rpc service. +// All implementations must embed UnimplementedRpcServer +// for forward compatibility. +type RpcServer interface { + // 资源搜索 + Search(context.Context, *SearchRequest) (*ResourceSet, error) + // Save 更新与创建同时 + Save(context.Context, *Resource) (*Resource, error) + mustEmbedUnimplementedRpcServer() +} + +// UnimplementedRpcServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedRpcServer struct{} + +func (UnimplementedRpcServer) Search(context.Context, *SearchRequest) (*ResourceSet, error) { + return nil, status.Errorf(codes.Unimplemented, "method Search not implemented") +} +func (UnimplementedRpcServer) Save(context.Context, *Resource) (*Resource, error) { + return nil, status.Errorf(codes.Unimplemented, "method Save not implemented") +} +func (UnimplementedRpcServer) mustEmbedUnimplementedRpcServer() {} +func (UnimplementedRpcServer) testEmbeddedByValue() {} + +// 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 UnsafeRpcServer interface { + mustEmbedUnimplementedRpcServer() +} + +func RegisterRpcServer(s grpc.ServiceRegistrar, srv RpcServer) { + // If the following call pancis, it indicates UnimplementedRpcServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&Rpc_ServiceDesc, srv) +} + +func _Rpc_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RpcServer).Search(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Rpc_Search_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RpcServer).Search(ctx, req.(*SearchRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Rpc_Save_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Resource) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RpcServer).Save(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Rpc_Save_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RpcServer).Save(ctx, req.(*Resource)) + } + return interceptor(ctx, in, info, handler) +} + +// 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) +var Rpc_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "go17.cmdb.resource.Rpc", + HandlerType: (*RpcServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Search", + Handler: _Rpc_Search_Handler, + }, + { + MethodName: "Save", + Handler: _Rpc_Save_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cmdb/apps/resource/service.proto", +}