From bcd2f4557506b8317e70c77dbd9c9d3e779c0753 Mon Sep 17 00:00:00 2001 From: yumaojun03 <719118794@qq.com> Date: Sun, 2 Mar 2025 17:41:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85resource=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- devcloud-mini/.vscode/settings.json | 6 + devcloud-mini/cmdb/apps/registry.go | 4 + devcloud-mini/cmdb/apps/resource/impl/impl.go | 32 + .../cmdb/apps/resource/impl/impl_test.go | 17 + .../cmdb/apps/resource/impl/resource.go | 31 + .../cmdb/apps/resource/impl/resource_test.go | 27 + devcloud-mini/cmdb/apps/resource/interface.go | 42 + .../cmdb/apps/resource/service.pb.go | 15 +- .../cmdb/apps/resource/service.proto | 5 +- devcloud-mini/cmdb/etc/application.toml | 3 +- devcloud-mini/cmdb/test/setup.go | 15 + .../cmdb/apps/resource/service.pb.go | 920 ------------------ .../cmdb/apps/resource/service_grpc.pb.go | 163 ---- go.mod | 9 + go.sum | 42 + 15 files changed, 240 insertions(+), 1091 deletions(-) create mode 100644 devcloud-mini/.vscode/settings.json create mode 100644 devcloud-mini/cmdb/apps/resource/impl/impl.go create mode 100644 devcloud-mini/cmdb/apps/resource/impl/impl_test.go create mode 100644 devcloud-mini/cmdb/apps/resource/impl/resource.go create mode 100644 devcloud-mini/cmdb/apps/resource/impl/resource_test.go create mode 100644 devcloud-mini/cmdb/apps/resource/interface.go create mode 100644 devcloud-mini/cmdb/test/setup.go delete mode 100644 devcloud-mini/gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/service.pb.go delete mode 100644 devcloud-mini/gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/service_grpc.pb.go diff --git a/devcloud-mini/.vscode/settings.json b/devcloud-mini/.vscode/settings.json new file mode 100644 index 0000000..556d367 --- /dev/null +++ b/devcloud-mini/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "go.testEnvFile": "${workspaceFolder}/etc/unit_test.env", + "go.testEnvVars": { + "CmdbConfigPath": "${workspaceFolder}/cmdb/etc/application.toml" + } +} \ No newline at end of file diff --git a/devcloud-mini/cmdb/apps/registry.go b/devcloud-mini/cmdb/apps/registry.go index cff2ab9..bef279d 100644 --- a/devcloud-mini/cmdb/apps/registry.go +++ b/devcloud-mini/cmdb/apps/registry.go @@ -1 +1,5 @@ package apps + +import ( + _ "gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/impl" +) diff --git a/devcloud-mini/cmdb/apps/resource/impl/impl.go b/devcloud-mini/cmdb/apps/resource/impl/impl.go new file mode 100644 index 0000000..b3032a2 --- /dev/null +++ b/devcloud-mini/cmdb/apps/resource/impl/impl.go @@ -0,0 +1,32 @@ +package impl + +import ( + "github.com/infraboard/mcube/v2/ioc" + "github.com/infraboard/mcube/v2/ioc/config/grpc" + ioc_mongo "github.com/infraboard/mcube/v2/ioc/config/mongo" + "gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource" + "go.mongodb.org/mongo-driver/mongo" +) + +func init() { + ioc.Controller().Registry(&ResourceServiceImpl{}) +} + +type ResourceServiceImpl struct { + resource.UnimplementedRpcServer + ioc.ObjectImpl + col *mongo.Collection +} + +func (s *ResourceServiceImpl) Name() string { + return resource.AppName +} + +func (s *ResourceServiceImpl) Init() error { + // 注册给GRPC + resource.RegisterRpcServer(grpc.Get().Server(), s) + + // 定义使用的集合 + s.col = ioc_mongo.DB().Collection("resources") + return nil +} diff --git a/devcloud-mini/cmdb/apps/resource/impl/impl_test.go b/devcloud-mini/cmdb/apps/resource/impl/impl_test.go new file mode 100644 index 0000000..ff21e21 --- /dev/null +++ b/devcloud-mini/cmdb/apps/resource/impl/impl_test.go @@ -0,0 +1,17 @@ +package impl_test + +import ( + "context" + + "gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource" + "gitlab.com/go-course-project/go17/devcloud-mini/cmdb/test" +) + +var ( + ctx = context.Background() + svc = resource.GetService() +) + +func init() { + test.SetUp() +} diff --git a/devcloud-mini/cmdb/apps/resource/impl/resource.go b/devcloud-mini/cmdb/apps/resource/impl/resource.go new file mode 100644 index 0000000..a50953c --- /dev/null +++ b/devcloud-mini/cmdb/apps/resource/impl/resource.go @@ -0,0 +1,31 @@ +package impl + +import ( + "context" + + "gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (s *ResourceServiceImpl) Search(context.Context, *resource.SearchRequest) (*resource.ResourceSet, error) { + return nil, status.Errorf(codes.Unimplemented, "method Search not implemented") +} + +func (s *ResourceServiceImpl) Save(ctx context.Context, in *resource.Resource) (*resource.Resource, error) { + if err := in.Validate(); err != nil { + return nil, err + } + + // 保持数据, 需要从ioc里面获取一个mongodb实例 + _, err := s.col.InsertOne(ctx, in) + if err != nil { + return nil, err + } + + return in, nil +} + +func (s *ResourceServiceImpl) DeleteResource(context.Context, *resource.DeleteResourceRequest) error { + return nil +} diff --git a/devcloud-mini/cmdb/apps/resource/impl/resource_test.go b/devcloud-mini/cmdb/apps/resource/impl/resource_test.go new file mode 100644 index 0000000..2e3647f --- /dev/null +++ b/devcloud-mini/cmdb/apps/resource/impl/resource_test.go @@ -0,0 +1,27 @@ +package impl_test + +import ( + "testing" + "time" + + "gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource" +) + +func TestSave(t *testing.T) { + resp, err := svc.Save(ctx, &resource.Resource{ + Meta: &resource.Meta{ + Id: "ins-002", + Domain: "test", + Namespace: "default", + SyncAt: time.Now().Unix(), + }, + Spec: &resource.Spec{ + Name: "test", + }, + Status: &resource.Status{}, + }) + if err != nil { + t.Fatal(err) + } + t.Log(resp) +} diff --git a/devcloud-mini/cmdb/apps/resource/interface.go b/devcloud-mini/cmdb/apps/resource/interface.go new file mode 100644 index 0000000..881cf99 --- /dev/null +++ b/devcloud-mini/cmdb/apps/resource/interface.go @@ -0,0 +1,42 @@ +package resource + +import ( + context "context" + + "github.com/infraboard/mcube/v2/exception" + "github.com/infraboard/mcube/v2/ioc" + "github.com/infraboard/mcube/v2/ioc/config/validator" +) + +const ( + AppName = "resource" +) + +func GetService() Service { + return ioc.Controller().Get(AppName).(Service) +} + +type Service interface { + // 需要对外暴露为rpc的 + RpcServer + // 删除 + DeleteResource(context.Context, *DeleteResourceRequest) error +} + +func NewDeleteResourceRequest() *DeleteResourceRequest { + return &DeleteResourceRequest{} +} + +// 支持多个 +type DeleteResourceRequest struct { + ResourceIds []string `json:"resource_ids"` +} + +func (s *Resource) Validate() error { + err := validator.Validate(s) + if err != nil { + return exception.NewBadRequest("参数校验失败, %s", err) + } + + return nil +} diff --git a/devcloud-mini/cmdb/apps/resource/service.pb.go b/devcloud-mini/cmdb/apps/resource/service.pb.go index f5e7308..02bef3b 100644 --- a/devcloud-mini/cmdb/apps/resource/service.pb.go +++ b/devcloud-mini/cmdb/apps/resource/service.pb.go @@ -258,10 +258,13 @@ func (x *ResourceSet) GetItems() []*Resource { } 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"` + state protoimpl.MessageState `protogen:"open.v1"` + // @gotags: bson:"inline" validate:"required" + Meta *Meta `protobuf:"bytes,1,opt,name=Meta,proto3" json:"Meta,omitempty" bson:"inline" validate:"required"` + // @gotags: bson:"inline" validate:"required" + Spec *Spec `protobuf:"bytes,2,opt,name=Spec,proto3" json:"Spec,omitempty" bson:"inline" validate:"required"` + // @gotags: bson:"inline" validate:"required" + Status *Status `protobuf:"bytes,3,opt,name=Status,proto3" json:"Status,omitempty" bson:"inline" validate:"required"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -320,8 +323,8 @@ func (x *Resource) GetStatus() *Status { 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:"id" bson:"_id" validate:"required" + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id" validate:"required"` // 资源所属域 // @gotags: json:"domain" validate:"required" Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain" validate:"required"` diff --git a/devcloud-mini/cmdb/apps/resource/service.proto b/devcloud-mini/cmdb/apps/resource/service.proto index f0edae5..4767ced 100644 --- a/devcloud-mini/cmdb/apps/resource/service.proto +++ b/devcloud-mini/cmdb/apps/resource/service.proto @@ -31,14 +31,17 @@ message ResourceSet { } message Resource { + // @gotags: bson:"inline" validate:"required" Meta Meta = 1; + // @gotags: bson:"inline" validate:"required" Spec Spec = 2; + // @gotags: bson:"inline" validate:"required" Status Status = 3; } message Meta { // 全局唯一Id, 直接使用个云商自己的Id - // @gotags: json:"id" validate:"required" + // @gotags: json:"id" bson:"_id" validate:"required" string id = 1; // 资源所属域 // @gotags: json:"domain" validate:"required" diff --git a/devcloud-mini/cmdb/etc/application.toml b/devcloud-mini/cmdb/etc/application.toml index f63304f..1cfdb8f 100644 --- a/devcloud-mini/cmdb/etc/application.toml +++ b/devcloud-mini/cmdb/etc/application.toml @@ -19,4 +19,5 @@ port = 18010 [mongo] - endpoints = ["127.0.0.1:27017"] \ No newline at end of file + endpoints = ["127.0.0.1:27017"] + database = "go17" \ No newline at end of file diff --git a/devcloud-mini/cmdb/test/setup.go b/devcloud-mini/cmdb/test/setup.go new file mode 100644 index 0000000..b5d65f5 --- /dev/null +++ b/devcloud-mini/cmdb/test/setup.go @@ -0,0 +1,15 @@ +package test + +import ( + "fmt" + "os" + + "github.com/infraboard/mcube/v2/ioc" + + _ "gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps" +) + +func SetUp() { + fmt.Println(os.Getwd()) + ioc.DevelopmentSetupWithPath(os.Getenv("CmdbConfigPath")) +} 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 deleted file mode 100644 index a7687f2..0000000 --- a/devcloud-mini/gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/service.pb.go +++ /dev/null @@ -1,920 +0,0 @@ -// 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 deleted file mode 100644 index 7dc9fa8..0000000 --- a/devcloud-mini/gitlab.com/go-course-project/go17/devcloud-mini/cmdb/apps/resource/service_grpc.pb.go +++ /dev/null @@ -1,163 +0,0 @@ -// 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/go.mod b/go.mod index caa1ae4..e713a5d 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/google/uuid v1.6.0 github.com/infraboard/mcube/v2 v2.0.49 github.com/rs/zerolog v1.32.0 + go.mongodb.org/mongo-driver v1.14.0 golang.org/x/crypto v0.31.0 google.golang.org/grpc v1.70.0 google.golang.org/protobuf v1.35.2 @@ -40,6 +41,7 @@ require ( github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/goccy/go-json v0.10.2 // indirect + github.com/golang/snappy v0.0.1 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect @@ -50,6 +52,7 @@ require ( github.com/jinzhu/now v1.1.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.15.9 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/leodido/go-urn v1.4.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -57,6 +60,7 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect @@ -66,7 +70,12 @@ require ( github.com/ugorji/go/codec v1.2.12 // indirect github.com/uptrace/opentelemetry-go-extra/otelgorm v0.2.3 // indirect github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.3 // indirect + github.com/xdg-go/pbkdf2 v1.0.0 // indirect + github.com/xdg-go/scram v1.1.2 // indirect + github.com/xdg-go/stringprep v1.0.4 // indirect + github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.49.0 // indirect + go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect diff --git a/go.sum b/go.sum index 5cab6ce..66625a9 100644 --- a/go.sum +++ b/go.sum @@ -57,6 +57,8 @@ github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -87,6 +89,8 @@ github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8Hm github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= +github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= @@ -110,6 +114,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -148,8 +154,21 @@ github.com/uptrace/opentelemetry-go-extra/otelgorm v0.2.3 h1:girTS67d1m8+XUJLbNB github.com/uptrace/opentelemetry-go-extra/otelgorm v0.2.3/go.mod h1:kjsn/ilDe5TABXwTy7Dg/Lfr2pRAjrCD+yPV+pbhOMY= github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.3 h1:LNi0Qa7869/loPjz2kmMvp/jwZZnMZ9scMJKhDJ1DIo= github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.3/go.mod h1:jyigonKik3C5V895QNiAGpKYKEvFuqjw9qAEZks1mUg= +github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= +go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.49.0 h1:1f31+6grJmV3X4lxcEvUy13i5/kfDw1nJZwhd8mA4tg= go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.49.0/go.mod h1:1P/02zM3OwkX9uki+Wmxw3a5GVb6KUXRsa7m7bOC9Fg= +go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.49.0 h1:qF3LdpkD3Kbaw0Smsh+SVcJI/mtYGz9ZdCmu0YF2Lo4= +go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.49.0/go.mod h1:eqNF9g7W06ubrU7jk6M6UW9OTrcSPZvVY10cw9DUJ7c= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= go.opentelemetry.io/contrib/propagators/b3 v1.24.0 h1:n4xwCdTx3pZqZs2CjS/CUZAs03y3dZcGhC/FepKtEUY= @@ -173,20 +192,43 @@ go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7e golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a h1:OAiGFfOiA0v9MRYsSidp3ubZaBnteRUyn3xB2ZQ5G/E= google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a/go.mod h1:jehYqy3+AhJU9ve55aNOaSml7wUXjF9x6z2LcCfpAhY= google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a h1:hgh8P4EuoxpsuKMXX/To36nOFD7vixReXgn8lPGnt+o=