diff --git a/adaptor/PCM-FC/PCM-SCF/Dockerfile b/adaptor/PCM-FC/PCM-SCF/Dockerfile new file mode 100644 index 00000000..29f9333c --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/Dockerfile @@ -0,0 +1,20 @@ +FROM alpine:3.16.2 +WORKDIR /home + +# 修改alpine源为上海交通大学 +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.sjtug.sjtu.edu.cn/g' /etc/apk/repositories && \ + apk update && \ + apk upgrade && \ + apk add --no-cache ca-certificates && update-ca-certificates && \ + apk add --update tzdata && \ + rm -rf /var/cache/apk/* + + +COPY pcm-modelarts /home/ +COPY etc/scf.yaml /home/ + +ENV TZ=Asia/Shanghai + +EXPOSE 2003 + +ENTRYPOINT ./pcm-scf -f scf.yaml \ No newline at end of file diff --git a/adaptor/PCM-FC/PCM-SCF/Makefile b/adaptor/PCM-FC/PCM-SCF/Makefile new file mode 100644 index 00000000..ca998c42 --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/Makefile @@ -0,0 +1,2 @@ +rpc-gen: + goctl rpc protoc ./pb/*.proto --go_out=./ --go-grpc_out=./ --zrpc_out=. \ No newline at end of file diff --git a/adaptor/PCM-FC/PCM-SCF/READM.md b/adaptor/PCM-FC/PCM-SCF/READM.md new file mode 100644 index 00000000..fe0e88a5 --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/READM.md @@ -0,0 +1,13 @@ +# pcm对接腾讯云云函数 SCF + +### 腾讯云SCF 常用的 API 如下,更多 API 可参考 [API 文档](https://cloud.tencent.com/document/product/583/17234) + +> 接口对接进度 + +- [ ] CreateFunction 创建函数 +- [ ] DeleteFunction 删除函数 +- [ ] GetFunction 获取函数详细信息 +- [ ] Invoke 运行函数 +- [x] ListFunctions 获取函数列表 +- [ ] UpdateFunctionCode 更新函数代码 +- [ ] UpdateFunctionConfiguration 更新函数配置 \ No newline at end of file diff --git a/adaptor/PCM-FC/PCM-SCF/etc/pcmscf.yaml b/adaptor/PCM-FC/PCM-SCF/etc/pcmscf.yaml new file mode 100644 index 00000000..50614b26 --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/etc/pcmscf.yaml @@ -0,0 +1,15 @@ +NacosConfig: + DataId: pcm-scf-rpc.yaml + Group: DEFAULT_GROUP + ServerConfigs: + # - IpAddr: 127.0.0.1 + # Port: 8848 + - IpAddr: nacos.jcce.dev + Port: 8848 + ClientConfig: + NamespaceId: test + TimeoutMs: 5000 + NotLoadCacheAtStart: true + LogDir: + CacheDir: + LogLevel: debug \ No newline at end of file diff --git a/adaptor/PCM-FC/PCM-SCF/internal/config/config.go b/adaptor/PCM-FC/PCM-SCF/internal/config/config.go new file mode 100755 index 00000000..f75f3c68 --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/internal/config/config.go @@ -0,0 +1,18 @@ +package config + +import ( + "github.com/zeromicro/go-zero/core/logx" + "github.com/zeromicro/go-zero/zrpc" +) + +type Config struct { + zrpc.RpcServerConf + LogConf logx.LogConf + PcmCoreRpcConf zrpc.RpcClientConf + SecretConfig SecretConfig +} + +type SecretConfig struct { + SecretId string `json:"secretId"` + SecretKey string `json:"secretKey"` +} diff --git a/adaptor/PCM-FC/PCM-SCF/internal/logic/listfunctionslogic.go b/adaptor/PCM-FC/PCM-SCF/internal/logic/listfunctionslogic.go new file mode 100644 index 00000000..a79b5b8f --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/internal/logic/listfunctionslogic.go @@ -0,0 +1,58 @@ +package logic + +import ( + "PCM/adaptor/PCM-FC/PCM-SCF/internal/svc" + "PCM/adaptor/PCM-FC/PCM-SCF/scf" + "PCM/common/tool" + "context" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" + tscf "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416" + "github.com/zeromicro/go-zero/core/logx" +) + +type ListFunctionsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewListFunctionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListFunctionsLogic { + return &ListFunctionsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 查询腾讯云云函数列表 +func (l *ListFunctionsLogic) ListFunctions(in *scf.ListFunctionsReq) (*scf.ListFunctionsResp, error) { + resp := &scf.ListFunctionsResp{} + // 实例化一个client选项,可选的,没有特殊需求可以跳过 + cpf := profile.NewClientProfile() + //请求域名,表示用户的接入地域,默认就近接入 + cpf.HttpProfile.Endpoint = "scf.tencentcloudapi.com" + // 实例化要请求产品的client对象,clientProfile是可选的 + client, _ := tscf.NewClient(l.svcCtx.Credential, in.Region, cpf) + + // 实例化一个请求对象,每个接口都会对应一个request对象 + request := tscf.NewListFunctionsRequest() + + request.Limit = common.Int64Ptr(in.Limit) + if in.Namespace != "" { + request.Namespace = common.StringPtr(in.Namespace) + } + + // 返回的resp是一个ListFunctionsResponse的实例,与请求对象对应 + response, err := client.ListFunctions(request) + if _, ok := err.(*errors.TencentCloudSDKError); ok { + logx.Error(l.ctx, "An API error has returned: ", err) + return nil, nil + } + if err != nil { + panic(err) + } + tool.Convert(response.Response, &resp.Response) + return resp, nil +} diff --git a/adaptor/PCM-FC/PCM-SCF/internal/server/scfserver.go b/adaptor/PCM-FC/PCM-SCF/internal/server/scfserver.go new file mode 100644 index 00000000..c55b8f29 --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/internal/server/scfserver.go @@ -0,0 +1,29 @@ +// Code generated by goctl. DO NOT EDIT. +// Source: pcm-scf.proto + +package server + +import ( + "context" + + "PCM/adaptor/PCM-FC/PCM-SCF/internal/logic" + "PCM/adaptor/PCM-FC/PCM-SCF/internal/svc" + "PCM/adaptor/PCM-FC/PCM-SCF/scf" +) + +type ScfServer struct { + svcCtx *svc.ServiceContext + scf.UnimplementedScfServer +} + +func NewScfServer(svcCtx *svc.ServiceContext) *ScfServer { + return &ScfServer{ + svcCtx: svcCtx, + } +} + +// 查询腾讯云云函数列表 +func (s *ScfServer) ListFunctions(ctx context.Context, in *scf.ListFunctionsReq) (*scf.ListFunctionsResp, error) { + l := logic.NewListFunctionsLogic(ctx, s.svcCtx) + return l.ListFunctions(in) +} diff --git a/adaptor/PCM-FC/PCM-SCF/internal/svc/servicecontext.go b/adaptor/PCM-FC/PCM-SCF/internal/svc/servicecontext.go new file mode 100644 index 00000000..77088ce8 --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/internal/svc/servicecontext.go @@ -0,0 +1,24 @@ +package svc + +import ( + "PCM/adaptor/PCM-FC/PCM-SCF/internal/config" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" +) + +type ServiceContext struct { + Config config.Config + Credential *common.Credential +} + +func NewServiceContext(c config.Config) *ServiceContext { + + credential := common.NewCredential( + c.SecretConfig.SecretId, + c.SecretConfig.SecretKey, + ) + + return &ServiceContext{ + Credential: credential, + Config: c, + } +} diff --git a/adaptor/PCM-FC/PCM-SCF/pb/pcm-scf.proto b/adaptor/PCM-FC/PCM-SCF/pb/pcm-scf.proto new file mode 100644 index 00000000..999cb183 --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/pb/pcm-scf.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; + +package scf; +option go_package = "/scf"; + +message ListFunctionsReq { + string order = 1; + string orderby = 2; + int32 offset = 3; + int64 limit = 4; + string searchKey = 5; + string namespace = 6; + string description = 7; + repeated Filters filters = 8; + string region = 9; +} + +message Filters { + string name = 1; + repeated int32 values = 2; +} + + +message ListFunctionsResp { + Response response = 1; +} + +message Functions { + string addTime = 1; + string asyncRunEnable = 2; + string description = 3; + string functionId = 4; + string functionName = 5; + string modTime = 6; + string namespace = 7; + int32 reservedConcurrencyMem = 8; + string runtime = 9; + string status = 10; + string statusDesc = 11; + repeated string statusReasons = 12; + repeated string tags = 13; + int32 totalProvisionedConcurrencyMem = 14; + string traceEnable = 15; + string type = 16; +} + +message Response { + repeated Functions functions = 1; + string requestId = 2; + int32 totalCount = 3; +} + + +// scf +service Scf { + + //查询腾讯云云函数列表 + rpc ListFunctions(ListFunctionsReq) returns (ListFunctionsResp); + +} diff --git a/adaptor/PCM-FC/PCM-SCF/pcmscf.go b/adaptor/PCM-FC/PCM-SCF/pcmscf.go new file mode 100644 index 00000000..344e6af3 --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/pcmscf.go @@ -0,0 +1,67 @@ +package main + +import ( + "PCM/adaptor/PCM-FC/PCM-SCF/internal/server" + "PCM/adaptor/PCM-FC/PCM-SCF/internal/svc" + "PCM/adaptor/PCM-FC/PCM-SCF/scf" + commonConfig "PCM/common/config" + "PCM/common/interceptor/rpcserver" + "flag" + + "github.com/zeromicro/go-zero/core/logx" + + "PCM/adaptor/PCM-FC/PCM-SCF/internal/config" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "adaptor/PCM-FC/PCM-SCF/etc/pcmscf.yaml", "the config file") + +func main() { + + flag.Parse() + + var bootstrapConfig commonConfig.BootstrapConfig + conf.MustLoad(*configFile, &bootstrapConfig) + + //解析业务配置 + var c config.Config + nacosConfig := bootstrapConfig.NacosConfig + + serviceConfigContent := nacosConfig.InitConfig(func(data string) { + err := conf.LoadFromYamlBytes([]byte(data), &c) + if err != nil { + panic(err) + } + }) + err := conf.LoadFromYamlBytes([]byte(serviceConfigContent), &c) + if err != nil { + panic(err) + } + // start log component + logx.MustSetup(c.LogConf) + // 注册到nacos + nacosConfig.Discovery(&c.RpcServerConf) + + ctx := svc.NewServiceContext(c) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + scf.RegisterScfServer(grpcServer, server.NewScfServer(ctx)) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + + //rpc log + s.AddUnaryInterceptors(rpcserver.LoggerInterceptor) + + defer s.Stop() + + logx.Infof("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/adaptor/PCM-FC/PCM-SCF/scf/pcm-scf.pb.go b/adaptor/PCM-FC/PCM-SCF/scf/pcm-scf.pb.go new file mode 100644 index 00000000..9cf29a8c --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/scf/pcm-scf.pb.go @@ -0,0 +1,663 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: pb/pcm-scf.proto + +package scf + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 ListFunctionsReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Order string `protobuf:"bytes,1,opt,name=order,proto3" json:"order,omitempty"` + Orderby string `protobuf:"bytes,2,opt,name=orderby,proto3" json:"orderby,omitempty"` + Offset int32 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` + Limit int64 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` + SearchKey string `protobuf:"bytes,5,opt,name=searchKey,proto3" json:"searchKey,omitempty"` + Namespace string `protobuf:"bytes,6,opt,name=namespace,proto3" json:"namespace,omitempty"` + Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` + Filters []*Filters `protobuf:"bytes,8,rep,name=filters,proto3" json:"filters,omitempty"` + Region string `protobuf:"bytes,9,opt,name=region,proto3" json:"region,omitempty"` +} + +func (x *ListFunctionsReq) Reset() { + *x = ListFunctionsReq{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_pcm_scf_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFunctionsReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFunctionsReq) ProtoMessage() {} + +func (x *ListFunctionsReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_pcm_scf_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFunctionsReq.ProtoReflect.Descriptor instead. +func (*ListFunctionsReq) Descriptor() ([]byte, []int) { + return file_pb_pcm_scf_proto_rawDescGZIP(), []int{0} +} + +func (x *ListFunctionsReq) GetOrder() string { + if x != nil { + return x.Order + } + return "" +} + +func (x *ListFunctionsReq) GetOrderby() string { + if x != nil { + return x.Orderby + } + return "" +} + +func (x *ListFunctionsReq) GetOffset() int32 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *ListFunctionsReq) GetLimit() int64 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *ListFunctionsReq) GetSearchKey() string { + if x != nil { + return x.SearchKey + } + return "" +} + +func (x *ListFunctionsReq) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +func (x *ListFunctionsReq) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *ListFunctionsReq) GetFilters() []*Filters { + if x != nil { + return x.Filters + } + return nil +} + +func (x *ListFunctionsReq) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +type Filters struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Values []int32 `protobuf:"varint,2,rep,packed,name=values,proto3" json:"values,omitempty"` +} + +func (x *Filters) Reset() { + *x = Filters{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_pcm_scf_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Filters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Filters) ProtoMessage() {} + +func (x *Filters) ProtoReflect() protoreflect.Message { + mi := &file_pb_pcm_scf_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Filters.ProtoReflect.Descriptor instead. +func (*Filters) Descriptor() ([]byte, []int) { + return file_pb_pcm_scf_proto_rawDescGZIP(), []int{1} +} + +func (x *Filters) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Filters) GetValues() []int32 { + if x != nil { + return x.Values + } + return nil +} + +type ListFunctionsResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Response *Response `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` +} + +func (x *ListFunctionsResp) Reset() { + *x = ListFunctionsResp{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_pcm_scf_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFunctionsResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFunctionsResp) ProtoMessage() {} + +func (x *ListFunctionsResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_pcm_scf_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFunctionsResp.ProtoReflect.Descriptor instead. +func (*ListFunctionsResp) Descriptor() ([]byte, []int) { + return file_pb_pcm_scf_proto_rawDescGZIP(), []int{2} +} + +func (x *ListFunctionsResp) GetResponse() *Response { + if x != nil { + return x.Response + } + return nil +} + +type Functions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AddTime string `protobuf:"bytes,1,opt,name=addTime,proto3" json:"addTime,omitempty"` + AsyncRunEnable string `protobuf:"bytes,2,opt,name=asyncRunEnable,proto3" json:"asyncRunEnable,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + FunctionId string `protobuf:"bytes,4,opt,name=functionId,proto3" json:"functionId,omitempty"` + FunctionName string `protobuf:"bytes,5,opt,name=functionName,proto3" json:"functionName,omitempty"` + ModTime string `protobuf:"bytes,6,opt,name=modTime,proto3" json:"modTime,omitempty"` + Namespace string `protobuf:"bytes,7,opt,name=namespace,proto3" json:"namespace,omitempty"` + ReservedConcurrencyMem int32 `protobuf:"varint,8,opt,name=reservedConcurrencyMem,proto3" json:"reservedConcurrencyMem,omitempty"` + Runtime string `protobuf:"bytes,9,opt,name=runtime,proto3" json:"runtime,omitempty"` + Status string `protobuf:"bytes,10,opt,name=status,proto3" json:"status,omitempty"` + StatusDesc string `protobuf:"bytes,11,opt,name=statusDesc,proto3" json:"statusDesc,omitempty"` + StatusReasons []string `protobuf:"bytes,12,rep,name=statusReasons,proto3" json:"statusReasons,omitempty"` + Tags []string `protobuf:"bytes,13,rep,name=tags,proto3" json:"tags,omitempty"` + TotalProvisionedConcurrencyMem int32 `protobuf:"varint,14,opt,name=totalProvisionedConcurrencyMem,proto3" json:"totalProvisionedConcurrencyMem,omitempty"` + TraceEnable string `protobuf:"bytes,15,opt,name=traceEnable,proto3" json:"traceEnable,omitempty"` + Type string `protobuf:"bytes,16,opt,name=type,proto3" json:"type,omitempty"` +} + +func (x *Functions) Reset() { + *x = Functions{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_pcm_scf_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Functions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Functions) ProtoMessage() {} + +func (x *Functions) ProtoReflect() protoreflect.Message { + mi := &file_pb_pcm_scf_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Functions.ProtoReflect.Descriptor instead. +func (*Functions) Descriptor() ([]byte, []int) { + return file_pb_pcm_scf_proto_rawDescGZIP(), []int{3} +} + +func (x *Functions) GetAddTime() string { + if x != nil { + return x.AddTime + } + return "" +} + +func (x *Functions) GetAsyncRunEnable() string { + if x != nil { + return x.AsyncRunEnable + } + return "" +} + +func (x *Functions) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Functions) GetFunctionId() string { + if x != nil { + return x.FunctionId + } + return "" +} + +func (x *Functions) GetFunctionName() string { + if x != nil { + return x.FunctionName + } + return "" +} + +func (x *Functions) GetModTime() string { + if x != nil { + return x.ModTime + } + return "" +} + +func (x *Functions) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +func (x *Functions) GetReservedConcurrencyMem() int32 { + if x != nil { + return x.ReservedConcurrencyMem + } + return 0 +} + +func (x *Functions) GetRuntime() string { + if x != nil { + return x.Runtime + } + return "" +} + +func (x *Functions) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *Functions) GetStatusDesc() string { + if x != nil { + return x.StatusDesc + } + return "" +} + +func (x *Functions) GetStatusReasons() []string { + if x != nil { + return x.StatusReasons + } + return nil +} + +func (x *Functions) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *Functions) GetTotalProvisionedConcurrencyMem() int32 { + if x != nil { + return x.TotalProvisionedConcurrencyMem + } + return 0 +} + +func (x *Functions) GetTraceEnable() string { + if x != nil { + return x.TraceEnable + } + return "" +} + +func (x *Functions) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +type Response struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Functions []*Functions `protobuf:"bytes,1,rep,name=functions,proto3" json:"functions,omitempty"` + RequestId string `protobuf:"bytes,2,opt,name=requestId,proto3" json:"requestId,omitempty"` + TotalCount int32 `protobuf:"varint,3,opt,name=totalCount,proto3" json:"totalCount,omitempty"` +} + +func (x *Response) Reset() { + *x = Response{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_pcm_scf_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Response) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Response) ProtoMessage() {} + +func (x *Response) ProtoReflect() protoreflect.Message { + mi := &file_pb_pcm_scf_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Response.ProtoReflect.Descriptor instead. +func (*Response) Descriptor() ([]byte, []int) { + return file_pb_pcm_scf_proto_rawDescGZIP(), []int{4} +} + +func (x *Response) GetFunctions() []*Functions { + if x != nil { + return x.Functions + } + return nil +} + +func (x *Response) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *Response) GetTotalCount() int32 { + if x != nil { + return x.TotalCount + } + return 0 +} + +var File_pb_pcm_scf_proto protoreflect.FileDescriptor + +var file_pb_pcm_scf_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x70, 0x62, 0x2f, 0x70, 0x63, 0x6d, 0x2d, 0x73, 0x63, 0x66, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x03, 0x73, 0x63, 0x66, 0x22, 0x8e, 0x02, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, + 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, + 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x72, 0x64, + 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x79, 0x12, 0x16, 0x0a, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x4b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x73, 0x63, 0x66, 0x2e, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, + 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x22, 0x35, 0x0a, 0x07, 0x46, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, + 0x3e, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, 0x63, 0x66, 0x2e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0xad, 0x04, 0x0a, 0x09, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x18, 0x0a, + 0x07, 0x61, 0x64, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x61, 0x64, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x73, 0x79, 0x6e, 0x63, + 0x52, 0x75, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x61, 0x73, 0x79, 0x6e, 0x63, 0x52, 0x75, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, + 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x54, 0x69, 0x6d, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x36, 0x0a, + 0x16, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, + 0x65, 0x6e, 0x63, 0x79, 0x4d, 0x65, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x16, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, + 0x63, 0x79, 0x4d, 0x65, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x44, 0x65, 0x73, 0x63, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x44, 0x65, 0x73, 0x63, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, + 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, + 0x73, 0x12, 0x46, 0x0a, 0x1e, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, + 0x4d, 0x65, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x1e, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x63, 0x75, + 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x4d, 0x65, 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x72, 0x61, + 0x63, 0x65, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x74, 0x72, 0x61, 0x63, 0x65, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, + 0x76, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x66, + 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, + 0x2e, 0x73, 0x63, 0x66, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x09, + 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0x45, 0x0a, 0x03, 0x53, 0x63, 0x66, 0x12, 0x3e, + 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x15, 0x2e, 0x73, 0x63, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x73, 0x63, 0x66, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, + 0x5a, 0x04, 0x2f, 0x73, 0x63, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pb_pcm_scf_proto_rawDescOnce sync.Once + file_pb_pcm_scf_proto_rawDescData = file_pb_pcm_scf_proto_rawDesc +) + +func file_pb_pcm_scf_proto_rawDescGZIP() []byte { + file_pb_pcm_scf_proto_rawDescOnce.Do(func() { + file_pb_pcm_scf_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_pcm_scf_proto_rawDescData) + }) + return file_pb_pcm_scf_proto_rawDescData +} + +var file_pb_pcm_scf_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_pb_pcm_scf_proto_goTypes = []interface{}{ + (*ListFunctionsReq)(nil), // 0: scf.ListFunctionsReq + (*Filters)(nil), // 1: scf.Filters + (*ListFunctionsResp)(nil), // 2: scf.ListFunctionsResp + (*Functions)(nil), // 3: scf.Functions + (*Response)(nil), // 4: scf.Response +} +var file_pb_pcm_scf_proto_depIdxs = []int32{ + 1, // 0: scf.ListFunctionsReq.filters:type_name -> scf.Filters + 4, // 1: scf.ListFunctionsResp.response:type_name -> scf.Response + 3, // 2: scf.Response.functions:type_name -> scf.Functions + 0, // 3: scf.Scf.ListFunctions:input_type -> scf.ListFunctionsReq + 2, // 4: scf.Scf.ListFunctions:output_type -> scf.ListFunctionsResp + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_pb_pcm_scf_proto_init() } +func file_pb_pcm_scf_proto_init() { + if File_pb_pcm_scf_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_pcm_scf_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListFunctionsReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pb_pcm_scf_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Filters); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pb_pcm_scf_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListFunctionsResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pb_pcm_scf_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Functions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pb_pcm_scf_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Response); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_pcm_scf_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pb_pcm_scf_proto_goTypes, + DependencyIndexes: file_pb_pcm_scf_proto_depIdxs, + MessageInfos: file_pb_pcm_scf_proto_msgTypes, + }.Build() + File_pb_pcm_scf_proto = out.File + file_pb_pcm_scf_proto_rawDesc = nil + file_pb_pcm_scf_proto_goTypes = nil + file_pb_pcm_scf_proto_depIdxs = nil +} diff --git a/adaptor/PCM-FC/PCM-SCF/scf/pcm-scf_grpc.pb.go b/adaptor/PCM-FC/PCM-SCF/scf/pcm-scf_grpc.pb.go new file mode 100644 index 00000000..f42227ed --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/scf/pcm-scf_grpc.pb.go @@ -0,0 +1,111 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.21.12 +// source: pb/pcm-scf.proto + +package scf + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Scf_ListFunctions_FullMethodName = "/scf.Scf/ListFunctions" +) + +// ScfClient is the client API for Scf 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 ScfClient interface { + // 查询腾讯云云函数列表 + ListFunctions(ctx context.Context, in *ListFunctionsReq, opts ...grpc.CallOption) (*ListFunctionsResp, error) +} + +type scfClient struct { + cc grpc.ClientConnInterface +} + +func NewScfClient(cc grpc.ClientConnInterface) ScfClient { + return &scfClient{cc} +} + +func (c *scfClient) ListFunctions(ctx context.Context, in *ListFunctionsReq, opts ...grpc.CallOption) (*ListFunctionsResp, error) { + out := new(ListFunctionsResp) + err := c.cc.Invoke(ctx, Scf_ListFunctions_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ScfServer is the server API for Scf service. +// All implementations must embed UnimplementedScfServer +// for forward compatibility +type ScfServer interface { + // 查询腾讯云云函数列表 + ListFunctions(context.Context, *ListFunctionsReq) (*ListFunctionsResp, error) + mustEmbedUnimplementedScfServer() +} + +// UnimplementedScfServer must be embedded to have forward compatible implementations. +type UnimplementedScfServer struct { +} + +func (UnimplementedScfServer) ListFunctions(context.Context, *ListFunctionsReq) (*ListFunctionsResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListFunctions not implemented") +} +func (UnimplementedScfServer) mustEmbedUnimplementedScfServer() {} + +// UnsafeScfServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ScfServer will +// result in compilation errors. +type UnsafeScfServer interface { + mustEmbedUnimplementedScfServer() +} + +func RegisterScfServer(s grpc.ServiceRegistrar, srv ScfServer) { + s.RegisterService(&Scf_ServiceDesc, srv) +} + +func _Scf_ListFunctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListFunctionsReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ScfServer).ListFunctions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Scf_ListFunctions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ScfServer).ListFunctions(ctx, req.(*ListFunctionsReq)) + } + return interceptor(ctx, in, info, handler) +} + +// Scf_ServiceDesc is the grpc.ServiceDesc for Scf service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Scf_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "scf.Scf", + HandlerType: (*ScfServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListFunctions", + Handler: _Scf_ListFunctions_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "pb/pcm-scf.proto", +} diff --git a/adaptor/PCM-FC/PCM-SCF/scfclient/scf.go b/adaptor/PCM-FC/PCM-SCF/scfclient/scf.go new file mode 100644 index 00000000..380cede7 --- /dev/null +++ b/adaptor/PCM-FC/PCM-SCF/scfclient/scf.go @@ -0,0 +1,42 @@ +// Code generated by goctl. DO NOT EDIT. +// Source: pcm-scf.proto + +package scfclient + +import ( + "context" + + "PCM/adaptor/PCM-FC/PCM-SCF/scf" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + Filters = scf.Filters + Functions = scf.Functions + ListFunctionsReq = scf.ListFunctionsReq + ListFunctionsResp = scf.ListFunctionsResp + Response = scf.Response + + Scf interface { + // 查询腾讯云云函数列表 + ListFunctions(ctx context.Context, in *ListFunctionsReq, opts ...grpc.CallOption) (*ListFunctionsResp, error) + } + + defaultScf struct { + cli zrpc.Client + } +) + +func NewScf(cli zrpc.Client) Scf { + return &defaultScf{ + cli: cli, + } +} + +// 查询腾讯云云函数列表 +func (m *defaultScf) ListFunctions(ctx context.Context, in *ListFunctionsReq, opts ...grpc.CallOption) (*ListFunctionsResp, error) { + client := scf.NewScfClient(m.cli.Conn()) + return client.ListFunctions(ctx, in, opts...) +} diff --git a/deploy/README.md b/deploy/README.md index 3286d641..e38a5741 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -1,11 +1,12 @@ -| 服务名 | 端口号 | -|--------------------|------| -| pcm-core-api | 8999 | -| pcm-ac-rpc | 2001 | -| pcm-modelarts-rpc | 2002 | -| pcm-kubenative-rpc | 2003 | -| pcm-core-rpc | 2004 | -| pcm-hanwuji-rpc | 2005 | -| pcm-octopus-rpc | 2006 | -| pcm-th-rpc | 2007 | -| pcm-ceph-rpc | 2008 | \ No newline at end of file +| 服务名 | 端口号 | +|---------------------|------| +| pcm-core-api | 8999 | +| pcm-ac-rpc | 2001 | +| pcm-modelarts-rpc | 2002 | +| pcm-kubenative-rpc | 2003 | +| pcm-core-rpc | 2004 | +| pcm-hanwuji-rpc | 2005 | +| pcm-octopus-rpc | 2006 | +| pcm-th-rpc | 2007 | +| pcm-ceph-rpc | 2008 | +| pcm-scf-rpc | 2009 | \ No newline at end of file diff --git a/go.mod b/go.mod index 3b4be10b..057489f9 100644 --- a/go.mod +++ b/go.mod @@ -8,9 +8,6 @@ require ( github.com/Masterminds/squirrel v1.5.4 github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 github.com/aws/aws-sdk-go v1.44.294 - github.com/aws/aws-sdk-go-v2/config v1.18.25 - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.67 - github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1 github.com/bitly/go-simplejson v0.5.0 github.com/docker/docker v20.10.24+incompatible github.com/go-redis/redis v6.15.9+incompatible @@ -23,6 +20,8 @@ require ( github.com/robfig/cron/v3 v3.0.1 github.com/shopspring/decimal v1.3.1 github.com/sirupsen/logrus v1.9.0 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.693 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.693 github.com/zeromicro/go-queue v1.1.8 github.com/zeromicro/go-zero v1.5.1 go.opentelemetry.io/otel/trace v1.14.0 @@ -38,22 +37,6 @@ require ( require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/aws/aws-sdk-go-v2 v1.18.0 // indirect - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.13.24 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.34 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.25 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.28 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.27 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.2 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.12.10 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.10 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.19.0 // indirect - github.com/aws/smithy-go v1.13.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect github.com/buger/jsonparser v1.1.1 // indirect diff --git a/go.sum b/go.sum index 80ccb5cf..91f5a7d1 100644 --- a/go.sum +++ b/go.sum @@ -435,44 +435,6 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aws/aws-sdk-go v1.44.294 h1:3x7GaEth+pDU9HwFcAU0awZlEix5CEdyIZvV08SlHa8= github.com/aws/aws-sdk-go v1.44.294/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= -github.com/aws/aws-sdk-go-v2 v1.18.0 h1:882kkTpSFhdgYRKVZ/VCgf7sd0ru57p2JCxz4/oN5RY= -github.com/aws/aws-sdk-go-v2 v1.18.0/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 h1:dK82zF6kkPeCo8J1e+tGx4JdvDIQzj7ygIoLg8WMuGs= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10/go.mod h1:VeTZetY5KRJLuD/7fkQXMU6Mw7H5m/KP2J5Iy9osMno= -github.com/aws/aws-sdk-go-v2/config v1.18.25 h1:JuYyZcnMPBiFqn87L2cRppo+rNwgah6YwD3VuyvaW6Q= -github.com/aws/aws-sdk-go-v2/config v1.18.25/go.mod h1:dZnYpD5wTW/dQF0rRNLVypB396zWCcPiBIvdvSWHEg4= -github.com/aws/aws-sdk-go-v2/credentials v1.13.24 h1:PjiYyls3QdCrzqUN35jMWtUK1vqVZ+zLfdOa/UPFDp0= -github.com/aws/aws-sdk-go-v2/credentials v1.13.24/go.mod h1:jYPYi99wUOPIFi0rhiOvXeSEReVOzBqFNOX5bXYoG2o= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3 h1:jJPgroehGvjrde3XufFIJUZVK5A2L9a3KwSFgKy9n8w= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3/go.mod h1:4Q0UFP0YJf0NrsEuEYHpM9fTSEVnD16Z3uyEF7J9JGM= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.67 h1:fI9/5BDEaAv/pv1VO1X1n3jfP9it+IGqWsCuuBQI8wM= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.67/go.mod h1:zQClPRIwQZfJlZq6WZve+s4Tb4JW+3V6eS+4+KrYeP8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 h1:kG5eQilShqmJbv11XL1VpyDbaEJzWxd4zRiCG30GSn4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33/go.mod h1:7i0PF1ME/2eUPFcjkVIwq+DOygHEoK92t5cDqNgYbIw= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27 h1:vFQlirhuM8lLlpI7imKOMsjdQLuN9CPi+k44F/OFVsk= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27/go.mod h1:UrHnn3QV/d0pBZ6QBAEQcqFLf8FAzLmoUfPVIueOvoM= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.34 h1:gGLG7yKaXG02/jBlg210R7VgQIotiQntNhsCFejawx8= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.34/go.mod h1:Etz2dj6UHYuw+Xw830KfzCfWGMzqvUTCjUj5b76GVDc= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.25 h1:AzwRi5OKKwo4QNqPf7TjeO+tK8AyOK3GVSwmRPo7/Cs= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.25/go.mod h1:SUbB4wcbSEyCvqBxv/O/IBf93RbEze7U7OnoTlpPB+g= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 h1:y2+VQzC6Zh2ojtV2LoC0MNwHWc6qXv/j2vrQtlftkdA= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11/go.mod h1:iV4q2hsqtNECrfmlXyord9u4zyuFEJX9eLgLpSPzWA8= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.28 h1:vGWm5vTpMr39tEZfQeDiDAMgk+5qsnvRny3FjLpnH5w= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.28/go.mod h1:spfrICMD6wCAhjhzHuy6DOZZ+LAIY10UxhUmLzpJTTs= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.27 h1:0iKliEXAcCa2qVtRs7Ot5hItA2MsufrphbRFlz1Owxo= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.27/go.mod h1:EOwBD4J4S5qYszS5/3DpkejfuK+Z5/1uzICfPaZLtqw= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.2 h1:NbWkRxEEIRSCqxhsHQuMiTH7yo+JZW1gp8v3elSVMTQ= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.2/go.mod h1:4tfW5l4IAB32VWCDEBxCRtR9T4BWy4I4kr1spr8NgZM= -github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1 h1:O+9nAy9Bb6bJFTpeNFtd9UfHbgxO1o4ZDAM9rQp5NsY= -github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1/go.mod h1:J9kLNzEiHSeGMyN7238EjJmBpCniVzFda75Gxl/NqB8= -github.com/aws/aws-sdk-go-v2/service/sso v1.12.10 h1:UBQjaMTCKwyUYwiVnUt6toEJwGXsLBI6al083tpjJzY= -github.com/aws/aws-sdk-go-v2/service/sso v1.12.10/go.mod h1:ouy2P4z6sJN70fR3ka3wD3Ro3KezSxU6eKGQI2+2fjI= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.10 h1:PkHIIJs8qvq0e5QybnZoG1K/9QTrLr9OsqCIo59jOBA= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.10/go.mod h1:AFvkxc8xfBe8XA+5St5XIHHrQQtkxqrRincx4hmMHOk= -github.com/aws/aws-sdk-go-v2/service/sts v1.19.0 h1:2DQLAKDteoEDI8zpCzqBMaZlJuoE9iTYD0gFmXVax9E= -github.com/aws/aws-sdk-go-v2/service/sts v1.19.0/go.mod h1:BgQOMsg8av8jset59jelyPW7NoZcZXLVpDsXunGDrk8= -github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8= -github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/beanstalkd/go-beanstalk v0.2.0/go.mod h1:/G8YTyChOtpOArwLTQPY1CHB+i212+av35bkPXXj56Y= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -1030,6 +992,10 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.693 h1:RHMxHLQFonA430D1prj5ROhFDmdob3glrIwzYTGILWE= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.693/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.693 h1:2UUZsALzyOTRdFrPb7LOxaMYR5Lc0GLKY7Y3M6bQFsY= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.693/go.mod h1:+90Hl/2wOw2brDEs5yAxMkk9YfFTBWERNSYc4p3ovvI= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ=