From ebdd2416333263a15178683d98154f62208c9267 Mon Sep 17 00:00:00 2001 From: zhouqunjie <450705171@qq.com> Date: Mon, 4 Apr 2022 17:38:53 +0800 Subject: [PATCH] refactor --- adaptor/pod_adaptor/server/pod/list.go | 125 +++ adaptor/pod_adaptor/service/poder/poder.go | 45 ++ common/server/server_pod.go | 38 + go.mod | 53 ++ lan_trans/idl/pbpod/pod.pb.go | 745 ++++++++++++++++++ lan_trans/idl/pbpod/pod.pb.gw.go | 335 ++++++++ lan_trans/idl/pbpod/pod_grpc.pb.go | 183 +++++ .../openapiv2/idl/demo/demo.swagger.json | 96 +++ .../openapiv2/idl/pbecs/ecs.swagger.json | 331 ++++++++ .../openapiv2/idl/pbpod/pod.swagger.json | 314 ++++++++ .../idl/pbtenant/tenant.swagger.json | 43 + 11 files changed, 2308 insertions(+) create mode 100644 adaptor/pod_adaptor/server/pod/list.go create mode 100644 adaptor/pod_adaptor/service/poder/poder.go create mode 100644 common/server/server_pod.go create mode 100644 go.mod create mode 100644 lan_trans/idl/pbpod/pod.pb.go create mode 100644 lan_trans/idl/pbpod/pod.pb.gw.go create mode 100644 lan_trans/idl/pbpod/pod_grpc.pb.go create mode 100644 lan_trans/openapiv2/idl/demo/demo.swagger.json create mode 100644 lan_trans/openapiv2/idl/pbecs/ecs.swagger.json create mode 100644 lan_trans/openapiv2/idl/pbpod/pod.swagger.json create mode 100644 lan_trans/openapiv2/idl/pbtenant/tenant.swagger.json diff --git a/adaptor/pod_adaptor/server/pod/list.go b/adaptor/pod_adaptor/server/pod/list.go new file mode 100644 index 00000000..730a8d20 --- /dev/null +++ b/adaptor/pod_adaptor/server/pod/list.go @@ -0,0 +1,125 @@ +package pod + +import ( + "context" + "gitlink.org.cn/JCCE/PCM/adaptor/pod_adaptor/service/poder" + "gitlink.org.cn/JCCE/PCM/common/tenanter" + "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod" + "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant" + "sync" + + "github.com/golang/glog" + "github.com/pkg/errors" +) + +func ListPodDetail(ctx context.Context, req *pbpod.ListPodDetailReq) (*pbpod.ListPodDetailResp, error) { + var ( + pod poder.Poder + ) + + tenanters, err := tenanter.GetTenanters(req.Provider) + if err != nil { + return nil, errors.WithMessage(err, "getTenanters error") + } + + region, err := tenanter.NewRegion(req.Provider, req.RegionId) + if err != nil { + return nil, errors.WithMessagef(err, "provider %v regionId %v", req.Provider, req.RegionId) + } + + for _, tenanter := range tenanters { + if req.AccountName == "" || tenanter.AccountName() == req.AccountName { + if pod, err = poder.NewPodClient(req.Provider, region, tenanter); err != nil { + return nil, errors.WithMessage(err, "NewPodClient error") + } + break + } + } + + return pod.ListPodDetail(ctx, req) +} + +func ListPod(ctx context.Context, req *pbpod.ListPodReq) (*pbpod.ListPodResp, error) { + var ( + wg sync.WaitGroup + mutex sync.Mutex + pods []*pbpod.PodInstance + ) + + tenanters, err := tenanter.GetTenanters(req.Provider) + if err != nil { + return nil, errors.WithMessage(err, "getTenanters error") + } + + regions := tenanter.GetAllRegionIds(req.Provider) + + wg.Add(len(tenanters) * len(regions)) + for _, t := range tenanters { + for _, region := range regions { + go func(tenant tenanter.Tenanter, region tenanter.Region) { + defer wg.Done() + pod, err := poder.NewPodClient(req.Provider, region, tenant) + if err != nil { + glog.Errorf("New Pod Client error %v", err) + return + } + + request := &pbpod.ListPodDetailReq{ + Provider: req.Provider, + AccountName: tenant.AccountName(), + RegionId: region.GetId(), + PageNumber: 1, + PageSize: 100, + NextToken: "", + } + for { + resp, err := pod.ListPodDetail(ctx, request) + if err != nil { + glog.Errorf("ListDetail error %v", err) + return + } + mutex.Lock() + pods = append(pods, resp.Pods...) + mutex.Unlock() + if resp.Finished { + break + } + request.PageNumber, request.PageSize, request.NextToken = resp.PageNumber, resp.PageSize, resp.NextToken + } + }(t, region) + + } + } + wg.Wait() + + return &pbpod.ListPodResp{Pods: pods}, nil +} + +func ListPodAll(ctx context.Context) (*pbpod.ListPodResp, error) { + var ( + wg sync.WaitGroup + mutex sync.Mutex + pods []*pbpod.PodInstance + ) + + wg.Add(len(pbtenant.CloudProvider_name)) + for k := range pbtenant.CloudProvider_name { + go func(provider int32) { + defer wg.Done() + + resp, err := ListPod(ctx, &pbpod.ListPodReq{Provider: pbtenant.CloudProvider(provider)}) + if err != nil { + glog.Errorf("List error %v", err) + return + } + + mutex.Lock() + pods = append(pods, resp.Pods...) + mutex.Unlock() + }(k) + } + + wg.Wait() + + return &pbpod.ListPodResp{Pods: pods}, nil +} diff --git a/adaptor/pod_adaptor/service/poder/poder.go b/adaptor/pod_adaptor/service/poder/poder.go new file mode 100644 index 00000000..adf17d12 --- /dev/null +++ b/adaptor/pod_adaptor/service/poder/poder.go @@ -0,0 +1,45 @@ +package poder + +import ( + "context" + "gitlink.org.cn/JCCE/PCM/common/tenanter" + "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod" + "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant" + + "github.com/golang/glog" + "github.com/pkg/errors" +) + +var ( + ErrPodListNotSupported = errors.New("cloud not supported pod list") + ErrPoderPanic = errors.New("pod init panic") +) + +type Poder interface { + ListPodDetail(ctx context.Context, req *pbpod.ListPodDetailReq) (resp *pbpod.ListPodDetailResp, err error) +} + +func NewPodClient(provider pbtenant.CloudProvider, region tenanter.Region, tenant tenanter.Tenanter) (poder Poder, err error) { + // 部分sdk会在内部panic + defer func() { + if err1 := recover(); err1 != nil { + glog.Errorf("NewPodClient panic %v", err1) + err = errors.WithMessagef(ErrPoderPanic, "%v", err1) + } + }() + + switch provider { + case pbtenant.CloudProvider_ali: + return newAliEciClient(region, tenant) + case pbtenant.CloudProvider_tencent: + return nil, nil + case pbtenant.CloudProvider_huawei: + return nil, nil + //TODO aws + //case pbtenant.CloudProvider_aws: + // return newAwsPodClient(region, tenant) + } + + err = errors.WithMessagef(ErrPodListNotSupported, "cloud provider %v region %v", provider, region) + return +} diff --git a/common/server/server_pod.go b/common/server/server_pod.go new file mode 100644 index 00000000..5028f5dd --- /dev/null +++ b/common/server/server_pod.go @@ -0,0 +1,38 @@ +package server + +import ( + "context" + "gitlink.org.cn/JCCE/PCM/adaptor/pod_adaptor/server/pod" + "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod" + + "github.com/golang/glog" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (s *Server) ListPodDetail(ctx context.Context, req *pbpod.ListPodDetailReq) (*pbpod.ListPodDetailResp, error) { + resp, err := pod.ListPodDetail(ctx, req) + if err != nil { + glog.Errorf("ListPodDetail error %+v", err) + return nil, status.Errorf(codes.Internal, err.Error()) + } + return resp, nil +} + +func (s *Server) ListPod(ctx context.Context, req *pbpod.ListPodReq) (*pbpod.ListPodResp, error) { + resp, err := pod.ListPod(ctx, req) + if err != nil { + glog.Errorf("ListPod error %+v", err) + return nil, status.Errorf(codes.Internal, err.Error()) + } + return resp, nil +} + +func (s *Server) ListPodAll(ctx context.Context, req *pbpod.ListPodAllReq) (*pbpod.ListPodResp, error) { + resp, err := pod.ListPodAll(ctx) + if err != nil { + glog.Errorf("ListPodAll error %+v", err) + return nil, status.Errorf(codes.Internal, err.Error()) + } + return resp, nil +} diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..f1e37ae8 --- /dev/null +++ b/go.mod @@ -0,0 +1,53 @@ +module gitlink.org.cn/JCCE/PCM + +go 1.17 + +require ( + github.com/Unknwon/goconfig v1.0.0 + github.com/aliyun/alibaba-cloud-sdk-go v1.61.1530 + github.com/go-yaml/yaml v2.1.0+incompatible + github.com/golang/glog v1.0.0 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.0 + github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.0.82 + github.com/pkg/errors v0.9.1 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.377 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.377 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.371 + google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e + google.golang.org/grpc v1.45.0 + google.golang.org/protobuf v1.28.0 + k8s.io/api v0.0.0-20190620084959-7cf5895f2711 + k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719 + k8s.io/client-go v0.0.0-20190620085101-78d2af792bab +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/evanphx/json-patch v0.0.0-20190203023257-5858425f7550 // indirect + github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/google/gofuzz v1.0.0 // indirect + github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d // indirect + github.com/imdario/mergo v0.3.5 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/json-iterator/go v1.1.10 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/smartystreets/goconvey v1.7.2 // indirect + github.com/spf13/pflag v1.0.1 // indirect + golang.org/x/crypto v0.0.0-20210920023735-84f357641f63 // indirect + golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect + golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect + golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect + golang.org/x/text v0.3.7 // indirect + golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect + google.golang.org/appengine v1.6.6 // indirect + gopkg.in/inf.v0 v0.9.0 // indirect + gopkg.in/ini.v1 v1.66.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + k8s.io/klog v0.3.1 // indirect + k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30 // indirect + k8s.io/utils v0.0.0-20190221042446-c2654d5206da // indirect + sigs.k8s.io/yaml v1.3.0 // indirect +) diff --git a/lan_trans/idl/pbpod/pod.pb.go b/lan_trans/idl/pbpod/pod.pb.go new file mode 100644 index 00000000..9fc19366 --- /dev/null +++ b/lan_trans/idl/pbpod/pod.pb.go @@ -0,0 +1,745 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc (unknown) +// source: idl/pbpod/pod.proto + +package pbpod + +import ( + pbtenant "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant" + _ "google.golang.org/genproto/googleapis/api/annotations" + 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 PodInstance struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 云类型 + Provider pbtenant.CloudProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=pbtenant.CloudProvider" json:"provider,omitempty"` + // 账号名称 + AccountName string `protobuf:"bytes,2,opt,name=account_name,json=accountName,proto3" json:"account_name,omitempty"` + // 实例id + PodId string `protobuf:"bytes,3,opt,name=pod_id,json=podId,proto3" json:"pod_id,omitempty"` + // 实例名称 + PodName string `protobuf:"bytes,4,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"` + // 地域,数据中心 + RegionName string `protobuf:"bytes,5,opt,name=region_name,json=regionName,proto3" json:"region_name,omitempty"` + // 镜像 + ContainerImage string `protobuf:"bytes,6,opt,name=container_image,json=containerImage,proto3" json:"container_image,omitempty"` + // 容器名称 + ContainerName string `protobuf:"bytes,7,opt,name=container_name,json=containerName,proto3" json:"container_name,omitempty"` + // vcpu数 + CpuPod float32 `protobuf:"fixed32,8,opt,name=cpu_pod,json=cpuPod,proto3" json:"cpu_pod,omitempty"` + // 内存MB + MemoryPod float32 `protobuf:"fixed32,9,opt,name=memory_pod,json=memoryPod,proto3" json:"memory_pod,omitempty"` + //安全组ID 对应腾讯 SecurityGroupIds(腾讯必需) + SecurityGroupId string `protobuf:"bytes,10,opt,name=security_group_id,json=securityGroupId,proto3" json:"security_group_id,omitempty"` + //子网ID 对应腾讯 SubnetId(腾讯必需) + SubnetId string `protobuf:"bytes,11,opt,name=subnet_id,json=subnetId,proto3" json:"subnet_id,omitempty"` + //VPC ID 对应腾讯 VpcId(腾讯必需) + VpcId string `protobuf:"bytes,12,opt,name=vpc_id,json=vpcId,proto3" json:"vpc_id,omitempty"` + //名空间 + Namespace string `protobuf:"bytes,13,opt,name=namespace,proto3" json:"namespace,omitempty"` +} + +func (x *PodInstance) Reset() { + *x = PodInstance{} + if protoimpl.UnsafeEnabled { + mi := &file_idl_pbpod_pod_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PodInstance) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PodInstance) ProtoMessage() {} + +func (x *PodInstance) ProtoReflect() protoreflect.Message { + mi := &file_idl_pbpod_pod_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 PodInstance.ProtoReflect.Descriptor instead. +func (*PodInstance) Descriptor() ([]byte, []int) { + return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{0} +} + +func (x *PodInstance) GetProvider() pbtenant.CloudProvider { + if x != nil { + return x.Provider + } + return pbtenant.CloudProvider(0) +} + +func (x *PodInstance) GetAccountName() string { + if x != nil { + return x.AccountName + } + return "" +} + +func (x *PodInstance) GetPodId() string { + if x != nil { + return x.PodId + } + return "" +} + +func (x *PodInstance) GetPodName() string { + if x != nil { + return x.PodName + } + return "" +} + +func (x *PodInstance) GetRegionName() string { + if x != nil { + return x.RegionName + } + return "" +} + +func (x *PodInstance) GetContainerImage() string { + if x != nil { + return x.ContainerImage + } + return "" +} + +func (x *PodInstance) GetContainerName() string { + if x != nil { + return x.ContainerName + } + return "" +} + +func (x *PodInstance) GetCpuPod() float32 { + if x != nil { + return x.CpuPod + } + return 0 +} + +func (x *PodInstance) GetMemoryPod() float32 { + if x != nil { + return x.MemoryPod + } + return 0 +} + +func (x *PodInstance) GetSecurityGroupId() string { + if x != nil { + return x.SecurityGroupId + } + return "" +} + +func (x *PodInstance) GetSubnetId() string { + if x != nil { + return x.SubnetId + } + return "" +} + +func (x *PodInstance) GetVpcId() string { + if x != nil { + return x.VpcId + } + return "" +} + +func (x *PodInstance) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +type ListPodDetailReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 云名称 + Provider pbtenant.CloudProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=pbtenant.CloudProvider" json:"provider,omitempty"` + // 账户名称,根据config.yaml中的配置,默认为第一个配置的账户 + AccountName string `protobuf:"bytes,2,opt,name=account_name,json=accountName,proto3" json:"account_name,omitempty"` + // 区域Id,参考 tenant.proto 中的各个云的区域 + RegionId int32 `protobuf:"varint,3,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` + // podID + PodId int32 `protobuf:"varint,4,opt,name=pod_id,json=podId,proto3" json:"pod_id,omitempty"` + // 分页相关参数,页码 + PageNumber int32 `protobuf:"varint,5,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"` + // 分页相关参数,每页数量 + PageSize int32 `protobuf:"varint,6,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // 分页相关参数,下一页的token + NextToken string `protobuf:"bytes,7,opt,name=next_token,json=nextToken,proto3" json:"next_token,omitempty"` +} + +func (x *ListPodDetailReq) Reset() { + *x = ListPodDetailReq{} + if protoimpl.UnsafeEnabled { + mi := &file_idl_pbpod_pod_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListPodDetailReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPodDetailReq) ProtoMessage() {} + +func (x *ListPodDetailReq) ProtoReflect() protoreflect.Message { + mi := &file_idl_pbpod_pod_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 ListPodDetailReq.ProtoReflect.Descriptor instead. +func (*ListPodDetailReq) Descriptor() ([]byte, []int) { + return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{1} +} + +func (x *ListPodDetailReq) GetProvider() pbtenant.CloudProvider { + if x != nil { + return x.Provider + } + return pbtenant.CloudProvider(0) +} + +func (x *ListPodDetailReq) GetAccountName() string { + if x != nil { + return x.AccountName + } + return "" +} + +func (x *ListPodDetailReq) GetRegionId() int32 { + if x != nil { + return x.RegionId + } + return 0 +} + +func (x *ListPodDetailReq) GetPodId() int32 { + if x != nil { + return x.PodId + } + return 0 +} + +func (x *ListPodDetailReq) GetPageNumber() int32 { + if x != nil { + return x.PageNumber + } + return 0 +} + +func (x *ListPodDetailReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListPodDetailReq) GetNextToken() string { + if x != nil { + return x.NextToken + } + return "" +} + +type ListPodDetailResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Pod集合 + Pods []*PodInstance `protobuf:"bytes,1,rep,name=pods,proto3" json:"pods,omitempty"` + // 查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询 + Finished bool `protobuf:"varint,2,opt,name=finished,proto3" json:"finished,omitempty"` + // 分页相关参数,页码 + PageNumber int32 `protobuf:"varint,3,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"` + // 分页相关参数,每页数量 + PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // 分页相关参数,下一页的token + NextToken string `protobuf:"bytes,5,opt,name=next_token,json=nextToken,proto3" json:"next_token,omitempty"` + // 请求id,出现问题后提供给云厂商,排查问题 + RequestId string `protobuf:"bytes,6,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` +} + +func (x *ListPodDetailResp) Reset() { + *x = ListPodDetailResp{} + if protoimpl.UnsafeEnabled { + mi := &file_idl_pbpod_pod_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListPodDetailResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPodDetailResp) ProtoMessage() {} + +func (x *ListPodDetailResp) ProtoReflect() protoreflect.Message { + mi := &file_idl_pbpod_pod_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 ListPodDetailResp.ProtoReflect.Descriptor instead. +func (*ListPodDetailResp) Descriptor() ([]byte, []int) { + return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{2} +} + +func (x *ListPodDetailResp) GetPods() []*PodInstance { + if x != nil { + return x.Pods + } + return nil +} + +func (x *ListPodDetailResp) GetFinished() bool { + if x != nil { + return x.Finished + } + return false +} + +func (x *ListPodDetailResp) GetPageNumber() int32 { + if x != nil { + return x.PageNumber + } + return 0 +} + +func (x *ListPodDetailResp) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListPodDetailResp) GetNextToken() string { + if x != nil { + return x.NextToken + } + return "" +} + +func (x *ListPodDetailResp) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +type ListPodReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 云名称 + Provider pbtenant.CloudProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=pbtenant.CloudProvider" json:"provider,omitempty"` +} + +func (x *ListPodReq) Reset() { + *x = ListPodReq{} + if protoimpl.UnsafeEnabled { + mi := &file_idl_pbpod_pod_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListPodReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPodReq) ProtoMessage() {} + +func (x *ListPodReq) ProtoReflect() protoreflect.Message { + mi := &file_idl_pbpod_pod_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 ListPodReq.ProtoReflect.Descriptor instead. +func (*ListPodReq) Descriptor() ([]byte, []int) { + return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{3} +} + +func (x *ListPodReq) GetProvider() pbtenant.CloudProvider { + if x != nil { + return x.Provider + } + return pbtenant.CloudProvider(0) +} + +type ListPodResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // pod集合 + Pods []*PodInstance `protobuf:"bytes,1,rep,name=pods,proto3" json:"pods,omitempty"` +} + +func (x *ListPodResp) Reset() { + *x = ListPodResp{} + if protoimpl.UnsafeEnabled { + mi := &file_idl_pbpod_pod_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListPodResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPodResp) ProtoMessage() {} + +func (x *ListPodResp) ProtoReflect() protoreflect.Message { + mi := &file_idl_pbpod_pod_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 ListPodResp.ProtoReflect.Descriptor instead. +func (*ListPodResp) Descriptor() ([]byte, []int) { + return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{4} +} + +func (x *ListPodResp) GetPods() []*PodInstance { + if x != nil { + return x.Pods + } + return nil +} + +type ListPodAllReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListPodAllReq) Reset() { + *x = ListPodAllReq{} + if protoimpl.UnsafeEnabled { + mi := &file_idl_pbpod_pod_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListPodAllReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPodAllReq) ProtoMessage() {} + +func (x *ListPodAllReq) ProtoReflect() protoreflect.Message { + mi := &file_idl_pbpod_pod_proto_msgTypes[5] + 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 ListPodAllReq.ProtoReflect.Descriptor instead. +func (*ListPodAllReq) Descriptor() ([]byte, []int) { + return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{5} +} + +var File_idl_pbpod_pod_proto protoreflect.FileDescriptor + +var file_idl_pbpod_pod_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x69, 0x64, 0x6c, 0x2f, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2f, 0x70, 0x6f, 0x64, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x1a, 0x19, 0x69, 0x64, + 0x6c, 0x2f, 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2f, 0x74, 0x65, 0x6e, 0x61, 0x6e, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbe, 0x03, 0x0a, 0x0b, 0x50, 0x6f, 0x64, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61, + 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x15, 0x0a, + 0x06, 0x70, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, + 0x6f, 0x64, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x6d, + 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x17, 0x0a, 0x07, 0x63, 0x70, 0x75, 0x5f, 0x70, 0x6f, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x02, 0x52, 0x06, 0x63, 0x70, 0x75, 0x50, 0x6f, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x6d, + 0x6f, 0x72, 0x79, 0x5f, 0x70, 0x6f, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x02, 0x52, 0x09, 0x6d, + 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x50, 0x6f, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x65, 0x63, 0x75, + 0x72, 0x69, 0x74, 0x79, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, + 0x64, 0x12, 0x15, 0x0a, 0x06, 0x76, 0x70, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x70, 0x63, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0xfb, 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x50, + 0x6f, 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x33, 0x0a, 0x08, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, + 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x12, 0x15, 0x0a, 0x06, 0x70, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x70, 0x6f, 0x64, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x65, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x61, + 0x67, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xd3, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, + 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x04, 0x70, 0x6f, + 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, + 0x2e, 0x50, 0x6f, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x04, 0x70, 0x6f, + 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x1f, + 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, + 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, + 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x22, 0x41, 0x0a, 0x0a, 0x4c, 0x69, + 0x73, 0x74, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x12, 0x33, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x74, + 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x22, 0x35, 0x0a, + 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x04, + 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x70, + 0x6f, 0x64, 0x2e, 0x50, 0x6f, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x04, + 0x70, 0x6f, 0x64, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x41, + 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x32, 0x87, 0x02, 0x0a, 0x0a, 0x50, 0x6f, 0x64, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x5f, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x44, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x50, 0x6f, 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x18, + 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, + 0x22, 0x10, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x70, 0x6f, 0x64, 0x2f, 0x64, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x3a, 0x01, 0x2a, 0x12, 0x46, 0x0a, 0x07, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, + 0x12, 0x11, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, + 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, + 0x09, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x70, 0x6f, 0x64, 0x3a, 0x01, 0x2a, 0x12, 0x50, 0x0a, + 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x41, 0x6c, 0x6c, 0x12, 0x14, 0x2e, 0x70, 0x62, + 0x70, 0x6f, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x41, 0x6c, 0x6c, 0x52, 0x65, + 0x71, 0x1a, 0x12, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x22, 0x0d, 0x2f, + 0x61, 0x70, 0x69, 0x73, 0x2f, 0x70, 0x6f, 0x64, 0x2f, 0x61, 0x6c, 0x6c, 0x3a, 0x01, 0x2a, 0x42, + 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x63, + 0x6e, 0x2f, 0x4a, 0x43, 0x43, 0x45, 0x2f, 0x50, 0x43, 0x4d, 0x2f, 0x6c, 0x61, 0x6e, 0x5f, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x2f, 0x69, 0x64, 0x6c, 0x2f, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_idl_pbpod_pod_proto_rawDescOnce sync.Once + file_idl_pbpod_pod_proto_rawDescData = file_idl_pbpod_pod_proto_rawDesc +) + +func file_idl_pbpod_pod_proto_rawDescGZIP() []byte { + file_idl_pbpod_pod_proto_rawDescOnce.Do(func() { + file_idl_pbpod_pod_proto_rawDescData = protoimpl.X.CompressGZIP(file_idl_pbpod_pod_proto_rawDescData) + }) + return file_idl_pbpod_pod_proto_rawDescData +} + +var file_idl_pbpod_pod_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_idl_pbpod_pod_proto_goTypes = []interface{}{ + (*PodInstance)(nil), // 0: pbpod.PodInstance + (*ListPodDetailReq)(nil), // 1: pbpod.ListPodDetailReq + (*ListPodDetailResp)(nil), // 2: pbpod.ListPodDetailResp + (*ListPodReq)(nil), // 3: pbpod.ListPodReq + (*ListPodResp)(nil), // 4: pbpod.ListPodResp + (*ListPodAllReq)(nil), // 5: pbpod.ListPodAllReq + (pbtenant.CloudProvider)(0), // 6: pbtenant.CloudProvider +} +var file_idl_pbpod_pod_proto_depIdxs = []int32{ + 6, // 0: pbpod.PodInstance.provider:type_name -> pbtenant.CloudProvider + 6, // 1: pbpod.ListPodDetailReq.provider:type_name -> pbtenant.CloudProvider + 0, // 2: pbpod.ListPodDetailResp.pods:type_name -> pbpod.PodInstance + 6, // 3: pbpod.ListPodReq.provider:type_name -> pbtenant.CloudProvider + 0, // 4: pbpod.ListPodResp.pods:type_name -> pbpod.PodInstance + 1, // 5: pbpod.PodService.ListPodDetail:input_type -> pbpod.ListPodDetailReq + 3, // 6: pbpod.PodService.ListPod:input_type -> pbpod.ListPodReq + 5, // 7: pbpod.PodService.ListPodAll:input_type -> pbpod.ListPodAllReq + 2, // 8: pbpod.PodService.ListPodDetail:output_type -> pbpod.ListPodDetailResp + 4, // 9: pbpod.PodService.ListPod:output_type -> pbpod.ListPodResp + 4, // 10: pbpod.PodService.ListPodAll:output_type -> pbpod.ListPodResp + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_idl_pbpod_pod_proto_init() } +func file_idl_pbpod_pod_proto_init() { + if File_idl_pbpod_pod_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_idl_pbpod_pod_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PodInstance); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_idl_pbpod_pod_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPodDetailReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_idl_pbpod_pod_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPodDetailResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_idl_pbpod_pod_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPodReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_idl_pbpod_pod_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPodResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_idl_pbpod_pod_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPodAllReq); 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_idl_pbpod_pod_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_idl_pbpod_pod_proto_goTypes, + DependencyIndexes: file_idl_pbpod_pod_proto_depIdxs, + MessageInfos: file_idl_pbpod_pod_proto_msgTypes, + }.Build() + File_idl_pbpod_pod_proto = out.File + file_idl_pbpod_pod_proto_rawDesc = nil + file_idl_pbpod_pod_proto_goTypes = nil + file_idl_pbpod_pod_proto_depIdxs = nil +} diff --git a/lan_trans/idl/pbpod/pod.pb.gw.go b/lan_trans/idl/pbpod/pod.pb.gw.go new file mode 100644 index 00000000..9aa4feff --- /dev/null +++ b/lan_trans/idl/pbpod/pod.pb.gw.go @@ -0,0 +1,335 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: idl/pbpod/pod.proto + +/* +Package pbpod is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package pbpod + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_PodService_ListPodDetail_0(ctx context.Context, marshaler runtime.Marshaler, client PodServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListPodDetailReq + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListPodDetail(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_PodService_ListPodDetail_0(ctx context.Context, marshaler runtime.Marshaler, server PodServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListPodDetailReq + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListPodDetail(ctx, &protoReq) + return msg, metadata, err + +} + +func request_PodService_ListPod_0(ctx context.Context, marshaler runtime.Marshaler, client PodServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListPodReq + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListPod(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_PodService_ListPod_0(ctx context.Context, marshaler runtime.Marshaler, server PodServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListPodReq + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListPod(ctx, &protoReq) + return msg, metadata, err + +} + +func request_PodService_ListPodAll_0(ctx context.Context, marshaler runtime.Marshaler, client PodServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListPodAllReq + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListPodAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_PodService_ListPodAll_0(ctx context.Context, marshaler runtime.Marshaler, server PodServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListPodAllReq + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListPodAll(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterPodServiceHandlerServer registers the http handlers for service PodService to "mux". +// UnaryRPC :call PodServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPodServiceHandlerFromEndpoint instead. +func RegisterPodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PodServiceServer) error { + + mux.Handle("POST", pattern_PodService_ListPodDetail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPodDetail", runtime.WithHTTPPathPattern("/apis/pod/detail")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_PodService_ListPodDetail_0(ctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_PodService_ListPodDetail_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_PodService_ListPod_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPod", runtime.WithHTTPPathPattern("/apis/pod")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_PodService_ListPod_0(ctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_PodService_ListPod_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_PodService_ListPodAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPodAll", runtime.WithHTTPPathPattern("/apis/pod/all")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_PodService_ListPodAll_0(ctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_PodService_ListPodAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterPodServiceHandlerFromEndpoint is same as RegisterPodServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterPodServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterPodServiceHandler(ctx, mux, conn) +} + +// RegisterPodServiceHandler registers the http handlers for service PodService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterPodServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterPodServiceHandlerClient(ctx, mux, NewPodServiceClient(conn)) +} + +// RegisterPodServiceHandlerClient registers the http handlers for service PodService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PodServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PodServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "PodServiceClient" to call the correct interceptors. +func RegisterPodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PodServiceClient) error { + + mux.Handle("POST", pattern_PodService_ListPodDetail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPodDetail", runtime.WithHTTPPathPattern("/apis/pod/detail")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_PodService_ListPodDetail_0(ctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_PodService_ListPodDetail_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_PodService_ListPod_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPod", runtime.WithHTTPPathPattern("/apis/pod")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_PodService_ListPod_0(ctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_PodService_ListPod_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_PodService_ListPodAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPodAll", runtime.WithHTTPPathPattern("/apis/pod/all")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_PodService_ListPodAll_0(ctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_PodService_ListPodAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_PodService_ListPodDetail_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "pod", "detail"}, "")) + + pattern_PodService_ListPod_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"apis", "pod"}, "")) + + pattern_PodService_ListPodAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "pod", "all"}, "")) +) + +var ( + forward_PodService_ListPodDetail_0 = runtime.ForwardResponseMessage + + forward_PodService_ListPod_0 = runtime.ForwardResponseMessage + + forward_PodService_ListPodAll_0 = runtime.ForwardResponseMessage +) diff --git a/lan_trans/idl/pbpod/pod_grpc.pb.go b/lan_trans/idl/pbpod/pod_grpc.pb.go new file mode 100644 index 00000000..c2799971 --- /dev/null +++ b/lan_trans/idl/pbpod/pod_grpc.pb.go @@ -0,0 +1,183 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc (unknown) +// source: idl/pbpod/pod.proto + +package pbpod + +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 + +// PodServiceClient is the client API for PodService 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 PodServiceClient interface { + // 查询ECS明细 - 支持云类型、区域、账户、分页等过滤条件 + ListPodDetail(ctx context.Context, in *ListPodDetailReq, opts ...grpc.CallOption) (*ListPodDetailResp, error) + // 查询Pod全量 - 根据云类型 + ListPod(ctx context.Context, in *ListPodReq, opts ...grpc.CallOption) (*ListPodResp, error) + // 查询所有云的Pod + ListPodAll(ctx context.Context, in *ListPodAllReq, opts ...grpc.CallOption) (*ListPodResp, error) +} + +type podServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPodServiceClient(cc grpc.ClientConnInterface) PodServiceClient { + return &podServiceClient{cc} +} + +func (c *podServiceClient) ListPodDetail(ctx context.Context, in *ListPodDetailReq, opts ...grpc.CallOption) (*ListPodDetailResp, error) { + out := new(ListPodDetailResp) + err := c.cc.Invoke(ctx, "/pbpod.PodService/ListPodDetail", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *podServiceClient) ListPod(ctx context.Context, in *ListPodReq, opts ...grpc.CallOption) (*ListPodResp, error) { + out := new(ListPodResp) + err := c.cc.Invoke(ctx, "/pbpod.PodService/ListPod", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *podServiceClient) ListPodAll(ctx context.Context, in *ListPodAllReq, opts ...grpc.CallOption) (*ListPodResp, error) { + out := new(ListPodResp) + err := c.cc.Invoke(ctx, "/pbpod.PodService/ListPodAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PodServiceServer is the server API for PodService service. +// All implementations must embed UnimplementedPodServiceServer +// for forward compatibility +type PodServiceServer interface { + // 查询ECS明细 - 支持云类型、区域、账户、分页等过滤条件 + ListPodDetail(context.Context, *ListPodDetailReq) (*ListPodDetailResp, error) + // 查询Pod全量 - 根据云类型 + ListPod(context.Context, *ListPodReq) (*ListPodResp, error) + // 查询所有云的Pod + ListPodAll(context.Context, *ListPodAllReq) (*ListPodResp, error) + mustEmbedUnimplementedPodServiceServer() +} + +// UnimplementedPodServiceServer must be embedded to have forward compatible implementations. +type UnimplementedPodServiceServer struct { +} + +func (UnimplementedPodServiceServer) ListPodDetail(context.Context, *ListPodDetailReq) (*ListPodDetailResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListPodDetail not implemented") +} +func (UnimplementedPodServiceServer) ListPod(context.Context, *ListPodReq) (*ListPodResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListPod not implemented") +} +func (UnimplementedPodServiceServer) ListPodAll(context.Context, *ListPodAllReq) (*ListPodResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListPodAll not implemented") +} +func (UnimplementedPodServiceServer) mustEmbedUnimplementedPodServiceServer() {} + +// UnsafePodServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PodServiceServer will +// result in compilation errors. +type UnsafePodServiceServer interface { + mustEmbedUnimplementedPodServiceServer() +} + +func RegisterPodServiceServer(s grpc.ServiceRegistrar, srv PodServiceServer) { + s.RegisterService(&PodService_ServiceDesc, srv) +} + +func _PodService_ListPodDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListPodDetailReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PodServiceServer).ListPodDetail(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pbpod.PodService/ListPodDetail", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PodServiceServer).ListPodDetail(ctx, req.(*ListPodDetailReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PodService_ListPod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListPodReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PodServiceServer).ListPod(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pbpod.PodService/ListPod", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PodServiceServer).ListPod(ctx, req.(*ListPodReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PodService_ListPodAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListPodAllReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PodServiceServer).ListPodAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pbpod.PodService/ListPodAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PodServiceServer).ListPodAll(ctx, req.(*ListPodAllReq)) + } + return interceptor(ctx, in, info, handler) +} + +// PodService_ServiceDesc is the grpc.ServiceDesc for PodService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PodService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "pbpod.PodService", + HandlerType: (*PodServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListPodDetail", + Handler: _PodService_ListPodDetail_Handler, + }, + { + MethodName: "ListPod", + Handler: _PodService_ListPod_Handler, + }, + { + MethodName: "ListPodAll", + Handler: _PodService_ListPodAll_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "idl/pbpod/pod.proto", +} diff --git a/lan_trans/openapiv2/idl/demo/demo.swagger.json b/lan_trans/openapiv2/idl/demo/demo.swagger.json new file mode 100644 index 00000000..d7db3be6 --- /dev/null +++ b/lan_trans/openapiv2/idl/demo/demo.swagger.json @@ -0,0 +1,96 @@ +{ + "swagger": "2.0", + "info": { + "title": "idl/demo/demo.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "DemoService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/apis/demo": { + "post": { + "summary": "Echo 样例接口", + "operationId": "DemoService_Echo", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/demoStringMessage" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/demoStringMessage" + } + } + ], + "tags": [ + "DemoService" + ], + "deprecated": true, + "security": [], + "externalDocs": { + "description": "Find out more about the interface", + "url": "https://github.com/grpc-ecosystem/grpc-gateway" + } + } + } + }, + "definitions": { + "demoStringMessage": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + } + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +} diff --git a/lan_trans/openapiv2/idl/pbecs/ecs.swagger.json b/lan_trans/openapiv2/idl/pbecs/ecs.swagger.json new file mode 100644 index 00000000..84a423e2 --- /dev/null +++ b/lan_trans/openapiv2/idl/pbecs/ecs.swagger.json @@ -0,0 +1,331 @@ +{ + "swagger": "2.0", + "info": { + "title": "idl/pbecs/ecs.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "EcsService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/apis/ecs": { + "post": { + "summary": "查询ECS全量 - 根据云类型", + "operationId": "EcsService_ListEcs", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/pbecsListResp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/pbecsListReq" + } + } + ], + "tags": [ + "EcsService" + ] + } + }, + "/apis/ecs/all": { + "post": { + "summary": "查询所有云的ECS", + "operationId": "EcsService_ListEcsAll", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/pbecsListResp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/pbecsListAllReq" + } + } + ], + "tags": [ + "EcsService" + ] + } + }, + "/apis/ecs/detail": { + "post": { + "summary": "查询ECS明细 - 支持云类型、区域、账户、分页等过滤条件", + "operationId": "EcsService_ListEcsDetail", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/pbecsListDetailResp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/pbecsListDetailReq" + } + } + ], + "tags": [ + "EcsService" + ] + } + } + }, + "definitions": { + "pbecsEcsInstance": { + "type": "object", + "properties": { + "provider": { + "$ref": "#/definitions/pbtenantCloudProvider", + "title": "云类型" + }, + "accountName": { + "type": "string", + "title": "账号名称" + }, + "instanceId": { + "type": "string", + "title": "实例id" + }, + "instanceName": { + "type": "string", + "title": "实例名称" + }, + "regionName": { + "type": "string", + "title": "地域,数据中心" + }, + "publicIps": { + "type": "array", + "items": { + "type": "string" + }, + "title": "公网ip" + }, + "instanceType": { + "type": "string", + "title": "实例类型" + }, + "cpu": { + "type": "integer", + "format": "int32", + "title": "vcpu数" + }, + "memory": { + "type": "integer", + "format": "int32", + "title": "内存MB" + }, + "description": { + "type": "string", + "title": "实例描述" + }, + "status": { + "type": "string", + "title": "状态" + }, + "creationTime": { + "type": "string", + "title": "创建时间,ISO8601" + }, + "expireTime": { + "type": "string", + "title": "过期时间" + }, + "innerIps": { + "type": "array", + "items": { + "type": "string" + }, + "title": "内网ip" + }, + "vpcId": { + "type": "string", + "title": "vcp id" + }, + "resourceGroupId": { + "type": "string", + "title": "资源组id" + }, + "chargeType": { + "type": "string", + "title": "收费类型" + } + } + }, + "pbecsListAllReq": { + "type": "object" + }, + "pbecsListDetailReq": { + "type": "object", + "properties": { + "provider": { + "$ref": "#/definitions/pbtenantCloudProvider", + "title": "云名称" + }, + "accountName": { + "type": "string", + "title": "账户名称,根据config.yaml中的配置,默认为第一个配置的账户" + }, + "regionId": { + "type": "integer", + "format": "int32", + "title": "区域Id,参考 tenant.proto 中的各个云的区域" + }, + "pageNumber": { + "type": "integer", + "format": "int32", + "title": "分页相关参数,页码" + }, + "pageSize": { + "type": "integer", + "format": "int32", + "title": "分页相关参数,每页数量" + }, + "nextToken": { + "type": "string", + "title": "分页相关参数,下一页的token" + } + } + }, + "pbecsListDetailResp": { + "type": "object", + "properties": { + "ecses": { + "type": "array", + "items": { + "$ref": "#/definitions/pbecsEcsInstance" + }, + "title": "Ecs 机器集合" + }, + "finished": { + "type": "boolean", + "title": "查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询" + }, + "pageNumber": { + "type": "integer", + "format": "int32", + "title": "分页相关参数,页码" + }, + "pageSize": { + "type": "integer", + "format": "int32", + "title": "分页相关参数,每页数量" + }, + "nextToken": { + "type": "string", + "title": "分页相关参数,下一页的token" + }, + "requestId": { + "type": "string", + "title": "请求id,出现问题后提供给云厂商,排查问题" + } + } + }, + "pbecsListReq": { + "type": "object", + "properties": { + "provider": { + "$ref": "#/definitions/pbtenantCloudProvider", + "title": "云名称" + } + } + }, + "pbecsListResp": { + "type": "object", + "properties": { + "ecses": { + "type": "array", + "items": { + "$ref": "#/definitions/pbecsEcsInstance" + }, + "title": "Ecs 机器集合" + } + } + }, + "pbtenantCloudProvider": { + "type": "string", + "enum": [ + "ali", + "tencent", + "huawei", + "aws" + ], + "default": "ali", + "description": "- ali: 0 - 阿里云\n - tencent: 1 - 腾讯云\n - huawei: 2 - 华为云\n - aws: 3 - 亚马逊云", + "title": "云提供商" + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +} diff --git a/lan_trans/openapiv2/idl/pbpod/pod.swagger.json b/lan_trans/openapiv2/idl/pbpod/pod.swagger.json new file mode 100644 index 00000000..32148b8f --- /dev/null +++ b/lan_trans/openapiv2/idl/pbpod/pod.swagger.json @@ -0,0 +1,314 @@ +{ + "swagger": "2.0", + "info": { + "title": "idl/pbpod/pod.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "PodService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/apis/pod": { + "post": { + "summary": "查询Pod全量 - 根据云类型", + "operationId": "PodService_ListPod", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/pbpodListPodResp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/pbpodListPodReq" + } + } + ], + "tags": [ + "PodService" + ] + } + }, + "/apis/pod/all": { + "post": { + "summary": "查询所有云的Pod", + "operationId": "PodService_ListPodAll", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/pbpodListPodResp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/pbpodListPodAllReq" + } + } + ], + "tags": [ + "PodService" + ] + } + }, + "/apis/pod/detail": { + "post": { + "summary": "查询ECS明细 - 支持云类型、区域、账户、分页等过滤条件", + "operationId": "PodService_ListPodDetail", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/pbpodListPodDetailResp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/pbpodListPodDetailReq" + } + } + ], + "tags": [ + "PodService" + ] + } + } + }, + "definitions": { + "pbpodListPodAllReq": { + "type": "object" + }, + "pbpodListPodDetailReq": { + "type": "object", + "properties": { + "provider": { + "$ref": "#/definitions/pbtenantCloudProvider", + "title": "云名称" + }, + "accountName": { + "type": "string", + "title": "账户名称,根据config.yaml中的配置,默认为第一个配置的账户" + }, + "regionId": { + "type": "integer", + "format": "int32", + "title": "区域Id,参考 tenant.proto 中的各个云的区域" + }, + "podId": { + "type": "integer", + "format": "int32", + "title": "podID" + }, + "pageNumber": { + "type": "integer", + "format": "int32", + "title": "分页相关参数,页码" + }, + "pageSize": { + "type": "integer", + "format": "int32", + "title": "分页相关参数,每页数量" + }, + "nextToken": { + "type": "string", + "title": "分页相关参数,下一页的token" + } + } + }, + "pbpodListPodDetailResp": { + "type": "object", + "properties": { + "pods": { + "type": "array", + "items": { + "$ref": "#/definitions/pbpodPodInstance" + }, + "title": "Pod集合" + }, + "finished": { + "type": "boolean", + "title": "查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询" + }, + "pageNumber": { + "type": "integer", + "format": "int32", + "title": "分页相关参数,页码" + }, + "pageSize": { + "type": "integer", + "format": "int32", + "title": "分页相关参数,每页数量" + }, + "nextToken": { + "type": "string", + "title": "分页相关参数,下一页的token" + }, + "requestId": { + "type": "string", + "title": "请求id,出现问题后提供给云厂商,排查问题" + } + } + }, + "pbpodListPodReq": { + "type": "object", + "properties": { + "provider": { + "$ref": "#/definitions/pbtenantCloudProvider", + "title": "云名称" + } + } + }, + "pbpodListPodResp": { + "type": "object", + "properties": { + "pods": { + "type": "array", + "items": { + "$ref": "#/definitions/pbpodPodInstance" + }, + "title": "pod集合" + } + } + }, + "pbpodPodInstance": { + "type": "object", + "properties": { + "provider": { + "$ref": "#/definitions/pbtenantCloudProvider", + "title": "云类型" + }, + "accountName": { + "type": "string", + "title": "账号名称" + }, + "podId": { + "type": "string", + "title": "实例id" + }, + "podName": { + "type": "string", + "title": "实例名称" + }, + "regionName": { + "type": "string", + "title": "地域,数据中心" + }, + "containerImage": { + "type": "string", + "title": "镜像" + }, + "containerName": { + "type": "string", + "title": "容器名称" + }, + "cpuPod": { + "type": "number", + "format": "float", + "title": "vcpu数" + }, + "memoryPod": { + "type": "number", + "format": "float", + "title": "内存MB" + }, + "securityGroupId": { + "type": "string", + "title": "安全组ID 对应腾讯 SecurityGroupIds(腾讯必需)" + }, + "subnetId": { + "type": "string", + "title": "子网ID 对应腾讯 SubnetId(腾讯必需)" + }, + "vpcId": { + "type": "string", + "title": "VPC ID 对应腾讯 VpcId(腾讯必需)" + }, + "namespace": { + "type": "string", + "title": "名空间" + } + } + }, + "pbtenantCloudProvider": { + "type": "string", + "enum": [ + "ali", + "tencent", + "huawei", + "aws" + ], + "default": "ali", + "description": "- ali: 0 - 阿里云\n - tencent: 1 - 腾讯云\n - huawei: 2 - 华为云\n - aws: 3 - 亚马逊云", + "title": "云提供商" + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +} diff --git a/lan_trans/openapiv2/idl/pbtenant/tenant.swagger.json b/lan_trans/openapiv2/idl/pbtenant/tenant.swagger.json new file mode 100644 index 00000000..0a73b355 --- /dev/null +++ b/lan_trans/openapiv2/idl/pbtenant/tenant.swagger.json @@ -0,0 +1,43 @@ +{ + "swagger": "2.0", + "info": { + "title": "idl/pbtenant/tenant.proto", + "version": "version not set" + }, + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": {}, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +}