forked from JointCloud/pcm-coordinator
parent
1c603f035d
commit
87e1dc9f8e
|
@ -0,0 +1,64 @@
|
|||
# This files contains all configuration options for analysis running.
|
||||
# More details please refer to: https://golangci-lint.run/usage/configuration/
|
||||
|
||||
run:
|
||||
# timeout for analysis, e.g. 30s, 5m, default is 1m
|
||||
timeout: 5m
|
||||
|
||||
# which dirs to skip: issues from them won't be reported;
|
||||
# can use regexp here: generated.*, regexp is applied on full path;
|
||||
# default value is empty list, but default dirs are skipped independently
|
||||
# from this option's value (see skip-dirs-use-default).
|
||||
# "/" will be replaced by current OS file path separator to properly work
|
||||
# on Windows.
|
||||
skip-dirs:
|
||||
- hack/tools/preferredimports # This code is directly lifted from the Kubernetes codebase, skip checking
|
||||
|
||||
# default is true. Enables skipping of directories:
|
||||
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
|
||||
skip-dirs-use-default: true
|
||||
|
||||
# One of 'readonly' and 'vendor'.
|
||||
# - readonly: the go command is disallowed from the implicit automatic updating of go.mod described above.
|
||||
# Instead, it fails when any changes to go.mod are needed. This setting is most useful to check
|
||||
# that go.mod does not need updates, such as in a continuous integration and testing system.
|
||||
# - vendor: the go command assumes that the vendor directory holds the correct copies of dependencies and ignores
|
||||
# the dependency descriptions in go.mod.
|
||||
modules-download-mode: readonly
|
||||
linters:
|
||||
enable:
|
||||
# linters maintained by golang.org
|
||||
- gofmt
|
||||
- goimports
|
||||
- govet
|
||||
# linters default enabled by golangci-lint .
|
||||
- deadcode
|
||||
- errcheck
|
||||
- gosimple
|
||||
- ineffassign
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- typecheck
|
||||
- unused
|
||||
- varcheck
|
||||
# other linters supported by golangci-lint.
|
||||
- gocyclo
|
||||
- gosec
|
||||
- whitespace
|
||||
- revive
|
||||
|
||||
linters-settings:
|
||||
goimports:
|
||||
local-prefixes: github.com/karmada-io/karmada
|
||||
gocyclo:
|
||||
# minimal cyclomatic complexity to report
|
||||
min-complexity: 15
|
||||
|
||||
issues:
|
||||
# The list of ids of default excludes to include or disable. By default it's empty.
|
||||
include:
|
||||
# disable excluding of issues about comments from revive
|
||||
# see https://golangci-lint.run/usage/configuration/#command-line-options for more info
|
||||
- EXC0012
|
||||
- EXC0013
|
||||
- EXC0014
|
|
@ -0,0 +1,125 @@
|
|||
package ecs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JCCE/PCM/adaptor/vm_adaptor/service/ecser"
|
||||
"gitlink.org.cn/JCCE/PCM/common/tenanter"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
"sync"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (*pbecs.ListDetailResp, error) {
|
||||
var (
|
||||
ecs ecser.Ecser
|
||||
)
|
||||
|
||||
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 ecs, err = ecser.NewEcsClient(req.Provider, region, tenanter); err != nil {
|
||||
return nil, errors.WithMessage(err, "NewEcsClient error")
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return ecs.ListDetail(ctx, req)
|
||||
}
|
||||
|
||||
func List(ctx context.Context, req *pbecs.ListReq) (*pbecs.ListResp, error) {
|
||||
var (
|
||||
wg sync.WaitGroup
|
||||
mutex sync.Mutex
|
||||
ecses []*pbecs.EcsInstance
|
||||
)
|
||||
|
||||
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()
|
||||
ecs, err := ecser.NewEcsClient(req.Provider, region, tenant)
|
||||
if err != nil {
|
||||
glog.Errorf("New Ecs Client error %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
request := &pbecs.ListDetailReq{
|
||||
Provider: req.Provider,
|
||||
AccountName: tenant.AccountName(),
|
||||
RegionId: region.GetId(),
|
||||
PageNumber: 1,
|
||||
PageSize: 100,
|
||||
NextToken: "",
|
||||
}
|
||||
for {
|
||||
resp, err := ecs.ListDetail(ctx, request)
|
||||
if err != nil {
|
||||
glog.Errorf("ListDetail error %v", err)
|
||||
return
|
||||
}
|
||||
mutex.Lock()
|
||||
ecses = append(ecses, resp.Ecses...)
|
||||
mutex.Unlock()
|
||||
if resp.Finished {
|
||||
break
|
||||
}
|
||||
request.PageNumber, request.PageSize, request.NextToken = resp.PageNumber, resp.PageSize, resp.NextToken
|
||||
}
|
||||
}(t, region)
|
||||
|
||||
}
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
return &pbecs.ListResp{Ecses: ecses}, nil
|
||||
}
|
||||
|
||||
func ListAll(ctx context.Context) (*pbecs.ListResp, error) {
|
||||
var (
|
||||
wg sync.WaitGroup
|
||||
mutex sync.Mutex
|
||||
ecses []*pbecs.EcsInstance
|
||||
)
|
||||
|
||||
wg.Add(len(pbtenant.CloudProvider_name))
|
||||
for k := range pbtenant.CloudProvider_name {
|
||||
go func(provider int32) {
|
||||
defer wg.Done()
|
||||
|
||||
resp, err := List(ctx, &pbecs.ListReq{Provider: pbtenant.CloudProvider(provider)})
|
||||
if err != nil {
|
||||
glog.Errorf("List error %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
mutex.Lock()
|
||||
ecses = append(ecses, resp.Ecses...)
|
||||
mutex.Unlock()
|
||||
}(k)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
return &pbecs.ListResp{Ecses: ecses}, nil
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package ecs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestListDetail(t *testing.T) {
|
||||
type args struct {
|
||||
req *pbecs.ListDetailReq
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
wantErr bool
|
||||
}{
|
||||
{name: "ali", args: args{req: &pbecs.ListDetailReq{Provider: pbtenant.CloudProvider_ali, RegionId: int32(pbtenant.AliRegionId_ali_cn_hangzhou), PageNumber: 1, PageSize: 10}}, wantErr: false},
|
||||
{name: "tencent", args: args{req: &pbecs.ListDetailReq{Provider: pbtenant.CloudProvider_tencent, RegionId: int32(pbtenant.TencentRegionId_tc_ap_beijing), PageNumber: 1, PageSize: 10}}, wantErr: false},
|
||||
{name: "aws", args: args{req: &pbecs.ListDetailReq{Provider: pbtenant.CloudProvider_aws, RegionId: int32(pbtenant.AwsRegionId_aws_us_east_2), PageNumber: 1, PageSize: 10}}, wantErr: false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := ListDetail(context.Background(), tt.args.req)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("ListDetail() error = %+v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
t.Log(got)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestList(t *testing.T) {
|
||||
type args struct {
|
||||
req *pbecs.ListReq
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
wantErr bool
|
||||
}{
|
||||
{name: "ali", args: args{req: &pbecs.ListReq{Provider: pbtenant.CloudProvider_ali}}, wantErr: false},
|
||||
{name: "tencent", args: args{req: &pbecs.ListReq{Provider: pbtenant.CloudProvider_tencent}}, wantErr: false},
|
||||
{name: "huawei", args: args{req: &pbecs.ListReq{Provider: pbtenant.CloudProvider_huawei}}, wantErr: false},
|
||||
{name: "aws", args: args{req: &pbecs.ListReq{Provider: pbtenant.CloudProvider_aws}}, wantErr: false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := List(context.Background(), tt.args.req)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("List() error = %+v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
t.Log(got)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestListAll(t *testing.T) {
|
||||
type args struct {
|
||||
req *pbecs.ListAllReq
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
wantErr bool
|
||||
}{
|
||||
{name: "all", args: args{req: &pbecs.ListAllReq{}}, wantErr: false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := ListAll(context.Background())
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("ListAll() error = %+v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
t.Log(got)
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package ecs
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JCCE/PCM/common/tenanter"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var (
|
||||
aliTenant, tcTenant, hwTenant, awsTenant []tenanter.Tenanter
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
err := tenanter.LoadCloudConfigs("../../../config.yaml")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if aliTenant, err = tenanter.GetTenanters(pbtenant.CloudProvider_ali); err != nil {
|
||||
panic("get aliTenant failed")
|
||||
}
|
||||
if tcTenant, err = tenanter.GetTenanters(pbtenant.CloudProvider_tencent); err != nil {
|
||||
panic("get tcTenant failed")
|
||||
}
|
||||
if hwTenant, err = tenanter.GetTenanters(pbtenant.CloudProvider_huawei); err != nil {
|
||||
panic("get hwTenant failed")
|
||||
}
|
||||
if awsTenant, err = tenanter.GetTenanters(pbtenant.CloudProvider_aws); err != nil {
|
||||
panic("get awsTenant failed")
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package ecser
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JCCE/PCM/common/tenanter"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
"sync"
|
||||
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||
aliecs "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var aliClientMutex sync.Mutex
|
||||
|
||||
type AliEcs struct {
|
||||
cli *aliecs.Client
|
||||
region tenanter.Region
|
||||
tenanter tenanter.Tenanter
|
||||
}
|
||||
|
||||
func newAliEcsClient(region tenanter.Region, tenant tenanter.Tenanter) (Ecser, error) {
|
||||
var (
|
||||
client *aliecs.Client
|
||||
err error
|
||||
)
|
||||
|
||||
switch t := tenant.(type) {
|
||||
case *tenanter.AccessKeyTenant:
|
||||
// 阿里云的sdk有一个 map 的并发问题,go test 加上-race 能检测出来,所以这里加一个锁
|
||||
aliClientMutex.Lock()
|
||||
client, err = aliecs.NewClientWithAccessKey(region.GetName(), t.GetId(), t.GetSecret())
|
||||
aliClientMutex.Unlock()
|
||||
default:
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init ali ecs client error")
|
||||
}
|
||||
|
||||
return &AliEcs{
|
||||
cli: client,
|
||||
region: region,
|
||||
tenanter: tenant,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (ecs *AliEcs) ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (*pbecs.ListDetailResp, error) {
|
||||
request := aliecs.CreateDescribeInstancesRequest()
|
||||
request.PageNumber = requests.NewInteger(int(req.PageNumber))
|
||||
request.PageSize = requests.NewInteger(int(req.PageSize))
|
||||
request.NextToken = req.NextToken
|
||||
resp, err := ecs.cli.DescribeInstances(request)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Aliyun ListDetail error")
|
||||
}
|
||||
|
||||
var ecses = make([]*pbecs.EcsInstance, len(resp.Instances.Instance))
|
||||
for k, v := range resp.Instances.Instance {
|
||||
ecses[k] = &pbecs.EcsInstance{
|
||||
Provider: pbtenant.CloudProvider_ali,
|
||||
AccountName: ecs.tenanter.AccountName(),
|
||||
InstanceId: v.InstanceId,
|
||||
InstanceName: v.InstanceName,
|
||||
RegionName: ecs.region.GetName(),
|
||||
PublicIps: v.PublicIpAddress.IpAddress,
|
||||
InstanceType: v.InstanceType,
|
||||
Cpu: int32(v.Cpu),
|
||||
Memory: int32(v.Memory),
|
||||
Description: v.Description,
|
||||
Status: v.Status,
|
||||
CreationTime: v.CreationTime,
|
||||
ExpireTime: v.ExpiredTime,
|
||||
InnerIps: v.InnerIpAddress.IpAddress,
|
||||
VpcId: v.VpcAttributes.VpcId,
|
||||
ResourceGroupId: v.ResourceGroupId,
|
||||
ChargeType: v.InstanceChargeType,
|
||||
}
|
||||
}
|
||||
|
||||
isFinished := false
|
||||
if len(ecses) < int(req.PageSize) {
|
||||
isFinished = true
|
||||
}
|
||||
|
||||
return &pbecs.ListDetailResp{
|
||||
Ecses: ecses,
|
||||
Finished: isFinished,
|
||||
PageNumber: req.PageNumber + 1,
|
||||
PageSize: req.PageSize,
|
||||
NextToken: resp.NextToken,
|
||||
RequestId: resp.RequestId,
|
||||
}, nil
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package ecser
|
||||
|
||||
//TODO aws
|
||||
//
|
||||
//import (
|
||||
// "context"
|
||||
//
|
||||
// "github.com/aws/aws-sdk-go-v2/config"
|
||||
// "github.com/aws/aws-sdk-go-v2/credentials"
|
||||
// awsec2 "github.com/aws/aws-sdk-go-v2/service/ec2"
|
||||
// "github.com/pkg/errors"
|
||||
//
|
||||
// "gitlink.org.cn/JCCE/PCM/common/tenanter"
|
||||
//
|
||||
// "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
|
||||
// "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
//)
|
||||
//
|
||||
//type AwsEcs struct {
|
||||
// cli *awsec2.Client
|
||||
// region tenanter.Region
|
||||
// tenanter tenanter.Tenanter
|
||||
//}
|
||||
//
|
||||
//func newAwsEcsClient(region tenanter.Region, tenant tenanter.Tenanter) (Ecser, error) {
|
||||
// var (
|
||||
// client *awsec2.Client
|
||||
// err error
|
||||
// )
|
||||
//
|
||||
// switch t := tenant.(type) {
|
||||
// case *tenanter.AccessKeyTenant:
|
||||
// cfg, err := config.LoadDefaultConfig(context.TODO(),
|
||||
// config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(t.GetId(), t.GetSecret(), "")),
|
||||
// config.WithRegion(region.GetName()),
|
||||
// )
|
||||
// if err != nil {
|
||||
// return nil, errors.Wrap(err, "LoadDefaultConfig aws ecs client error")
|
||||
// }
|
||||
// client = awsec2.NewFromConfig(cfg)
|
||||
// default:
|
||||
// }
|
||||
//
|
||||
// if err != nil {
|
||||
// return nil, errors.Wrap(err, "init aws ec2 client error")
|
||||
// }
|
||||
// return &AwsEcs{
|
||||
// cli: client,
|
||||
// region: region,
|
||||
// tenanter: tenant,
|
||||
// }, nil
|
||||
//}
|
||||
//
|
||||
//func (ecs *AwsEcs) ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (*pbecs.ListDetailResp, error) {
|
||||
// request := new(awsec2.DescribeInstancesInput)
|
||||
// request.MaxResults = req.PageSize
|
||||
// request.NextToken = &req.NextToken
|
||||
//
|
||||
// resp, err := ecs.cli.DescribeInstances(ctx, request)
|
||||
// if err != nil {
|
||||
// return nil, errors.Wrap(err, "Aws ListDetail error")
|
||||
// }
|
||||
//
|
||||
// var ecses []*pbecs.EcsInstance
|
||||
// for _, v := range resp.Reservations {
|
||||
// for _, v2 := range v.Instances {
|
||||
// ecses = append(ecses, &pbecs.EcsInstance{
|
||||
// Provider: pbtenant.CloudProvider_aws,
|
||||
// AccountName: ecs.tenanter.AccountName(),
|
||||
// InstanceId: *v2.InstanceId,
|
||||
// InstanceName: "",
|
||||
// RegionName: ecs.region.GetName(),
|
||||
// PublicIps: []string{*v2.PublicIpAddress},
|
||||
// InstanceType: string(v2.InstanceType),
|
||||
// Cpu: v2.CpuOptions.CoreCount,
|
||||
// Memory: 0,
|
||||
// Description: "",
|
||||
// Status: string(v2.State.Name),
|
||||
// CreationTime: "",
|
||||
// ExpireTime: "",
|
||||
// })
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if resp.NextToken != nil {
|
||||
// return &pbecs.ListDetailResp{
|
||||
// Ecses: ecses,
|
||||
// Finished: false,
|
||||
// NextToken: *resp.NextToken,
|
||||
// }, nil
|
||||
// }
|
||||
// return &pbecs.ListDetailResp{
|
||||
// Ecses: ecses,
|
||||
// Finished: true,
|
||||
// NextToken: "",
|
||||
// }, nil
|
||||
//}
|
|
@ -0,0 +1,45 @@
|
|||
package ecser
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JCCE/PCM/common/tenanter"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrEcsListNotSupported = errors.New("cloud not supported ecs list")
|
||||
ErrEcserPanic = errors.New("ecs init panic")
|
||||
)
|
||||
|
||||
type Ecser interface {
|
||||
ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (resp *pbecs.ListDetailResp, err error)
|
||||
}
|
||||
|
||||
func NewEcsClient(provider pbtenant.CloudProvider, region tenanter.Region, tenant tenanter.Tenanter) (ecser Ecser, err error) {
|
||||
// 部分sdk会在内部panic
|
||||
defer func() {
|
||||
if err1 := recover(); err1 != nil {
|
||||
glog.Errorf("NewEcsClient panic %v", err1)
|
||||
err = errors.WithMessagef(ErrEcserPanic, "%v", err1)
|
||||
}
|
||||
}()
|
||||
|
||||
switch provider {
|
||||
case pbtenant.CloudProvider_ali:
|
||||
return newAliEcsClient(region, tenant)
|
||||
case pbtenant.CloudProvider_tencent:
|
||||
return newTencentCvmClient(region, tenant)
|
||||
case pbtenant.CloudProvider_huawei:
|
||||
return newHuaweiEcsClient(region, tenant)
|
||||
//TODO aws
|
||||
//case pbtenant.CloudProvider_aws:
|
||||
// return newAwsEcsClient(region, tenant)
|
||||
}
|
||||
|
||||
err = errors.WithMessagef(ErrEcsListNotSupported, "cloud provider %v region %v", provider, region)
|
||||
return
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package ecser
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEcser_ListDetail(t *testing.T) {
|
||||
region, _ := tenanter.NewRegion(pbtenant.CloudProvider_ali, int32(pbtenant.AliRegionId_ali_cn_hangzhou))
|
||||
ali, _ := NewEcsClient(pbtenant.CloudProvider_ali, region, aliTenant[0])
|
||||
aliFailed, _ := NewEcsClient(pbtenant.CloudProvider_ali, region, tenanter.NewTenantWithAccessKey("empty", "", ""))
|
||||
|
||||
region, _ = tenanter.NewRegion(pbtenant.CloudProvider_tencent, int32(pbtenant.TencentRegionId_tc_ap_beijing))
|
||||
tc, _ := NewEcsClient(pbtenant.CloudProvider_tencent, region, tcTenant[0])
|
||||
tcFailed, _ := NewEcsClient(pbtenant.CloudProvider_tencent, region, tenanter.NewTenantWithAccessKey("empty", "", ""))
|
||||
|
||||
region, _ = tenanter.NewRegion(pbtenant.CloudProvider_huawei, int32(pbtenant.HuaweiRegionId_hw_cn_southwest_2))
|
||||
hw, _ := NewEcsClient(pbtenant.CloudProvider_huawei, region, hwTenant[0])
|
||||
// hwFailed, _ := newHuaweiEcsClient(int32(pbtenant.HuaweiRegionId_hw_cn_north_1), tenanter.NewTenantWithAccessKey("empty", "", "", ""))
|
||||
|
||||
region, _ = tenanter.NewRegion(pbtenant.CloudProvider_aws, int32(pbtenant.AwsRegionId_aws_us_east_2))
|
||||
aws, _ := NewEcsClient(pbtenant.CloudProvider_aws, region, awsTenant[0])
|
||||
|
||||
// google, _ := NewGoogleEcsClient(tenanter.NewTenantWithAccessKey("", ""))
|
||||
|
||||
type args struct {
|
||||
req *pbecs.ListDetailReq
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
fields Ecser
|
||||
args args
|
||||
wantErr bool
|
||||
}{
|
||||
{name: "ali wrong cli", fields: aliFailed, args: args{&pbecs.ListDetailReq{PageNumber: 1, PageSize: 1}}, wantErr: true},
|
||||
{name: "ali wrong page number", fields: ali, args: args{&pbecs.ListDetailReq{PageNumber: 0, PageSize: 1}}, wantErr: true},
|
||||
{name: "ali wrong page size", fields: ali, args: args{&pbecs.ListDetailReq{PageNumber: 1, PageSize: 0}}, wantErr: true},
|
||||
{name: "ali right cli", fields: ali, args: args{&pbecs.ListDetailReq{PageNumber: 1, PageSize: 10}}, wantErr: false},
|
||||
|
||||
{name: "tc wrong cli", fields: tcFailed, args: args{&pbecs.ListDetailReq{PageNumber: 1, PageSize: 1}}, wantErr: true},
|
||||
{name: "tc wrong page number", fields: tc, args: args{&pbecs.ListDetailReq{PageNumber: 0, PageSize: 1}}, wantErr: true},
|
||||
{name: "tc wrong page size", fields: tc, args: args{&pbecs.ListDetailReq{PageNumber: 1, PageSize: 0}}, wantErr: true},
|
||||
{name: "tc right cli", fields: tc, args: args{&pbecs.ListDetailReq{PageNumber: 1, PageSize: 10}}, wantErr: false},
|
||||
|
||||
// {name: "hw wrong cli", fields: hwFailed, args: args{pageNumber: 1, pageSize: 1}, wantErr: true},
|
||||
{name: "hw right cli", fields: hw, args: args{&pbecs.ListDetailReq{PageNumber: 1, PageSize: 10}}, wantErr: false},
|
||||
|
||||
{name: "aws right cli", fields: aws, args: args{&pbecs.ListDetailReq{PageNumber: 1, PageSize: 10}}, wantErr: false},
|
||||
|
||||
// {name: "right cli", fields: google, args: args{pageNumber: 1, pageSize: 10}, wantErr: false},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
resp, err := tt.fields.ListDetail(context.Background(), tt.args.req)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("ListDetail() error = %+v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
t.Logf("%+v", err)
|
||||
if err == nil {
|
||||
t.Log(resp)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package ecser
|
||||
|
||||
//
|
||||
// import (
|
||||
// "context"
|
||||
// "fmt"
|
||||
//
|
||||
// "github.com/cloud-fitter/cloud-fitter/gen/idl/pbecs"
|
||||
// "github.com/cloud-fitter/cloud-fitter/internal/tenanter"
|
||||
// "github.com/pkg/errors"
|
||||
// "google.golang.org/api/compute/v1"
|
||||
// "google.golang.org/api/option"
|
||||
// )
|
||||
//
|
||||
// // Google当前存在2个问题:
|
||||
// // 1. 权限的最佳实践
|
||||
// // 2. 国内无法直接访问google认证的接口
|
||||
// type GoogleEcs struct {
|
||||
// cli *compute.Service
|
||||
// }
|
||||
//
|
||||
// func NewGoogleEcsClient(tenant tenanter.Tenanter) (Ecser, error) {
|
||||
// var client *compute.Service
|
||||
//
|
||||
// // rName, err := tenanter.GetAwsRegionName(regionId)
|
||||
// // if err != nil {
|
||||
// // return nil, err
|
||||
// // }
|
||||
//
|
||||
// client, err := compute.NewService(context.Background(), option.WithCredentialsFile("/Users/didi/Study/cloud-fitter/google_auth.json"))
|
||||
// if err != nil {
|
||||
// return nil, errors.WithMessage(err, "new compute service error")
|
||||
// }
|
||||
//
|
||||
// // // Project ID for this request.
|
||||
// // project := "my-project" // TODO: Update placeholder value.
|
||||
// //
|
||||
// // // The name of the zone for this request.
|
||||
// // zone := "my-zone" // TODO: Update placeholder value.
|
||||
// //
|
||||
// // req := computeService.Instances.ListDetail(project, zone)
|
||||
// // if err := req.Pages(ctx, func(page *compute.InstanceList) error {
|
||||
// // for _, instance := range page.Items {
|
||||
// // // TODO: Change code below to process each `instance` resource:
|
||||
// // fmt.Printf("%#v\n", instance)
|
||||
// // }
|
||||
// // return nil
|
||||
// // }); err != nil {
|
||||
// // log.Fatal(err)
|
||||
// // }
|
||||
//
|
||||
// // switch t := tenant.(type) {
|
||||
// // case *tenanter.AccessKeyTenant:
|
||||
// // auth := basic.NewCredentialsBuilder().WithAk(t.GetId()).WithSk(t.GetSecret()).Build()
|
||||
// // hcClient := hwecs.EcsClientBuilder().WithRegion(region.ValueOf(rName)).WithCredential(auth).Build()
|
||||
// // client = hwecs.NewEcsClient(hcClient)
|
||||
// // default:
|
||||
// // }
|
||||
//
|
||||
// if err != nil {
|
||||
// return nil, errors.Wrap(err, "init google ecs client error")
|
||||
// }
|
||||
// return &GoogleEcs{cli: client}, nil
|
||||
// }
|
||||
//
|
||||
// // func (ecs *GoogleEcs) ECSStatistic() (*pbecs.ECSStatisticRespList, error) {
|
||||
// // return nil, nil
|
||||
// // }
|
||||
//
|
||||
// func (ecs *GoogleEcs) ListDetail(pageNumber, pageSize int) (*pbecs.ListResp, error) {
|
||||
// // req := new(model.ListServersDetailsRequest)
|
||||
// // offset := int32((pageNumber - 1) * pageSize)
|
||||
// // req.Offset = &offset
|
||||
// // limit := int32(pageSize)
|
||||
// // req.Limit = &limit
|
||||
// //
|
||||
// // resp, err := ecs.cli.ListServersDetails(req)
|
||||
// // if err != nil {
|
||||
// // return nil, errors.Wrap(err, "Google ListDetail error")
|
||||
// // }
|
||||
//
|
||||
// // Project ID for this request.
|
||||
// project := "focused-stacker-311609" // TODO: Update placeholder value.
|
||||
//
|
||||
// // The name of the zone for this request.
|
||||
// zone := "asia-east2-a" // TODO: Update placeholder value.
|
||||
//
|
||||
// req := ecs.cli.Instances.ListDetail(project, zone)
|
||||
// var ecses []*pbecs.EcsInstance
|
||||
// if err := req.Pages(context.Background(), func(page *compute.InstanceList) error {
|
||||
// for _, instance := range page.Items {
|
||||
// ecses = append(ecses, &pbecs.EcsInstance{
|
||||
// InstanceId: fmt.Sprint(instance.Id),
|
||||
// InstanceName: instance.AccountName,
|
||||
// RegionId: "",
|
||||
// ZoneId: "",
|
||||
// PublicIps: nil,
|
||||
// Status: "",
|
||||
// CreationTime: "",
|
||||
// Description: "",
|
||||
// })
|
||||
// }
|
||||
// return nil
|
||||
// }); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
//
|
||||
// return &pbecs.ListResp{
|
||||
// Ecses: ecses,
|
||||
// }, nil
|
||||
// }
|
|
@ -0,0 +1,106 @@
|
|||
package ecser
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JCCE/PCM/common/tenanter"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
|
||||
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
|
||||
hwecs "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ecs/v2"
|
||||
"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ecs/v2/model"
|
||||
hwregion "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ecs/v2/region"
|
||||
hwiam "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iam/v3"
|
||||
iammodel "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iam/v3/model"
|
||||
iamregion "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iam/v3/region"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type HuaweiEcs struct {
|
||||
cli *hwecs.EcsClient
|
||||
region tenanter.Region
|
||||
tenanter tenanter.Tenanter
|
||||
}
|
||||
|
||||
func newHuaweiEcsClient(region tenanter.Region, tenant tenanter.Tenanter) (Ecser, error) {
|
||||
var (
|
||||
client *hwecs.EcsClient
|
||||
err error
|
||||
)
|
||||
|
||||
switch t := tenant.(type) {
|
||||
case *tenanter.AccessKeyTenant:
|
||||
auth := basic.NewCredentialsBuilder().WithAk(t.GetId()).WithSk(t.GetSecret()).Build()
|
||||
rName := region.GetName()
|
||||
cli := hwiam.IamClientBuilder().WithRegion(iamregion.ValueOf(rName)).WithCredential(auth).Build()
|
||||
c := hwiam.NewIamClient(cli)
|
||||
request := new(iammodel.KeystoneListProjectsRequest)
|
||||
request.Name = &rName
|
||||
r, err := c.KeystoneListProjects(request)
|
||||
if err != nil || len(*r.Projects) == 0 {
|
||||
return nil, errors.Wrapf(err, "Huawei KeystoneListProjects regionName %s", rName)
|
||||
}
|
||||
projectId := (*r.Projects)[0].Id
|
||||
|
||||
auth = basic.NewCredentialsBuilder().WithAk(t.GetId()).WithSk(t.GetSecret()).WithProjectId(projectId).Build()
|
||||
hcClient := hwecs.EcsClientBuilder().WithRegion(hwregion.ValueOf(rName)).WithCredential(auth).Build()
|
||||
client = hwecs.NewEcsClient(hcClient)
|
||||
default:
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init huawei ecs client error")
|
||||
}
|
||||
return &HuaweiEcs{
|
||||
cli: client,
|
||||
region: region,
|
||||
tenanter: tenant,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (ecs *HuaweiEcs) ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (*pbecs.ListDetailResp, error) {
|
||||
request := new(model.ListServersDetailsRequest)
|
||||
offset := (req.PageNumber - 1) * req.PageSize
|
||||
request.Offset = &offset
|
||||
limit := req.PageSize
|
||||
request.Limit = &limit
|
||||
|
||||
resp, err := ecs.cli.ListServersDetails(request)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Huawei ListDetail error")
|
||||
}
|
||||
|
||||
servers := *resp.Servers
|
||||
var ecses = make([]*pbecs.EcsInstance, len(servers))
|
||||
for k, v := range servers {
|
||||
ecses[k] = &pbecs.EcsInstance{
|
||||
Provider: pbtenant.CloudProvider_huawei,
|
||||
AccountName: ecs.tenanter.AccountName(),
|
||||
InstanceId: v.Id,
|
||||
InstanceName: v.Name,
|
||||
RegionName: ecs.region.GetName(),
|
||||
InstanceType: v.Flavor.Name,
|
||||
PublicIps: []string{v.AccessIPv4},
|
||||
// Cpu: v.Flavor.Vcpus,
|
||||
// Memory: v.Flavor.Ram,
|
||||
Description: *v.Description,
|
||||
Status: v.Status,
|
||||
CreationTime: v.Created,
|
||||
ExpireTime: v.OSSRVUSGterminatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
isFinished := false
|
||||
if len(ecses) < int(req.PageSize) {
|
||||
isFinished = true
|
||||
}
|
||||
|
||||
return &pbecs.ListDetailResp{
|
||||
Ecses: ecses,
|
||||
Finished: isFinished,
|
||||
NextToken: "",
|
||||
PageNumber: req.PageNumber + 1,
|
||||
PageSize: req.PageSize,
|
||||
RequestId: "",
|
||||
}, nil
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package ecser
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JCCE/PCM/common/tenanter"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var (
|
||||
aliTenant, tcTenant, hwTenant, awsTenant []tenanter.Tenanter
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
err := tenanter.LoadCloudConfigs("../../../config.yaml")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if aliTenant, err = tenanter.GetTenanters(pbtenant.CloudProvider_ali); err != nil {
|
||||
panic("get aliTenant failed")
|
||||
}
|
||||
if tcTenant, err = tenanter.GetTenanters(pbtenant.CloudProvider_tencent); err != nil {
|
||||
panic("get tcTenant failed")
|
||||
}
|
||||
if hwTenant, err = tenanter.GetTenanters(pbtenant.CloudProvider_huawei); err != nil {
|
||||
panic("get hwTenant failed")
|
||||
}
|
||||
if awsTenant, err = tenanter.GetTenanters(pbtenant.CloudProvider_aws); err != nil {
|
||||
panic("get awsTenant failed")
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package ecser
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JCCE/PCM/common/tenanter"
|
||||
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
|
||||
cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
|
||||
)
|
||||
|
||||
type TencentCvm struct {
|
||||
cli *cvm.Client
|
||||
region tenanter.Region
|
||||
tenanter tenanter.Tenanter
|
||||
}
|
||||
|
||||
func newTencentCvmClient(region tenanter.Region, tenant tenanter.Tenanter) (Ecser, error) {
|
||||
var (
|
||||
client *cvm.Client
|
||||
err error
|
||||
)
|
||||
|
||||
switch t := tenant.(type) {
|
||||
case *tenanter.AccessKeyTenant:
|
||||
client, err = cvm.NewClient(common.NewCredential(t.GetId(), t.GetSecret()), region.GetName(), profile.NewClientProfile())
|
||||
default:
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init tencent cvm client error")
|
||||
}
|
||||
return &TencentCvm{
|
||||
cli: client,
|
||||
region: region,
|
||||
tenanter: tenant,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (ecs *TencentCvm) ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (*pbecs.ListDetailResp, error) {
|
||||
request := cvm.NewDescribeInstancesRequest()
|
||||
request.Offset = common.Int64Ptr(int64((req.PageNumber - 1) * req.PageSize))
|
||||
request.Limit = common.Int64Ptr(int64(req.PageSize))
|
||||
resp, err := ecs.cli.DescribeInstances(request)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Tencent ListDetail error")
|
||||
}
|
||||
|
||||
var ecses = make([]*pbecs.EcsInstance, len(resp.Response.InstanceSet))
|
||||
for k, v := range resp.Response.InstanceSet {
|
||||
ecses[k] = &pbecs.EcsInstance{
|
||||
Provider: pbtenant.CloudProvider_tencent,
|
||||
AccountName: ecs.tenanter.AccountName(),
|
||||
InstanceId: *v.InstanceId,
|
||||
InstanceName: *v.InstanceName,
|
||||
RegionName: ecs.region.GetName(),
|
||||
PublicIps: make([]string, len(v.PublicIpAddresses)),
|
||||
InstanceType: *v.InstanceType,
|
||||
Cpu: int32(*v.CPU),
|
||||
Memory: int32(*v.Memory),
|
||||
Description: "",
|
||||
Status: *v.InstanceState,
|
||||
CreationTime: *v.CreatedTime,
|
||||
ExpireTime: *v.ExpiredTime,
|
||||
InnerIps: make([]string, len(v.PrivateIpAddresses)),
|
||||
VpcId: *v.VirtualPrivateCloud.VpcId,
|
||||
ResourceGroupId: "",
|
||||
ChargeType: *v.InstanceChargeType,
|
||||
}
|
||||
for k1, v1 := range v.PublicIpAddresses {
|
||||
ecses[k].PublicIps[k1] = *v1
|
||||
}
|
||||
for k1, v1 := range v.PrivateIpAddresses {
|
||||
ecses[k].InnerIps[k1] = *v1
|
||||
}
|
||||
}
|
||||
|
||||
isFinished := false
|
||||
if len(ecses) < int(req.PageSize) {
|
||||
isFinished = true
|
||||
}
|
||||
|
||||
return &pbecs.ListDetailResp{
|
||||
Ecses: ecses,
|
||||
Finished: isFinished,
|
||||
NextToken: "",
|
||||
PageNumber: req.PageNumber + 1,
|
||||
PageSize: req.PageSize,
|
||||
RequestId: *resp.Response.RequestId,
|
||||
}, nil
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
version: v1
|
||||
plugins:
|
||||
- name: go
|
||||
out: lan_trans
|
||||
opt:
|
||||
- paths=source_relative
|
||||
# - name: java
|
||||
# out: lan_trans
|
||||
# opt:
|
||||
# - paths=source_relative
|
||||
- name: go-grpc
|
||||
out: lan_trans
|
||||
opt:
|
||||
- paths=source_relative
|
||||
# - name: java-grpc
|
||||
# out: gen
|
||||
# opt:
|
||||
# - paths=source_relative
|
||||
- name: grpc-gateway
|
||||
out: lan_trans
|
||||
opt:
|
||||
- paths=source_relative
|
||||
- name: openapiv2
|
||||
out: lan_trans/openapiv2
|
|
@ -2,12 +2,14 @@ package server
|
|||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/gen/idl/demo"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/demo"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
// 使用unsafe可以强制让编译器检查是否实现了相关方法
|
||||
demo.UnsafeDemoServiceServer
|
||||
pbecs.UnsafeEcsServiceServer
|
||||
}
|
||||
|
||||
func (s *Server) Echo(ctx context.Context, req *demo.StringMessage) (*demo.StringMessage, error) {
|
|
@ -0,0 +1,38 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/JCCE/PCM/adaptor/vm_adaptor/server/ecs"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
func (s *Server) ListEcsDetail(ctx context.Context, req *pbecs.ListDetailReq) (*pbecs.ListDetailResp, error) {
|
||||
resp, err := ecs.ListDetail(ctx, req)
|
||||
if err != nil {
|
||||
glog.Errorf("ListEcsDetail error %+v", err)
|
||||
return nil, status.Errorf(codes.Internal, err.Error())
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (s *Server) ListEcs(ctx context.Context, req *pbecs.ListReq) (*pbecs.ListResp, error) {
|
||||
resp, err := ecs.List(ctx, req)
|
||||
if err != nil {
|
||||
glog.Errorf("ListEcs error %+v", err)
|
||||
return nil, status.Errorf(codes.Internal, err.Error())
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (s *Server) ListEcsAll(ctx context.Context, req *pbecs.ListAllReq) (*pbecs.ListResp, error) {
|
||||
resp, err := ecs.ListAll(ctx)
|
||||
if err != nil {
|
||||
glog.Errorf("ListEcsAll error %+v", err)
|
||||
return nil, status.Errorf(codes.Internal, err.Error())
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package tenanter
|
||||
|
||||
type AccessKeyTenant struct {
|
||||
name string
|
||||
id string
|
||||
secret string
|
||||
}
|
||||
|
||||
func NewTenantWithAccessKey(name, accessKeyId, accessKeySecret string) Tenanter {
|
||||
return &AccessKeyTenant{
|
||||
name: name,
|
||||
id: accessKeyId,
|
||||
secret: accessKeySecret,
|
||||
}
|
||||
}
|
||||
|
||||
func (tenant *AccessKeyTenant) AccountName() string {
|
||||
return tenant.name
|
||||
}
|
||||
|
||||
func (tenant *AccessKeyTenant) Clone() Tenanter {
|
||||
return &AccessKeyTenant{
|
||||
id: tenant.id,
|
||||
secret: tenant.secret,
|
||||
name: tenant.name,
|
||||
}
|
||||
}
|
||||
|
||||
func (tenant *AccessKeyTenant) GetId() string {
|
||||
return tenant.id
|
||||
}
|
||||
|
||||
func (tenant *AccessKeyTenant) GetSecret() string {
|
||||
return tenant.secret
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package tenanter
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"PCM/lan_trans/go/idl/pbtenant"
|
||||
)
|
||||
|
||||
var (
|
||||
aliTenant []Tenanter
|
||||
tcTenant []Tenanter
|
||||
hwTenant []Tenanter
|
||||
awsTenant []Tenanter
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
err := LoadCloudConfigs("../../config.yaml")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if aliTenant, err = GetTenanters(pbtenant.CloudProvider_ali); err != nil {
|
||||
panic("get aliTenant failed")
|
||||
}
|
||||
if tcTenant, err = GetTenanters(pbtenant.CloudProvider_tencent); err != nil {
|
||||
panic("get tcTenantr failed")
|
||||
}
|
||||
if hwTenant, err = GetTenanters(pbtenant.CloudProvider_huawei); err != nil {
|
||||
panic("get hwTenant failed")
|
||||
}
|
||||
if awsTenant, err = GetTenanters(pbtenant.CloudProvider_aws); err != nil {
|
||||
panic("get awsTenant failed")
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
package tenanter
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNoExistAliRegionId = errors.New("region id not exist in ali")
|
||||
ErrNoExistTencentRegionId = errors.New("region id not exist in tencent")
|
||||
ErrNoExistHuaweiRegionId = errors.New("region id not exist in huawei")
|
||||
ErrNoExistAwsRegionId = errors.New("region id not exist in aws")
|
||||
)
|
||||
|
||||
type Region interface {
|
||||
GetId() int32
|
||||
GetName() string
|
||||
}
|
||||
|
||||
type region struct {
|
||||
provider pbtenant.CloudProvider
|
||||
regionId int32
|
||||
regionName string
|
||||
}
|
||||
|
||||
func NewRegion(provider pbtenant.CloudProvider, regionId int32) (Region, error) {
|
||||
r := ®ion{
|
||||
provider: provider,
|
||||
regionId: regionId,
|
||||
}
|
||||
var err error
|
||||
|
||||
switch provider {
|
||||
case pbtenant.CloudProvider_ali:
|
||||
r.regionName, err = getAliRegionName(regionId)
|
||||
case pbtenant.CloudProvider_tencent:
|
||||
r.regionName, err = getTencentRegionName(regionId)
|
||||
case pbtenant.CloudProvider_huawei:
|
||||
r.regionName, err = getHuaweiRegionName(regionId)
|
||||
case pbtenant.CloudProvider_aws:
|
||||
r.regionName, err = getAwsRegionName(regionId)
|
||||
}
|
||||
|
||||
return r, err
|
||||
}
|
||||
|
||||
func (r *region) GetName() string {
|
||||
return r.regionName
|
||||
}
|
||||
|
||||
func (r *region) GetId() int32 {
|
||||
return r.regionId
|
||||
}
|
||||
|
||||
func GetAllRegionIds(provider pbtenant.CloudProvider) (regions []Region) {
|
||||
switch provider {
|
||||
case pbtenant.CloudProvider_ali:
|
||||
for rId := range pbtenant.AliRegionId_name {
|
||||
if rId != int32(pbtenant.AliRegionId_ali_all) {
|
||||
region, _ := NewRegion(provider, rId)
|
||||
regions = append(regions, region)
|
||||
}
|
||||
}
|
||||
case pbtenant.CloudProvider_tencent:
|
||||
for rId := range pbtenant.TencentRegionId_name {
|
||||
if rId != int32(pbtenant.TencentRegionId_tc_all) {
|
||||
region, _ := NewRegion(provider, rId)
|
||||
regions = append(regions, region)
|
||||
}
|
||||
}
|
||||
case pbtenant.CloudProvider_huawei:
|
||||
for rId := range pbtenant.HuaweiRegionId_name {
|
||||
if rId != int32(pbtenant.HuaweiRegionId_hw_all) {
|
||||
region, _ := NewRegion(provider, rId)
|
||||
regions = append(regions, region)
|
||||
}
|
||||
}
|
||||
case pbtenant.CloudProvider_aws:
|
||||
for rId := range pbtenant.AwsRegionId_name {
|
||||
if rId != int32(pbtenant.AwsRegionId_aws_all) {
|
||||
region, _ := NewRegion(provider, rId)
|
||||
regions = append(regions, region)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// prefix ali_
|
||||
func getAliRegionName(regionId int32) (string, error) {
|
||||
name, ok := pbtenant.AliRegionId_name[regionId]
|
||||
if !ok || regionId == int32(pbtenant.AliRegionId_ali_all) {
|
||||
return "", errors.WithMessagef(ErrNoExistAliRegionId, "input region id is %d", regionId)
|
||||
}
|
||||
region := strings.ReplaceAll(name, "_", "-")
|
||||
return region[4:], nil
|
||||
}
|
||||
|
||||
// prefix tc_
|
||||
func getTencentRegionName(regionId int32) (string, error) {
|
||||
name, ok := pbtenant.TencentRegionId_name[regionId]
|
||||
if !ok || regionId == int32(pbtenant.TencentRegionId_tc_all) {
|
||||
return "", errors.WithMessagef(ErrNoExistTencentRegionId, "input region id is %d", regionId)
|
||||
}
|
||||
region := strings.ReplaceAll(name, "_", "-")
|
||||
return region[3:], nil
|
||||
}
|
||||
|
||||
// prefix hw_
|
||||
func getHuaweiRegionName(regionId int32) (string, error) {
|
||||
name, ok := pbtenant.HuaweiRegionId_name[regionId]
|
||||
if !ok || regionId == int32(pbtenant.HuaweiRegionId_hw_all) {
|
||||
return "", errors.WithMessagef(ErrNoExistHuaweiRegionId, "input region id is %d", regionId)
|
||||
}
|
||||
region := strings.ReplaceAll(name, "_", "-")
|
||||
return region[3:], nil
|
||||
}
|
||||
|
||||
// prefix aws_
|
||||
func getAwsRegionName(regionId int32) (string, error) {
|
||||
name, ok := pbtenant.AwsRegionId_name[regionId]
|
||||
if !ok || regionId == int32(pbtenant.AwsRegionId_aws_all) {
|
||||
return "", errors.WithMessagef(ErrNoExistAwsRegionId, "input region id is %d", regionId)
|
||||
}
|
||||
region := strings.ReplaceAll(name, "_", "-")
|
||||
return region[4:], nil
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package tenanter
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"PCM/lan_trans/go/idl/pbtenant"
|
||||
)
|
||||
|
||||
func TestGetAllRegionIds(t *testing.T) {
|
||||
type args struct {
|
||||
provider pbtenant.CloudProvider
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
}{
|
||||
{name: "ali", args: args{provider: pbtenant.CloudProvider_ali}},
|
||||
{name: "tencent", args: args{provider: pbtenant.CloudProvider_tencent}},
|
||||
{name: "huawei", args: args{provider: pbtenant.CloudProvider_huawei}},
|
||||
{name: "aws", args: args{provider: pbtenant.CloudProvider_aws}},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if gotRegions := GetAllRegionIds(tt.args.provider); len(gotRegions) == 0 {
|
||||
t.Errorf("GetAllRegionIds() = %v, want >0", gotRegions)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package tenanter
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/go-yaml/yaml"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const osEnvKey = "CLOUD_FITTER_CONFIGS"
|
||||
|
||||
var (
|
||||
ErrLoadTenanterFromFile = errors.New("load tenanter from file failed")
|
||||
ErrLoadTenanterFromOsEnv = errors.New("load tenanter from os env failed")
|
||||
ErrLoadTenanterFileEmpty = errors.New("load tenanter from file failed")
|
||||
ErrNoTenanters = errors.New("no tenanters for the cloud")
|
||||
)
|
||||
|
||||
type Tenanter interface {
|
||||
AccountName() string
|
||||
Clone() Tenanter
|
||||
}
|
||||
|
||||
var gStore = globalStore{stores: make(map[pbtenant.CloudProvider][]Tenanter)}
|
||||
|
||||
type globalStore struct {
|
||||
sync.Mutex
|
||||
stores map[pbtenant.CloudProvider][]Tenanter
|
||||
}
|
||||
|
||||
func LoadCloudConfigs(configFile string) error {
|
||||
if err := LoadCloudConfigsFromFile(configFile); errors.Is(err, ErrLoadTenanterFileEmpty) {
|
||||
return LoadCloudConfigsFromOsEnv()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func LoadCloudConfigsFromFile(configFile string) error {
|
||||
b, err := ioutil.ReadFile(configFile)
|
||||
if err != nil {
|
||||
return ErrLoadTenanterFileEmpty
|
||||
}
|
||||
|
||||
var configs = new(pbtenant.CloudConfigs)
|
||||
if err = yaml.Unmarshal(b, configs); err != nil {
|
||||
return errors.WithMessage(ErrLoadTenanterFromFile, err.Error())
|
||||
}
|
||||
|
||||
return load(configs)
|
||||
}
|
||||
|
||||
func LoadCloudConfigsFromOsEnv() error {
|
||||
data := os.Getenv(osEnvKey)
|
||||
var configs = new(pbtenant.CloudConfigs)
|
||||
if err := json.Unmarshal([]byte(data), configs); err != nil {
|
||||
return errors.WithMessage(ErrLoadTenanterFromOsEnv, err.Error())
|
||||
}
|
||||
|
||||
return load(configs)
|
||||
}
|
||||
|
||||
func ShowConfigJson() ([]byte, error) {
|
||||
data := os.Getenv(osEnvKey)
|
||||
var configs = new(pbtenant.CloudConfigs)
|
||||
if err := yaml.Unmarshal([]byte(data), configs); err != nil {
|
||||
return nil, errors.WithMessage(ErrLoadTenanterFromFile, err.Error())
|
||||
}
|
||||
|
||||
return json.Marshal(configs)
|
||||
}
|
||||
|
||||
func load(configs *pbtenant.CloudConfigs) error {
|
||||
gStore.Lock()
|
||||
defer gStore.Unlock()
|
||||
|
||||
for _, c := range configs.Configs {
|
||||
if c.AccessId != "" && c.AccessSecret != "" {
|
||||
gStore.stores[c.Provider] = append(gStore.stores[c.Provider], NewTenantWithAccessKey(c.Name, c.AccessId, c.AccessSecret))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetTenanters(provider pbtenant.CloudProvider) ([]Tenanter, error) {
|
||||
gStore.Lock()
|
||||
defer gStore.Unlock()
|
||||
|
||||
if len(gStore.stores[provider]) == 0 {
|
||||
return nil, errors.WithMessagef(ErrNoTenanters, "cloud is %v", provider)
|
||||
}
|
||||
|
||||
var tenanters = make([]Tenanter, len(gStore.stores[provider]))
|
||||
for k := range gStore.stores[provider] {
|
||||
tenanters[k] = gStore.stores[provider][k].Clone()
|
||||
}
|
||||
return tenanters, nil
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package tenanter
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestShowConfigJson(t *testing.T) {
|
||||
type args struct {
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
wantErr bool
|
||||
}{
|
||||
{name: "right", args: args{}, wantErr: false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := ShowConfigJson()
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("ShowConfigJson() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
if err == nil {
|
||||
t.Log(string(got))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
26
go.mod
26
go.mod
|
@ -5,10 +5,16 @@ go 1.17
|
|||
require (
|
||||
github.com/Unknwon/goconfig v1.0.0
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1530
|
||||
github.com/aws/aws-sdk-go-v2/config v1.15.3
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.11.2
|
||||
github.com/aws/aws-sdk-go-v2/service/ec2 v1.34.0
|
||||
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.371
|
||||
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
|
||||
|
@ -19,23 +25,33 @@ require (
|
|||
)
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.10 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.3 // indirect
|
||||
github.com/aws/smithy-go v1.11.2 // indirect
|
||||
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 v0.0.0-20170612174753-24818f796faf // 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.0.0-20180206201540-c2b33e8439af // indirect
|
||||
github.com/json-iterator/go v1.1.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-20200622213623-75b288015ac9 // 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
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
syntax = "proto3";
|
||||
package pbecs;
|
||||
|
||||
option go_package = "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs";
|
||||
|
||||
import "idl/pbtenant/tenant.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
message EcsInstance {
|
||||
// 云类型
|
||||
pbtenant.CloudProvider provider = 1;
|
||||
// 账号名称
|
||||
string account_name = 2;
|
||||
// 实例id
|
||||
string instance_id = 3;
|
||||
// 实例名称
|
||||
string instance_name = 4;
|
||||
// 地域,数据中心
|
||||
string region_name = 5;
|
||||
// 公网ip
|
||||
repeated string public_ips = 6;
|
||||
// 实例类型
|
||||
string instance_type = 7;
|
||||
// vcpu数
|
||||
int32 cpu = 8;
|
||||
// 内存MB
|
||||
int32 memory = 9;
|
||||
// 实例描述
|
||||
string description = 10;
|
||||
// 状态
|
||||
string status = 11;
|
||||
// 创建时间,ISO8601
|
||||
string creation_time = 12;
|
||||
// 过期时间
|
||||
string expire_time = 13;
|
||||
// 内网ip
|
||||
repeated string inner_ips = 14;
|
||||
// vcp id
|
||||
string vpc_id = 15;
|
||||
// 资源组id
|
||||
string resource_group_id = 16;
|
||||
// 收费类型
|
||||
string charge_type = 17;
|
||||
}
|
||||
|
||||
message ListDetailReq {
|
||||
// 云名称
|
||||
pbtenant.CloudProvider provider = 1;
|
||||
// 账户名称,根据config.yaml中的配置,默认为第一个配置的账户
|
||||
string account_name = 2;
|
||||
// 区域Id,参考 tenant.proto 中的各个云的区域
|
||||
int32 region_id = 3;
|
||||
// 分页相关参数,页码
|
||||
int32 page_number = 4;
|
||||
// 分页相关参数,每页数量
|
||||
int32 page_size = 5;
|
||||
// 分页相关参数,下一页的token
|
||||
string next_token = 6;
|
||||
}
|
||||
|
||||
message ListDetailResp {
|
||||
// Ecs 机器集合
|
||||
repeated EcsInstance ecses = 1;
|
||||
// 查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询
|
||||
bool finished = 2;
|
||||
// 分页相关参数,页码
|
||||
int32 page_number = 3;
|
||||
// 分页相关参数,每页数量
|
||||
int32 page_size = 4;
|
||||
// 分页相关参数,下一页的token
|
||||
string next_token = 5;
|
||||
// 请求id,出现问题后提供给云厂商,排查问题
|
||||
string request_id = 6;
|
||||
}
|
||||
|
||||
message ListReq {
|
||||
// 云名称
|
||||
pbtenant.CloudProvider provider = 1;
|
||||
}
|
||||
|
||||
message ListResp {
|
||||
// Ecs 机器集合
|
||||
repeated EcsInstance ecses = 1;
|
||||
}
|
||||
|
||||
message ListAllReq{}
|
||||
|
||||
|
||||
// ECS类产品接口
|
||||
// 阿里云 - ECS
|
||||
// 腾讯云 - CVM
|
||||
// 华为云 - ECS
|
||||
// 亚马逊云 - EC2
|
||||
service EcsService {
|
||||
|
||||
// 查询ECS明细 - 支持云类型、区域、账户、分页等过滤条件
|
||||
rpc ListEcsDetail(ListDetailReq) returns (ListDetailResp) {
|
||||
option (google.api.http) = {
|
||||
post : "/apis/ecs/detail"
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 查询ECS全量 - 根据云类型
|
||||
rpc ListEcs(ListReq) returns (ListResp) {
|
||||
option (google.api.http) = {
|
||||
post : "/apis/ecs"
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 查询所有云的ECS
|
||||
rpc ListEcsAll(ListAllReq) returns (ListResp) {
|
||||
option (google.api.http) = {
|
||||
post : "/apis/ecs/all"
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
syntax = "proto3";
|
||||
package pbtenant;
|
||||
|
||||
option go_package = "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant";
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "protoc-gen-openapiv2/options/annotations.proto";
|
||||
|
||||
// 云提供商
|
||||
enum CloudProvider {
|
||||
// 0 - 阿里云
|
||||
ali = 0;
|
||||
// 1 - 腾讯云
|
||||
tencent = 1;
|
||||
// 2 - 华为云
|
||||
huawei = 2;
|
||||
// 3 - 亚马逊云
|
||||
aws = 3;
|
||||
}
|
||||
|
||||
// 云产品
|
||||
enum CloudProduct {
|
||||
// 0 - 所有产品
|
||||
product_all = 0;
|
||||
// 1 - ECS类产品:阿里云ECS,腾讯云CVM,华为云ECS,亚马逊EC2
|
||||
product_ecs = 1;
|
||||
// 2 - RDS类产品:阿里云RDS,腾讯云CDB
|
||||
product_rds = 2;
|
||||
// 3 - Domain类产品:阿里云Domain
|
||||
product_domain = 3;
|
||||
// 4 - OSS类产品:阿里云OSS
|
||||
product_oss = 4;
|
||||
}
|
||||
|
||||
// 云配置信息
|
||||
message CloudConfigs {
|
||||
// 云配置
|
||||
repeated CloudConfig configs = 1;
|
||||
}
|
||||
|
||||
message CloudConfig {
|
||||
// 云服务提供商,具体参考 CloudProvider 的定义
|
||||
CloudProvider provider = 1;
|
||||
// 账户名称,由用户自定义,必须全局唯一,方便多个系统之间的维护
|
||||
string name = 2;
|
||||
// 认证方式1:与 access_secret 结合使用,两者均非空时生效
|
||||
string access_id = 3;
|
||||
// 认证方式1:与 access_id 结合使用,两者均非空时生效
|
||||
string access_secret = 4;
|
||||
}
|
||||
|
||||
// 阿里云区域,需要将对应的 _ 转化为 -
|
||||
enum AliRegionId {
|
||||
ali_all = 0;
|
||||
ali_cn_qingdao = 1; // 青岛
|
||||
ali_cn_beijing = 2; // 北京
|
||||
ali_cn_zhangjiakou = 3; // 张家口
|
||||
ali_cn_huhehaote = 4; // 呼和浩特
|
||||
ali_cn_wulanchabu = 5; // 乌兰察布
|
||||
ali_cn_hangzhou = 6; // 杭州
|
||||
ali_cn_shanghai = 7; // 上海
|
||||
ali_cn_shenzhen = 8; // 深圳
|
||||
ali_cn_heyuan = 9; // 河源
|
||||
ali_cn_guangzhou = 10; // 广州
|
||||
ali_cn_chengdu = 11; // 成都
|
||||
ali_cn_hongkong = 12; // 中国香港-香港
|
||||
ali_ap_southeast_1 = 13; // 亚太东南1-新加坡
|
||||
ali_ap_southeast_2 = 14; // 亚太东南2-悉尼
|
||||
ali_ap_southeast_3 = 15; // 亚太东南3-吉隆坡
|
||||
ali_ap_southeast_5 = 16; // 亚太东南5-雅加达
|
||||
ali_ap_south_1 = 17; // 亚太南部1-孟买
|
||||
ali_ap_northeast_1 = 18; // 亚太东北1-东京
|
||||
ali_us_west_1 = 19; // 美国西部1-硅谷
|
||||
ali_us_east_1 = 20; // 美国东部1-弗吉尼亚
|
||||
ali_eu_central_1 = 21; // 欧洲中部1-法兰克福
|
||||
ali_eu_west_1 = 22; // 英国(伦敦)-伦敦
|
||||
ali_me_east_1 = 23; // 中东东部1-迪拜
|
||||
}
|
||||
|
||||
// 腾讯云区域,需要将对应的 _ 转化为 -
|
||||
enum TencentRegionId {
|
||||
tc_all = 0;
|
||||
tc_ap_bangkok = 1; // 曼谷
|
||||
tc_ap_beijing = 2; // 北京
|
||||
tc_ap_chengdu = 3; // 成都
|
||||
tc_ap_chongqing = 4; // 重庆
|
||||
tc_ap_guangzhou = 5; // 广州
|
||||
tc_ap_guangzhou_open = 6; // 广州Open
|
||||
tc_ap_hongkong = 7; // 中国香港
|
||||
tc_ap_mumbai = 8; // 孟买
|
||||
tc_ap_seoul = 9; // 首尔
|
||||
tc_ap_shanghai = 10; // 上海
|
||||
tc_ap_shanghai_fsi = 11; // 上海金融
|
||||
tc_ap_shenzhen_fsi = 12; // 深圳金融
|
||||
tc_ap_singapore = 13; // 新加坡
|
||||
tc_ap_tokyo = 14; // 东京
|
||||
tc_eu_frankfurt = 15; // 法兰克福
|
||||
tc_eu_moscow = 16; // 莫斯科
|
||||
tc_na_ashburn = 17; // 阿什本
|
||||
tc_na_siliconvalley = 18; // 硅谷
|
||||
tc_na_toronto = 19; // 多伦多
|
||||
}
|
||||
|
||||
// 华为云区域,需要将对应的 _ 转化为 -
|
||||
enum HuaweiRegionId {
|
||||
hw_all = 0;
|
||||
hw_cn_north_1 = 1;
|
||||
hw_cn_north_4 = 2;
|
||||
hw_cn_south_1 = 3;
|
||||
hw_cn_east_2 = 4;
|
||||
hw_cn_east_3 = 5;
|
||||
hw_cn_southwest_2 = 6;
|
||||
hw_ap_southeast_1 = 7;
|
||||
hw_ap_southeast_2 = 8;
|
||||
hw_ap_southeast_3 = 9;
|
||||
hw_af_south_1 = 10;
|
||||
}
|
||||
|
||||
// 亚马逊云区域,需要将对应的 _ 转化为 -
|
||||
enum AwsRegionId {
|
||||
aws_all = 0;
|
||||
aws_us_east_2 = 1; // US East (Ohio)
|
||||
aws_us_east_1 = 2; // US East (N. Virginia)
|
||||
aws_us_west_1 = 3; // US West (N. California)
|
||||
aws_us_west_2 = 4; // US West (Oregon)
|
||||
aws_af_south_1 = 5; // Africa (Cape Town)
|
||||
aws_ap_east_1 = 6; // Asia Pacific (Hong Kong)
|
||||
aws_ap_south_1 = 7; // Asia Pacific (Mumbai)
|
||||
aws_ap_northeast_3 = 8; // Asia Pacific (Osaka)
|
||||
aws_ap_northeast_2 = 9; // Asia Pacific (Seoul)
|
||||
aws_ap_northeast_1 = 10; // Asia Pacific (Singapore)
|
||||
aws_ap_southeast_2 = 11; // Asia Pacific (Sydney)
|
||||
aws_ap_southeast_1 = 12; // Asia Pacific (Tokyo)
|
||||
aws_ca_central_1 = 13; // Canada (Central)
|
||||
aws_eu_central_1 = 14; // Europe (Frankfurt)
|
||||
aws_eu_west_1 = 15; // Europe (Ireland)
|
||||
aws_eu_west_2 = 16; // Europe (London)
|
||||
aws_eu_south_1 = 17; // Europe (Milan)
|
||||
aws_eu_west_3 = 18; // Europe (Paris)
|
||||
aws_eu_north_1 = 19; // Europe (Stockholm)
|
||||
aws_me_south_1 = 20; // Middle East (Bahrain)
|
||||
aws_sa_east_1 = 21; // South America (São Paulo)
|
||||
}
|
||||
|
||||
service TenantService {
|
||||
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {
|
||||
description : "所有云租户的认证服务"
|
||||
external_docs : {
|
||||
url : "https://gitlink.org.cn/JCCE/PCM"
|
||||
description: "Find out more about CloudFitter"
|
||||
}
|
||||
};
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
version: v1
|
||||
plugins:
|
||||
- name: go
|
||||
out: gen
|
||||
opt:
|
||||
- paths=source_relative
|
||||
- name: go-grpc
|
||||
out: gen
|
||||
opt:
|
||||
- paths=source_relative
|
||||
- name: grpc-gateway
|
||||
out: gen
|
||||
opt:
|
||||
- paths=source_relative
|
||||
- name: openapiv2
|
||||
out: gen/openapiv2
|
|
@ -0,0 +1,213 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.0
|
||||
// protoc (unknown)
|
||||
// source: idl/demo/demo.proto
|
||||
|
||||
package demo
|
||||
|
||||
import (
|
||||
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
|
||||
_ "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 OurTeam int32
|
||||
|
||||
const (
|
||||
// github: devad
|
||||
OurTeam_devad OurTeam = 0
|
||||
)
|
||||
|
||||
// Enum value maps for OurTeam.
|
||||
var (
|
||||
OurTeam_name = map[int32]string{
|
||||
0: "devad",
|
||||
}
|
||||
OurTeam_value = map[string]int32{
|
||||
"devad": 0,
|
||||
}
|
||||
)
|
||||
|
||||
func (x OurTeam) Enum() *OurTeam {
|
||||
p := new(OurTeam)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x OurTeam) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (OurTeam) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_idl_demo_demo_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (OurTeam) Type() protoreflect.EnumType {
|
||||
return &file_idl_demo_demo_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x OurTeam) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use OurTeam.Descriptor instead.
|
||||
func (OurTeam) EnumDescriptor() ([]byte, []int) {
|
||||
return file_idl_demo_demo_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type StringMessage struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (x *StringMessage) Reset() {
|
||||
*x = StringMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_idl_demo_demo_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *StringMessage) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*StringMessage) ProtoMessage() {}
|
||||
|
||||
func (x *StringMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_idl_demo_demo_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 StringMessage.ProtoReflect.Descriptor instead.
|
||||
func (*StringMessage) Descriptor() ([]byte, []int) {
|
||||
return file_idl_demo_demo_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *StringMessage) GetValue() string {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_idl_demo_demo_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_idl_demo_demo_proto_rawDesc = []byte{
|
||||
0x0a, 0x13, 0x69, 0x64, 0x6c, 0x2f, 0x64, 0x65, 0x6d, 0x6f, 0x2f, 0x64, 0x65, 0x6d, 0x6f, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x64, 0x65, 0x6d, 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, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f,
|
||||
0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x25, 0x0a, 0x0d, 0x53, 0x74, 0x72,
|
||||
0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x2a, 0x14, 0x0a, 0x07, 0x4f, 0x75, 0x72, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x09, 0x0a, 0x05, 0x64,
|
||||
0x65, 0x76, 0x61, 0x64, 0x10, 0x00, 0x32, 0xb3, 0x01, 0x0a, 0x0b, 0x44, 0x65, 0x6d, 0x6f, 0x53,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa3, 0x01, 0x0a, 0x04, 0x45, 0x63, 0x68, 0x6f, 0x12,
|
||||
0x13, 0x2e, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x1a, 0x13, 0x2e, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x53, 0x74, 0x72, 0x69,
|
||||
0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x71, 0x92, 0x41, 0x59, 0x22, 0x53,
|
||||
0x0a, 0x21, 0x46, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20,
|
||||
0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66,
|
||||
0x61, 0x63, 0x65, 0x12, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74,
|
||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f,
|
||||
0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65,
|
||||
0x77, 0x61, 0x79, 0x58, 0x01, 0x62, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x22, 0x0a, 0x2f,
|
||||
0x61, 0x70, 0x69, 0x73, 0x2f, 0x64, 0x65, 0x6d, 0x6f, 0x3a, 0x01, 0x2a, 0x42, 0x30, 0x5a, 0x2e,
|
||||
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, 0x67, 0x65, 0x6e, 0x2f, 0x69, 0x64, 0x6c, 0x2f, 0x64, 0x65, 0x6d, 0x6f, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_idl_demo_demo_proto_rawDescOnce sync.Once
|
||||
file_idl_demo_demo_proto_rawDescData = file_idl_demo_demo_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_idl_demo_demo_proto_rawDescGZIP() []byte {
|
||||
file_idl_demo_demo_proto_rawDescOnce.Do(func() {
|
||||
file_idl_demo_demo_proto_rawDescData = protoimpl.X.CompressGZIP(file_idl_demo_demo_proto_rawDescData)
|
||||
})
|
||||
return file_idl_demo_demo_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_idl_demo_demo_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_idl_demo_demo_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_idl_demo_demo_proto_goTypes = []interface{}{
|
||||
(OurTeam)(0), // 0: demo.OurTeam
|
||||
(*StringMessage)(nil), // 1: demo.StringMessage
|
||||
}
|
||||
var file_idl_demo_demo_proto_depIdxs = []int32{
|
||||
1, // 0: demo.DemoService.Echo:input_type -> demo.StringMessage
|
||||
1, // 1: demo.DemoService.Echo:output_type -> demo.StringMessage
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_idl_demo_demo_proto_init() }
|
||||
func file_idl_demo_demo_proto_init() {
|
||||
if File_idl_demo_demo_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_idl_demo_demo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*StringMessage); 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_demo_demo_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_idl_demo_demo_proto_goTypes,
|
||||
DependencyIndexes: file_idl_demo_demo_proto_depIdxs,
|
||||
EnumInfos: file_idl_demo_demo_proto_enumTypes,
|
||||
MessageInfos: file_idl_demo_demo_proto_msgTypes,
|
||||
}.Build()
|
||||
File_idl_demo_demo_proto = out.File
|
||||
file_idl_demo_demo_proto_rawDesc = nil
|
||||
file_idl_demo_demo_proto_goTypes = nil
|
||||
file_idl_demo_demo_proto_depIdxs = nil
|
||||
}
|
|
@ -0,0 +1,167 @@
|
|||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: idl/demo/demo.proto
|
||||
|
||||
/*
|
||||
Package demo is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package demo
|
||||
|
||||
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_DemoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client DemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq StringMessage
|
||||
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.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_DemoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server DemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq StringMessage
|
||||
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.Echo(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterDemoServiceHandlerServer registers the http handlers for service DemoService to "mux".
|
||||
// UnaryRPC :call DemoServiceServer 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 RegisterDemoServiceHandlerFromEndpoint instead.
|
||||
func RegisterDemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DemoServiceServer) error {
|
||||
|
||||
mux.Handle("POST", pattern_DemoService_Echo_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)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/demo.DemoService/Echo")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_DemoService_Echo_0(rctx, 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_DemoService_Echo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterDemoServiceHandlerFromEndpoint is same as RegisterDemoServiceHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterDemoServiceHandlerFromEndpoint(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 RegisterDemoServiceHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterDemoServiceHandler registers the http handlers for service DemoService to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterDemoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterDemoServiceHandlerClient(ctx, mux, NewDemoServiceClient(conn))
|
||||
}
|
||||
|
||||
// RegisterDemoServiceHandlerClient registers the http handlers for service DemoService
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DemoServiceClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DemoServiceClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "DemoServiceClient" to call the correct interceptors.
|
||||
func RegisterDemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DemoServiceClient) error {
|
||||
|
||||
mux.Handle("POST", pattern_DemoService_Echo_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)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/demo.DemoService/Echo")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_DemoService_Echo_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_DemoService_Echo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_DemoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"apis", "demo"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_DemoService_Echo_0 = runtime.ForwardResponseMessage
|
||||
)
|
|
@ -0,0 +1,107 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc (unknown)
|
||||
// source: idl/demo/demo.proto
|
||||
|
||||
package demo
|
||||
|
||||
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
|
||||
|
||||
// DemoServiceClient is the client API for DemoService 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 DemoServiceClient interface {
|
||||
// Echo 样例接口
|
||||
Echo(ctx context.Context, in *StringMessage, opts ...grpc.CallOption) (*StringMessage, error)
|
||||
}
|
||||
|
||||
type demoServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewDemoServiceClient(cc grpc.ClientConnInterface) DemoServiceClient {
|
||||
return &demoServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *demoServiceClient) Echo(ctx context.Context, in *StringMessage, opts ...grpc.CallOption) (*StringMessage, error) {
|
||||
out := new(StringMessage)
|
||||
err := c.cc.Invoke(ctx, "/demo.DemoService/Echo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// DemoServiceServer is the server API for DemoService service.
|
||||
// All implementations must embed UnimplementedDemoServiceServer
|
||||
// for forward compatibility
|
||||
type DemoServiceServer interface {
|
||||
// Echo 样例接口
|
||||
Echo(context.Context, *StringMessage) (*StringMessage, error)
|
||||
mustEmbedUnimplementedDemoServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedDemoServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedDemoServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedDemoServiceServer) Echo(context.Context, *StringMessage) (*StringMessage, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented")
|
||||
}
|
||||
func (UnimplementedDemoServiceServer) mustEmbedUnimplementedDemoServiceServer() {}
|
||||
|
||||
// UnsafeDemoServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to DemoServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeDemoServiceServer interface {
|
||||
mustEmbedUnimplementedDemoServiceServer()
|
||||
}
|
||||
|
||||
func RegisterDemoServiceServer(s grpc.ServiceRegistrar, srv DemoServiceServer) {
|
||||
s.RegisterService(&DemoService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _DemoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(StringMessage)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DemoServiceServer).Echo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/demo.DemoService/Echo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DemoServiceServer).Echo(ctx, req.(*StringMessage))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// DemoService_ServiceDesc is the grpc.ServiceDesc for DemoService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var DemoService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "demo.DemoService",
|
||||
HandlerType: (*DemoServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Echo",
|
||||
Handler: _DemoService_Echo_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "idl/demo/demo.proto",
|
||||
}
|
|
@ -0,0 +1,776 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.0
|
||||
// protoc (unknown)
|
||||
// source: idl/pbecs/ecs.proto
|
||||
|
||||
package pbecs
|
||||
|
||||
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 EcsInstance 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
|
||||
InstanceId string `protobuf:"bytes,3,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"`
|
||||
// 实例名称
|
||||
InstanceName string `protobuf:"bytes,4,opt,name=instance_name,json=instanceName,proto3" json:"instance_name,omitempty"`
|
||||
// 地域,数据中心
|
||||
RegionName string `protobuf:"bytes,5,opt,name=region_name,json=regionName,proto3" json:"region_name,omitempty"`
|
||||
// 公网ip
|
||||
PublicIps []string `protobuf:"bytes,6,rep,name=public_ips,json=publicIps,proto3" json:"public_ips,omitempty"`
|
||||
// 实例类型
|
||||
InstanceType string `protobuf:"bytes,7,opt,name=instance_type,json=instanceType,proto3" json:"instance_type,omitempty"`
|
||||
// vcpu数
|
||||
Cpu int32 `protobuf:"varint,8,opt,name=cpu,proto3" json:"cpu,omitempty"`
|
||||
// 内存MB
|
||||
Memory int32 `protobuf:"varint,9,opt,name=memory,proto3" json:"memory,omitempty"`
|
||||
// 实例描述
|
||||
Description string `protobuf:"bytes,10,opt,name=description,proto3" json:"description,omitempty"`
|
||||
// 状态
|
||||
Status string `protobuf:"bytes,11,opt,name=status,proto3" json:"status,omitempty"`
|
||||
// 创建时间,ISO8601
|
||||
CreationTime string `protobuf:"bytes,12,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty"`
|
||||
// 过期时间
|
||||
ExpireTime string `protobuf:"bytes,13,opt,name=expire_time,json=expireTime,proto3" json:"expire_time,omitempty"`
|
||||
// 内网ip
|
||||
InnerIps []string `protobuf:"bytes,14,rep,name=inner_ips,json=innerIps,proto3" json:"inner_ips,omitempty"`
|
||||
// vcp id
|
||||
VpcId string `protobuf:"bytes,15,opt,name=vpc_id,json=vpcId,proto3" json:"vpc_id,omitempty"`
|
||||
// 资源组id
|
||||
ResourceGroupId string `protobuf:"bytes,16,opt,name=resource_group_id,json=resourceGroupId,proto3" json:"resource_group_id,omitempty"`
|
||||
// 收费类型
|
||||
ChargeType string `protobuf:"bytes,17,opt,name=charge_type,json=chargeType,proto3" json:"charge_type,omitempty"`
|
||||
}
|
||||
|
||||
func (x *EcsInstance) Reset() {
|
||||
*x = EcsInstance{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_idl_pbecs_ecs_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *EcsInstance) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*EcsInstance) ProtoMessage() {}
|
||||
|
||||
func (x *EcsInstance) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_idl_pbecs_ecs_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 EcsInstance.ProtoReflect.Descriptor instead.
|
||||
func (*EcsInstance) Descriptor() ([]byte, []int) {
|
||||
return file_idl_pbecs_ecs_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetProvider() pbtenant.CloudProvider {
|
||||
if x != nil {
|
||||
return x.Provider
|
||||
}
|
||||
return pbtenant.CloudProvider(0)
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetAccountName() string {
|
||||
if x != nil {
|
||||
return x.AccountName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetInstanceId() string {
|
||||
if x != nil {
|
||||
return x.InstanceId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetInstanceName() string {
|
||||
if x != nil {
|
||||
return x.InstanceName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetRegionName() string {
|
||||
if x != nil {
|
||||
return x.RegionName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetPublicIps() []string {
|
||||
if x != nil {
|
||||
return x.PublicIps
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetInstanceType() string {
|
||||
if x != nil {
|
||||
return x.InstanceType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetCpu() int32 {
|
||||
if x != nil {
|
||||
return x.Cpu
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetMemory() int32 {
|
||||
if x != nil {
|
||||
return x.Memory
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetStatus() string {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetCreationTime() string {
|
||||
if x != nil {
|
||||
return x.CreationTime
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetExpireTime() string {
|
||||
if x != nil {
|
||||
return x.ExpireTime
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetInnerIps() []string {
|
||||
if x != nil {
|
||||
return x.InnerIps
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetVpcId() string {
|
||||
if x != nil {
|
||||
return x.VpcId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetResourceGroupId() string {
|
||||
if x != nil {
|
||||
return x.ResourceGroupId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EcsInstance) GetChargeType() string {
|
||||
if x != nil {
|
||||
return x.ChargeType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ListDetailReq 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"`
|
||||
// 分页相关参数,页码
|
||||
PageNumber int32 `protobuf:"varint,4,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"`
|
||||
// 分页相关参数,每页数量
|
||||
PageSize int32 `protobuf:"varint,5,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
// 分页相关参数,下一页的token
|
||||
NextToken string `protobuf:"bytes,6,opt,name=next_token,json=nextToken,proto3" json:"next_token,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListDetailReq) Reset() {
|
||||
*x = ListDetailReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_idl_pbecs_ecs_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ListDetailReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListDetailReq) ProtoMessage() {}
|
||||
|
||||
func (x *ListDetailReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_idl_pbecs_ecs_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 ListDetailReq.ProtoReflect.Descriptor instead.
|
||||
func (*ListDetailReq) Descriptor() ([]byte, []int) {
|
||||
return file_idl_pbecs_ecs_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ListDetailReq) GetProvider() pbtenant.CloudProvider {
|
||||
if x != nil {
|
||||
return x.Provider
|
||||
}
|
||||
return pbtenant.CloudProvider(0)
|
||||
}
|
||||
|
||||
func (x *ListDetailReq) GetAccountName() string {
|
||||
if x != nil {
|
||||
return x.AccountName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListDetailReq) GetRegionId() int32 {
|
||||
if x != nil {
|
||||
return x.RegionId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ListDetailReq) GetPageNumber() int32 {
|
||||
if x != nil {
|
||||
return x.PageNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ListDetailReq) GetPageSize() int32 {
|
||||
if x != nil {
|
||||
return x.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ListDetailReq) GetNextToken() string {
|
||||
if x != nil {
|
||||
return x.NextToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ListDetailResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Ecs 机器集合
|
||||
Ecses []*EcsInstance `protobuf:"bytes,1,rep,name=ecses,proto3" json:"ecses,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 *ListDetailResp) Reset() {
|
||||
*x = ListDetailResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_idl_pbecs_ecs_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ListDetailResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListDetailResp) ProtoMessage() {}
|
||||
|
||||
func (x *ListDetailResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_idl_pbecs_ecs_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 ListDetailResp.ProtoReflect.Descriptor instead.
|
||||
func (*ListDetailResp) Descriptor() ([]byte, []int) {
|
||||
return file_idl_pbecs_ecs_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *ListDetailResp) GetEcses() []*EcsInstance {
|
||||
if x != nil {
|
||||
return x.Ecses
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ListDetailResp) GetFinished() bool {
|
||||
if x != nil {
|
||||
return x.Finished
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *ListDetailResp) GetPageNumber() int32 {
|
||||
if x != nil {
|
||||
return x.PageNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ListDetailResp) GetPageSize() int32 {
|
||||
if x != nil {
|
||||
return x.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ListDetailResp) GetNextToken() string {
|
||||
if x != nil {
|
||||
return x.NextToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListDetailResp) GetRequestId() string {
|
||||
if x != nil {
|
||||
return x.RequestId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ListReq 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 *ListReq) Reset() {
|
||||
*x = ListReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_idl_pbecs_ecs_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ListReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListReq) ProtoMessage() {}
|
||||
|
||||
func (x *ListReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_idl_pbecs_ecs_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 ListReq.ProtoReflect.Descriptor instead.
|
||||
func (*ListReq) Descriptor() ([]byte, []int) {
|
||||
return file_idl_pbecs_ecs_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *ListReq) GetProvider() pbtenant.CloudProvider {
|
||||
if x != nil {
|
||||
return x.Provider
|
||||
}
|
||||
return pbtenant.CloudProvider(0)
|
||||
}
|
||||
|
||||
type ListResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Ecs 机器集合
|
||||
Ecses []*EcsInstance `protobuf:"bytes,1,rep,name=ecses,proto3" json:"ecses,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListResp) Reset() {
|
||||
*x = ListResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_idl_pbecs_ecs_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ListResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListResp) ProtoMessage() {}
|
||||
|
||||
func (x *ListResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_idl_pbecs_ecs_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 ListResp.ProtoReflect.Descriptor instead.
|
||||
func (*ListResp) Descriptor() ([]byte, []int) {
|
||||
return file_idl_pbecs_ecs_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *ListResp) GetEcses() []*EcsInstance {
|
||||
if x != nil {
|
||||
return x.Ecses
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ListAllReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *ListAllReq) Reset() {
|
||||
*x = ListAllReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_idl_pbecs_ecs_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ListAllReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListAllReq) ProtoMessage() {}
|
||||
|
||||
func (x *ListAllReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_idl_pbecs_ecs_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 ListAllReq.ProtoReflect.Descriptor instead.
|
||||
func (*ListAllReq) Descriptor() ([]byte, []int) {
|
||||
return file_idl_pbecs_ecs_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
var File_idl_pbecs_ecs_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_idl_pbecs_ecs_proto_rawDesc = []byte{
|
||||
0x0a, 0x13, 0x69, 0x64, 0x6c, 0x2f, 0x70, 0x62, 0x65, 0x63, 0x73, 0x2f, 0x65, 0x63, 0x73, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x62, 0x65, 0x63, 0x73, 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, 0xbb, 0x04, 0x0a, 0x0b, 0x45, 0x63, 0x73, 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, 0x1f, 0x0a,
|
||||
0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x23,
|
||||
0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 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, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x69,
|
||||
0x70, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63,
|
||||
0x49, 0x70, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f,
|
||||
0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74,
|
||||
0x61, 0x6e, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18,
|
||||
0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65,
|
||||
0x6d, 0x6f, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f,
|
||||
0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0b,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x23, 0x0a, 0x0d,
|
||||
0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0c, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d,
|
||||
0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65,
|
||||
0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x70, 0x73, 0x18,
|
||||
0x0e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x49, 0x70, 0x73, 0x12,
|
||||
0x15, 0x0a, 0x06, 0x76, 0x70, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x05, 0x76, 0x70, 0x63, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
|
||||
0x63, 0x65, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70,
|
||||
0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70,
|
||||
0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x54,
|
||||
0x79, 0x70, 0x65, 0x22, 0xe1, 0x01, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 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, 0x1f, 0x0a, 0x0b, 0x70, 0x61,
|
||||
0x67, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 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, 0x05, 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, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x65,
|
||||
0x78, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xd2, 0x01, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74,
|
||||
0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x28, 0x0a, 0x05, 0x65, 0x63,
|
||||
0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x65, 0x63,
|
||||
0x73, 0x2e, 0x45, 0x63, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x65,
|
||||
0x63, 0x73, 0x65, 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, 0x3e, 0x0a, 0x07,
|
||||
0x4c, 0x69, 0x73, 0x74, 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, 0x34, 0x0a, 0x08,
|
||||
0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x28, 0x0a, 0x05, 0x65, 0x63, 0x73, 0x65,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x65, 0x63, 0x73, 0x2e,
|
||||
0x45, 0x63, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x65, 0x63, 0x73,
|
||||
0x65, 0x73, 0x22, 0x0c, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71,
|
||||
0x32, 0xf5, 0x01, 0x0a, 0x0a, 0x45, 0x63, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
|
||||
0x59, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x63, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c,
|
||||
0x12, 0x14, 0x2e, 0x70, 0x62, 0x65, 0x63, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x74,
|
||||
0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x62, 0x65, 0x63, 0x73, 0x2e, 0x4c,
|
||||
0x69, 0x73, 0x74, 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, 0x65, 0x63, 0x73,
|
||||
0x2f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x3a, 0x01, 0x2a, 0x12, 0x40, 0x0a, 0x07, 0x4c, 0x69,
|
||||
0x73, 0x74, 0x45, 0x63, 0x73, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x65, 0x63, 0x73, 0x2e, 0x4c, 0x69,
|
||||
0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x65, 0x63, 0x73, 0x2e, 0x4c, 0x69,
|
||||
0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, 0x09,
|
||||
0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x65, 0x63, 0x73, 0x3a, 0x01, 0x2a, 0x12, 0x4a, 0x0a, 0x0a,
|
||||
0x4c, 0x69, 0x73, 0x74, 0x45, 0x63, 0x73, 0x41, 0x6c, 0x6c, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x65,
|
||||
0x63, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e,
|
||||
0x70, 0x62, 0x65, 0x63, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x18,
|
||||
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x65, 0x63,
|
||||
0x73, 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, 0x65, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_idl_pbecs_ecs_proto_rawDescOnce sync.Once
|
||||
file_idl_pbecs_ecs_proto_rawDescData = file_idl_pbecs_ecs_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_idl_pbecs_ecs_proto_rawDescGZIP() []byte {
|
||||
file_idl_pbecs_ecs_proto_rawDescOnce.Do(func() {
|
||||
file_idl_pbecs_ecs_proto_rawDescData = protoimpl.X.CompressGZIP(file_idl_pbecs_ecs_proto_rawDescData)
|
||||
})
|
||||
return file_idl_pbecs_ecs_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_idl_pbecs_ecs_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_idl_pbecs_ecs_proto_goTypes = []interface{}{
|
||||
(*EcsInstance)(nil), // 0: pbecs.EcsInstance
|
||||
(*ListDetailReq)(nil), // 1: pbecs.ListDetailReq
|
||||
(*ListDetailResp)(nil), // 2: pbecs.ListDetailResp
|
||||
(*ListReq)(nil), // 3: pbecs.ListReq
|
||||
(*ListResp)(nil), // 4: pbecs.ListResp
|
||||
(*ListAllReq)(nil), // 5: pbecs.ListAllReq
|
||||
(pbtenant.CloudProvider)(0), // 6: pbtenant.CloudProvider
|
||||
}
|
||||
var file_idl_pbecs_ecs_proto_depIdxs = []int32{
|
||||
6, // 0: pbecs.EcsInstance.provider:type_name -> pbtenant.CloudProvider
|
||||
6, // 1: pbecs.ListDetailReq.provider:type_name -> pbtenant.CloudProvider
|
||||
0, // 2: pbecs.ListDetailResp.ecses:type_name -> pbecs.EcsInstance
|
||||
6, // 3: pbecs.ListReq.provider:type_name -> pbtenant.CloudProvider
|
||||
0, // 4: pbecs.ListResp.ecses:type_name -> pbecs.EcsInstance
|
||||
1, // 5: pbecs.EcsService.ListEcsDetail:input_type -> pbecs.ListDetailReq
|
||||
3, // 6: pbecs.EcsService.ListEcs:input_type -> pbecs.ListReq
|
||||
5, // 7: pbecs.EcsService.ListEcsAll:input_type -> pbecs.ListAllReq
|
||||
2, // 8: pbecs.EcsService.ListEcsDetail:output_type -> pbecs.ListDetailResp
|
||||
4, // 9: pbecs.EcsService.ListEcs:output_type -> pbecs.ListResp
|
||||
4, // 10: pbecs.EcsService.ListEcsAll:output_type -> pbecs.ListResp
|
||||
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_pbecs_ecs_proto_init() }
|
||||
func file_idl_pbecs_ecs_proto_init() {
|
||||
if File_idl_pbecs_ecs_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_idl_pbecs_ecs_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*EcsInstance); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_idl_pbecs_ecs_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListDetailReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_idl_pbecs_ecs_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListDetailResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_idl_pbecs_ecs_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_idl_pbecs_ecs_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_idl_pbecs_ecs_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListAllReq); 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_pbecs_ecs_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 6,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_idl_pbecs_ecs_proto_goTypes,
|
||||
DependencyIndexes: file_idl_pbecs_ecs_proto_depIdxs,
|
||||
MessageInfos: file_idl_pbecs_ecs_proto_msgTypes,
|
||||
}.Build()
|
||||
File_idl_pbecs_ecs_proto = out.File
|
||||
file_idl_pbecs_ecs_proto_rawDesc = nil
|
||||
file_idl_pbecs_ecs_proto_goTypes = nil
|
||||
file_idl_pbecs_ecs_proto_depIdxs = nil
|
||||
}
|
|
@ -0,0 +1,329 @@
|
|||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: idl/pbecs/ecs.proto
|
||||
|
||||
/*
|
||||
Package pbecs is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package pbecs
|
||||
|
||||
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_EcsService_ListEcsDetail_0(ctx context.Context, marshaler runtime.Marshaler, client EcsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListDetailReq
|
||||
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.ListEcsDetail(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_EcsService_ListEcsDetail_0(ctx context.Context, marshaler runtime.Marshaler, server EcsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListDetailReq
|
||||
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.ListEcsDetail(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_EcsService_ListEcs_0(ctx context.Context, marshaler runtime.Marshaler, client EcsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListReq
|
||||
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.ListEcs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_EcsService_ListEcs_0(ctx context.Context, marshaler runtime.Marshaler, server EcsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListReq
|
||||
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.ListEcs(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_EcsService_ListEcsAll_0(ctx context.Context, marshaler runtime.Marshaler, client EcsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListAllReq
|
||||
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.ListEcsAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_EcsService_ListEcsAll_0(ctx context.Context, marshaler runtime.Marshaler, server EcsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListAllReq
|
||||
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.ListEcsAll(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterEcsServiceHandlerServer registers the http handlers for service EcsService to "mux".
|
||||
// UnaryRPC :call EcsServiceServer 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 RegisterEcsServiceHandlerFromEndpoint instead.
|
||||
func RegisterEcsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EcsServiceServer) error {
|
||||
|
||||
mux.Handle("POST", pattern_EcsService_ListEcsDetail_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)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/ListEcsDetail")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_EcsService_ListEcsDetail_0(rctx, 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_EcsService_ListEcsDetail_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_EcsService_ListEcs_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)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/ListEcs")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_EcsService_ListEcs_0(rctx, 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_EcsService_ListEcs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_EcsService_ListEcsAll_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)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/ListEcsAll")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_EcsService_ListEcsAll_0(rctx, 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_EcsService_ListEcsAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterEcsServiceHandlerFromEndpoint is same as RegisterEcsServiceHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterEcsServiceHandlerFromEndpoint(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 RegisterEcsServiceHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterEcsServiceHandler registers the http handlers for service EcsService to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterEcsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterEcsServiceHandlerClient(ctx, mux, NewEcsServiceClient(conn))
|
||||
}
|
||||
|
||||
// RegisterEcsServiceHandlerClient registers the http handlers for service EcsService
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EcsServiceClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EcsServiceClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "EcsServiceClient" to call the correct interceptors.
|
||||
func RegisterEcsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EcsServiceClient) error {
|
||||
|
||||
mux.Handle("POST", pattern_EcsService_ListEcsDetail_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)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/ListEcsDetail")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_EcsService_ListEcsDetail_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_EcsService_ListEcsDetail_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_EcsService_ListEcs_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)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/ListEcs")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_EcsService_ListEcs_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_EcsService_ListEcs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_EcsService_ListEcsAll_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)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/ListEcsAll")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_EcsService_ListEcsAll_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_EcsService_ListEcsAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_EcsService_ListEcsDetail_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "ecs", "detail"}, ""))
|
||||
|
||||
pattern_EcsService_ListEcs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"apis", "ecs"}, ""))
|
||||
|
||||
pattern_EcsService_ListEcsAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "ecs", "all"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_EcsService_ListEcsDetail_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_EcsService_ListEcs_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_EcsService_ListEcsAll_0 = runtime.ForwardResponseMessage
|
||||
)
|
|
@ -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/pbecs/ecs.proto
|
||||
|
||||
package pbecs
|
||||
|
||||
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
|
||||
|
||||
// EcsServiceClient is the client API for EcsService 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 EcsServiceClient interface {
|
||||
// 查询ECS明细 - 支持云类型、区域、账户、分页等过滤条件
|
||||
ListEcsDetail(ctx context.Context, in *ListDetailReq, opts ...grpc.CallOption) (*ListDetailResp, error)
|
||||
// 查询ECS全量 - 根据云类型
|
||||
ListEcs(ctx context.Context, in *ListReq, opts ...grpc.CallOption) (*ListResp, error)
|
||||
// 查询所有云的ECS
|
||||
ListEcsAll(ctx context.Context, in *ListAllReq, opts ...grpc.CallOption) (*ListResp, error)
|
||||
}
|
||||
|
||||
type ecsServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewEcsServiceClient(cc grpc.ClientConnInterface) EcsServiceClient {
|
||||
return &ecsServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *ecsServiceClient) ListEcsDetail(ctx context.Context, in *ListDetailReq, opts ...grpc.CallOption) (*ListDetailResp, error) {
|
||||
out := new(ListDetailResp)
|
||||
err := c.cc.Invoke(ctx, "/pbecs.EcsService/ListEcsDetail", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *ecsServiceClient) ListEcs(ctx context.Context, in *ListReq, opts ...grpc.CallOption) (*ListResp, error) {
|
||||
out := new(ListResp)
|
||||
err := c.cc.Invoke(ctx, "/pbecs.EcsService/ListEcs", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *ecsServiceClient) ListEcsAll(ctx context.Context, in *ListAllReq, opts ...grpc.CallOption) (*ListResp, error) {
|
||||
out := new(ListResp)
|
||||
err := c.cc.Invoke(ctx, "/pbecs.EcsService/ListEcsAll", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// EcsServiceServer is the server API for EcsService service.
|
||||
// All implementations must embed UnimplementedEcsServiceServer
|
||||
// for forward compatibility
|
||||
type EcsServiceServer interface {
|
||||
// 查询ECS明细 - 支持云类型、区域、账户、分页等过滤条件
|
||||
ListEcsDetail(context.Context, *ListDetailReq) (*ListDetailResp, error)
|
||||
// 查询ECS全量 - 根据云类型
|
||||
ListEcs(context.Context, *ListReq) (*ListResp, error)
|
||||
// 查询所有云的ECS
|
||||
ListEcsAll(context.Context, *ListAllReq) (*ListResp, error)
|
||||
mustEmbedUnimplementedEcsServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedEcsServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedEcsServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedEcsServiceServer) ListEcsDetail(context.Context, *ListDetailReq) (*ListDetailResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListEcsDetail not implemented")
|
||||
}
|
||||
func (UnimplementedEcsServiceServer) ListEcs(context.Context, *ListReq) (*ListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListEcs not implemented")
|
||||
}
|
||||
func (UnimplementedEcsServiceServer) ListEcsAll(context.Context, *ListAllReq) (*ListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListEcsAll not implemented")
|
||||
}
|
||||
func (UnimplementedEcsServiceServer) mustEmbedUnimplementedEcsServiceServer() {}
|
||||
|
||||
// UnsafeEcsServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to EcsServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeEcsServiceServer interface {
|
||||
mustEmbedUnimplementedEcsServiceServer()
|
||||
}
|
||||
|
||||
func RegisterEcsServiceServer(s grpc.ServiceRegistrar, srv EcsServiceServer) {
|
||||
s.RegisterService(&EcsService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _EcsService_ListEcsDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListDetailReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(EcsServiceServer).ListEcsDetail(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pbecs.EcsService/ListEcsDetail",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(EcsServiceServer).ListEcsDetail(ctx, req.(*ListDetailReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _EcsService_ListEcs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(EcsServiceServer).ListEcs(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pbecs.EcsService/ListEcs",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(EcsServiceServer).ListEcs(ctx, req.(*ListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _EcsService_ListEcsAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListAllReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(EcsServiceServer).ListEcsAll(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pbecs.EcsService/ListEcsAll",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(EcsServiceServer).ListEcsAll(ctx, req.(*ListAllReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// EcsService_ServiceDesc is the grpc.ServiceDesc for EcsService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var EcsService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pbecs.EcsService",
|
||||
HandlerType: (*EcsServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListEcsDetail",
|
||||
Handler: _EcsService_ListEcsDetail_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListEcs",
|
||||
Handler: _EcsService_ListEcs_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListEcsAll",
|
||||
Handler: _EcsService_ListEcsAll_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "idl/pbecs/ecs.proto",
|
||||
}
|
|
@ -0,0 +1,896 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.0
|
||||
// protoc (unknown)
|
||||
// source: idl/pbtenant/tenant.proto
|
||||
|
||||
package pbtenant
|
||||
|
||||
import (
|
||||
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
|
||||
_ "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 CloudProvider int32
|
||||
|
||||
const (
|
||||
// 0 - 阿里云
|
||||
CloudProvider_ali CloudProvider = 0
|
||||
// 1 - 腾讯云
|
||||
CloudProvider_tencent CloudProvider = 1
|
||||
// 2 - 华为云
|
||||
CloudProvider_huawei CloudProvider = 2
|
||||
// 3 - 亚马逊云
|
||||
CloudProvider_aws CloudProvider = 3
|
||||
)
|
||||
|
||||
// Enum value maps for CloudProvider.
|
||||
var (
|
||||
CloudProvider_name = map[int32]string{
|
||||
0: "ali",
|
||||
1: "tencent",
|
||||
2: "huawei",
|
||||
3: "aws",
|
||||
}
|
||||
CloudProvider_value = map[string]int32{
|
||||
"ali": 0,
|
||||
"tencent": 1,
|
||||
"huawei": 2,
|
||||
"aws": 3,
|
||||
}
|
||||
)
|
||||
|
||||
func (x CloudProvider) Enum() *CloudProvider {
|
||||
p := new(CloudProvider)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x CloudProvider) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (CloudProvider) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_idl_pbtenant_tenant_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (CloudProvider) Type() protoreflect.EnumType {
|
||||
return &file_idl_pbtenant_tenant_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x CloudProvider) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CloudProvider.Descriptor instead.
|
||||
func (CloudProvider) EnumDescriptor() ([]byte, []int) {
|
||||
return file_idl_pbtenant_tenant_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
// 云产品
|
||||
type CloudProduct int32
|
||||
|
||||
const (
|
||||
// 0 - 所有产品
|
||||
CloudProduct_product_all CloudProduct = 0
|
||||
// 1 - ECS类产品:阿里云ECS,腾讯云CVM,华为云ECS,亚马逊EC2
|
||||
CloudProduct_product_ecs CloudProduct = 1
|
||||
// 2 - RDS类产品:阿里云RDS,腾讯云CDB
|
||||
CloudProduct_product_rds CloudProduct = 2
|
||||
// 3 - Domain类产品:阿里云Domain
|
||||
CloudProduct_product_domain CloudProduct = 3
|
||||
// 4 - OSS类产品:阿里云OSS
|
||||
CloudProduct_product_oss CloudProduct = 4
|
||||
)
|
||||
|
||||
// Enum value maps for CloudProduct.
|
||||
var (
|
||||
CloudProduct_name = map[int32]string{
|
||||
0: "product_all",
|
||||
1: "product_ecs",
|
||||
2: "product_rds",
|
||||
3: "product_domain",
|
||||
4: "product_oss",
|
||||
}
|
||||
CloudProduct_value = map[string]int32{
|
||||
"product_all": 0,
|
||||
"product_ecs": 1,
|
||||
"product_rds": 2,
|
||||
"product_domain": 3,
|
||||
"product_oss": 4,
|
||||
}
|
||||
)
|
||||
|
||||
func (x CloudProduct) Enum() *CloudProduct {
|
||||
p := new(CloudProduct)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x CloudProduct) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (CloudProduct) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_idl_pbtenant_tenant_proto_enumTypes[1].Descriptor()
|
||||
}
|
||||
|
||||
func (CloudProduct) Type() protoreflect.EnumType {
|
||||
return &file_idl_pbtenant_tenant_proto_enumTypes[1]
|
||||
}
|
||||
|
||||
func (x CloudProduct) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CloudProduct.Descriptor instead.
|
||||
func (CloudProduct) EnumDescriptor() ([]byte, []int) {
|
||||
return file_idl_pbtenant_tenant_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
// 阿里云区域,需要将对应的 _ 转化为 -
|
||||
type AliRegionId int32
|
||||
|
||||
const (
|
||||
AliRegionId_ali_all AliRegionId = 0
|
||||
AliRegionId_ali_cn_qingdao AliRegionId = 1 // 青岛
|
||||
AliRegionId_ali_cn_beijing AliRegionId = 2 // 北京
|
||||
AliRegionId_ali_cn_zhangjiakou AliRegionId = 3 // 张家口
|
||||
AliRegionId_ali_cn_huhehaote AliRegionId = 4 // 呼和浩特
|
||||
AliRegionId_ali_cn_wulanchabu AliRegionId = 5 // 乌兰察布
|
||||
AliRegionId_ali_cn_hangzhou AliRegionId = 6 // 杭州
|
||||
AliRegionId_ali_cn_shanghai AliRegionId = 7 // 上海
|
||||
AliRegionId_ali_cn_shenzhen AliRegionId = 8 // 深圳
|
||||
AliRegionId_ali_cn_heyuan AliRegionId = 9 // 河源
|
||||
AliRegionId_ali_cn_guangzhou AliRegionId = 10 // 广州
|
||||
AliRegionId_ali_cn_chengdu AliRegionId = 11 // 成都
|
||||
AliRegionId_ali_cn_hongkong AliRegionId = 12 // 中国香港-香港
|
||||
AliRegionId_ali_ap_southeast_1 AliRegionId = 13 // 亚太东南1-新加坡
|
||||
AliRegionId_ali_ap_southeast_2 AliRegionId = 14 // 亚太东南2-悉尼
|
||||
AliRegionId_ali_ap_southeast_3 AliRegionId = 15 // 亚太东南3-吉隆坡
|
||||
AliRegionId_ali_ap_southeast_5 AliRegionId = 16 // 亚太东南5-雅加达
|
||||
AliRegionId_ali_ap_south_1 AliRegionId = 17 // 亚太南部1-孟买
|
||||
AliRegionId_ali_ap_northeast_1 AliRegionId = 18 // 亚太东北1-东京
|
||||
AliRegionId_ali_us_west_1 AliRegionId = 19 // 美国西部1-硅谷
|
||||
AliRegionId_ali_us_east_1 AliRegionId = 20 // 美国东部1-弗吉尼亚
|
||||
AliRegionId_ali_eu_central_1 AliRegionId = 21 // 欧洲中部1-法兰克福
|
||||
AliRegionId_ali_eu_west_1 AliRegionId = 22 // 英国(伦敦)-伦敦
|
||||
AliRegionId_ali_me_east_1 AliRegionId = 23 // 中东东部1-迪拜
|
||||
)
|
||||
|
||||
// Enum value maps for AliRegionId.
|
||||
var (
|
||||
AliRegionId_name = map[int32]string{
|
||||
0: "ali_all",
|
||||
1: "ali_cn_qingdao",
|
||||
2: "ali_cn_beijing",
|
||||
3: "ali_cn_zhangjiakou",
|
||||
4: "ali_cn_huhehaote",
|
||||
5: "ali_cn_wulanchabu",
|
||||
6: "ali_cn_hangzhou",
|
||||
7: "ali_cn_shanghai",
|
||||
8: "ali_cn_shenzhen",
|
||||
9: "ali_cn_heyuan",
|
||||
10: "ali_cn_guangzhou",
|
||||
11: "ali_cn_chengdu",
|
||||
12: "ali_cn_hongkong",
|
||||
13: "ali_ap_southeast_1",
|
||||
14: "ali_ap_southeast_2",
|
||||
15: "ali_ap_southeast_3",
|
||||
16: "ali_ap_southeast_5",
|
||||
17: "ali_ap_south_1",
|
||||
18: "ali_ap_northeast_1",
|
||||
19: "ali_us_west_1",
|
||||
20: "ali_us_east_1",
|
||||
21: "ali_eu_central_1",
|
||||
22: "ali_eu_west_1",
|
||||
23: "ali_me_east_1",
|
||||
}
|
||||
AliRegionId_value = map[string]int32{
|
||||
"ali_all": 0,
|
||||
"ali_cn_qingdao": 1,
|
||||
"ali_cn_beijing": 2,
|
||||
"ali_cn_zhangjiakou": 3,
|
||||
"ali_cn_huhehaote": 4,
|
||||
"ali_cn_wulanchabu": 5,
|
||||
"ali_cn_hangzhou": 6,
|
||||
"ali_cn_shanghai": 7,
|
||||
"ali_cn_shenzhen": 8,
|
||||
"ali_cn_heyuan": 9,
|
||||
"ali_cn_guangzhou": 10,
|
||||
"ali_cn_chengdu": 11,
|
||||
"ali_cn_hongkong": 12,
|
||||
"ali_ap_southeast_1": 13,
|
||||
"ali_ap_southeast_2": 14,
|
||||
"ali_ap_southeast_3": 15,
|
||||
"ali_ap_southeast_5": 16,
|
||||
"ali_ap_south_1": 17,
|
||||
"ali_ap_northeast_1": 18,
|
||||
"ali_us_west_1": 19,
|
||||
"ali_us_east_1": 20,
|
||||
"ali_eu_central_1": 21,
|
||||
"ali_eu_west_1": 22,
|
||||
"ali_me_east_1": 23,
|
||||
}
|
||||
)
|
||||
|
||||
func (x AliRegionId) Enum() *AliRegionId {
|
||||
p := new(AliRegionId)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x AliRegionId) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (AliRegionId) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_idl_pbtenant_tenant_proto_enumTypes[2].Descriptor()
|
||||
}
|
||||
|
||||
func (AliRegionId) Type() protoreflect.EnumType {
|
||||
return &file_idl_pbtenant_tenant_proto_enumTypes[2]
|
||||
}
|
||||
|
||||
func (x AliRegionId) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AliRegionId.Descriptor instead.
|
||||
func (AliRegionId) EnumDescriptor() ([]byte, []int) {
|
||||
return file_idl_pbtenant_tenant_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
// 腾讯云区域,需要将对应的 _ 转化为 -
|
||||
type TencentRegionId int32
|
||||
|
||||
const (
|
||||
TencentRegionId_tc_all TencentRegionId = 0
|
||||
TencentRegionId_tc_ap_bangkok TencentRegionId = 1 // 曼谷
|
||||
TencentRegionId_tc_ap_beijing TencentRegionId = 2 // 北京
|
||||
TencentRegionId_tc_ap_chengdu TencentRegionId = 3 // 成都
|
||||
TencentRegionId_tc_ap_chongqing TencentRegionId = 4 // 重庆
|
||||
TencentRegionId_tc_ap_guangzhou TencentRegionId = 5 // 广州
|
||||
TencentRegionId_tc_ap_guangzhou_open TencentRegionId = 6 // 广州Open
|
||||
TencentRegionId_tc_ap_hongkong TencentRegionId = 7 // 中国香港
|
||||
TencentRegionId_tc_ap_mumbai TencentRegionId = 8 // 孟买
|
||||
TencentRegionId_tc_ap_seoul TencentRegionId = 9 // 首尔
|
||||
TencentRegionId_tc_ap_shanghai TencentRegionId = 10 // 上海
|
||||
TencentRegionId_tc_ap_shanghai_fsi TencentRegionId = 11 // 上海金融
|
||||
TencentRegionId_tc_ap_shenzhen_fsi TencentRegionId = 12 // 深圳金融
|
||||
TencentRegionId_tc_ap_singapore TencentRegionId = 13 // 新加坡
|
||||
TencentRegionId_tc_ap_tokyo TencentRegionId = 14 // 东京
|
||||
TencentRegionId_tc_eu_frankfurt TencentRegionId = 15 // 法兰克福
|
||||
TencentRegionId_tc_eu_moscow TencentRegionId = 16 // 莫斯科
|
||||
TencentRegionId_tc_na_ashburn TencentRegionId = 17 // 阿什本
|
||||
TencentRegionId_tc_na_siliconvalley TencentRegionId = 18 // 硅谷
|
||||
TencentRegionId_tc_na_toronto TencentRegionId = 19 // 多伦多
|
||||
)
|
||||
|
||||
// Enum value maps for TencentRegionId.
|
||||
var (
|
||||
TencentRegionId_name = map[int32]string{
|
||||
0: "tc_all",
|
||||
1: "tc_ap_bangkok",
|
||||
2: "tc_ap_beijing",
|
||||
3: "tc_ap_chengdu",
|
||||
4: "tc_ap_chongqing",
|
||||
5: "tc_ap_guangzhou",
|
||||
6: "tc_ap_guangzhou_open",
|
||||
7: "tc_ap_hongkong",
|
||||
8: "tc_ap_mumbai",
|
||||
9: "tc_ap_seoul",
|
||||
10: "tc_ap_shanghai",
|
||||
11: "tc_ap_shanghai_fsi",
|
||||
12: "tc_ap_shenzhen_fsi",
|
||||
13: "tc_ap_singapore",
|
||||
14: "tc_ap_tokyo",
|
||||
15: "tc_eu_frankfurt",
|
||||
16: "tc_eu_moscow",
|
||||
17: "tc_na_ashburn",
|
||||
18: "tc_na_siliconvalley",
|
||||
19: "tc_na_toronto",
|
||||
}
|
||||
TencentRegionId_value = map[string]int32{
|
||||
"tc_all": 0,
|
||||
"tc_ap_bangkok": 1,
|
||||
"tc_ap_beijing": 2,
|
||||
"tc_ap_chengdu": 3,
|
||||
"tc_ap_chongqing": 4,
|
||||
"tc_ap_guangzhou": 5,
|
||||
"tc_ap_guangzhou_open": 6,
|
||||
"tc_ap_hongkong": 7,
|
||||
"tc_ap_mumbai": 8,
|
||||
"tc_ap_seoul": 9,
|
||||
"tc_ap_shanghai": 10,
|
||||
"tc_ap_shanghai_fsi": 11,
|
||||
"tc_ap_shenzhen_fsi": 12,
|
||||
"tc_ap_singapore": 13,
|
||||
"tc_ap_tokyo": 14,
|
||||
"tc_eu_frankfurt": 15,
|
||||
"tc_eu_moscow": 16,
|
||||
"tc_na_ashburn": 17,
|
||||
"tc_na_siliconvalley": 18,
|
||||
"tc_na_toronto": 19,
|
||||
}
|
||||
)
|
||||
|
||||
func (x TencentRegionId) Enum() *TencentRegionId {
|
||||
p := new(TencentRegionId)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x TencentRegionId) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (TencentRegionId) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_idl_pbtenant_tenant_proto_enumTypes[3].Descriptor()
|
||||
}
|
||||
|
||||
func (TencentRegionId) Type() protoreflect.EnumType {
|
||||
return &file_idl_pbtenant_tenant_proto_enumTypes[3]
|
||||
}
|
||||
|
||||
func (x TencentRegionId) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use TencentRegionId.Descriptor instead.
|
||||
func (TencentRegionId) EnumDescriptor() ([]byte, []int) {
|
||||
return file_idl_pbtenant_tenant_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
// 华为云区域,需要将对应的 _ 转化为 -
|
||||
type HuaweiRegionId int32
|
||||
|
||||
const (
|
||||
HuaweiRegionId_hw_all HuaweiRegionId = 0
|
||||
HuaweiRegionId_hw_cn_north_1 HuaweiRegionId = 1
|
||||
HuaweiRegionId_hw_cn_north_4 HuaweiRegionId = 2
|
||||
HuaweiRegionId_hw_cn_south_1 HuaweiRegionId = 3
|
||||
HuaweiRegionId_hw_cn_east_2 HuaweiRegionId = 4
|
||||
HuaweiRegionId_hw_cn_east_3 HuaweiRegionId = 5
|
||||
HuaweiRegionId_hw_cn_southwest_2 HuaweiRegionId = 6
|
||||
HuaweiRegionId_hw_ap_southeast_1 HuaweiRegionId = 7
|
||||
HuaweiRegionId_hw_ap_southeast_2 HuaweiRegionId = 8
|
||||
HuaweiRegionId_hw_ap_southeast_3 HuaweiRegionId = 9
|
||||
HuaweiRegionId_hw_af_south_1 HuaweiRegionId = 10
|
||||
)
|
||||
|
||||
// Enum value maps for HuaweiRegionId.
|
||||
var (
|
||||
HuaweiRegionId_name = map[int32]string{
|
||||
0: "hw_all",
|
||||
1: "hw_cn_north_1",
|
||||
2: "hw_cn_north_4",
|
||||
3: "hw_cn_south_1",
|
||||
4: "hw_cn_east_2",
|
||||
5: "hw_cn_east_3",
|
||||
6: "hw_cn_southwest_2",
|
||||
7: "hw_ap_southeast_1",
|
||||
8: "hw_ap_southeast_2",
|
||||
9: "hw_ap_southeast_3",
|
||||
10: "hw_af_south_1",
|
||||
}
|
||||
HuaweiRegionId_value = map[string]int32{
|
||||
"hw_all": 0,
|
||||
"hw_cn_north_1": 1,
|
||||
"hw_cn_north_4": 2,
|
||||
"hw_cn_south_1": 3,
|
||||
"hw_cn_east_2": 4,
|
||||
"hw_cn_east_3": 5,
|
||||
"hw_cn_southwest_2": 6,
|
||||
"hw_ap_southeast_1": 7,
|
||||
"hw_ap_southeast_2": 8,
|
||||
"hw_ap_southeast_3": 9,
|
||||
"hw_af_south_1": 10,
|
||||
}
|
||||
)
|
||||
|
||||
func (x HuaweiRegionId) Enum() *HuaweiRegionId {
|
||||
p := new(HuaweiRegionId)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x HuaweiRegionId) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (HuaweiRegionId) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_idl_pbtenant_tenant_proto_enumTypes[4].Descriptor()
|
||||
}
|
||||
|
||||
func (HuaweiRegionId) Type() protoreflect.EnumType {
|
||||
return &file_idl_pbtenant_tenant_proto_enumTypes[4]
|
||||
}
|
||||
|
||||
func (x HuaweiRegionId) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use HuaweiRegionId.Descriptor instead.
|
||||
func (HuaweiRegionId) EnumDescriptor() ([]byte, []int) {
|
||||
return file_idl_pbtenant_tenant_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
// 亚马逊云区域,需要将对应的 _ 转化为 -
|
||||
type AwsRegionId int32
|
||||
|
||||
const (
|
||||
AwsRegionId_aws_all AwsRegionId = 0
|
||||
AwsRegionId_aws_us_east_2 AwsRegionId = 1 // US East (Ohio)
|
||||
AwsRegionId_aws_us_east_1 AwsRegionId = 2 // US East (N. Virginia)
|
||||
AwsRegionId_aws_us_west_1 AwsRegionId = 3 // US West (N. California)
|
||||
AwsRegionId_aws_us_west_2 AwsRegionId = 4 // US West (Oregon)
|
||||
AwsRegionId_aws_af_south_1 AwsRegionId = 5 // Africa (Cape Town)
|
||||
AwsRegionId_aws_ap_east_1 AwsRegionId = 6 // Asia Pacific (Hong Kong)
|
||||
AwsRegionId_aws_ap_south_1 AwsRegionId = 7 // Asia Pacific (Mumbai)
|
||||
AwsRegionId_aws_ap_northeast_3 AwsRegionId = 8 // Asia Pacific (Osaka)
|
||||
AwsRegionId_aws_ap_northeast_2 AwsRegionId = 9 // Asia Pacific (Seoul)
|
||||
AwsRegionId_aws_ap_northeast_1 AwsRegionId = 10 // Asia Pacific (Singapore)
|
||||
AwsRegionId_aws_ap_southeast_2 AwsRegionId = 11 // Asia Pacific (Sydney)
|
||||
AwsRegionId_aws_ap_southeast_1 AwsRegionId = 12 // Asia Pacific (Tokyo)
|
||||
AwsRegionId_aws_ca_central_1 AwsRegionId = 13 // Canada (Central)
|
||||
AwsRegionId_aws_eu_central_1 AwsRegionId = 14 // Europe (Frankfurt)
|
||||
AwsRegionId_aws_eu_west_1 AwsRegionId = 15 // Europe (Ireland)
|
||||
AwsRegionId_aws_eu_west_2 AwsRegionId = 16 // Europe (London)
|
||||
AwsRegionId_aws_eu_south_1 AwsRegionId = 17 // Europe (Milan)
|
||||
AwsRegionId_aws_eu_west_3 AwsRegionId = 18 // Europe (Paris)
|
||||
AwsRegionId_aws_eu_north_1 AwsRegionId = 19 // Europe (Stockholm)
|
||||
AwsRegionId_aws_me_south_1 AwsRegionId = 20 // Middle East (Bahrain)
|
||||
AwsRegionId_aws_sa_east_1 AwsRegionId = 21 // South America (São Paulo)
|
||||
)
|
||||
|
||||
// Enum value maps for AwsRegionId.
|
||||
var (
|
||||
AwsRegionId_name = map[int32]string{
|
||||
0: "aws_all",
|
||||
1: "aws_us_east_2",
|
||||
2: "aws_us_east_1",
|
||||
3: "aws_us_west_1",
|
||||
4: "aws_us_west_2",
|
||||
5: "aws_af_south_1",
|
||||
6: "aws_ap_east_1",
|
||||
7: "aws_ap_south_1",
|
||||
8: "aws_ap_northeast_3",
|
||||
9: "aws_ap_northeast_2",
|
||||
10: "aws_ap_northeast_1",
|
||||
11: "aws_ap_southeast_2",
|
||||
12: "aws_ap_southeast_1",
|
||||
13: "aws_ca_central_1",
|
||||
14: "aws_eu_central_1",
|
||||
15: "aws_eu_west_1",
|
||||
16: "aws_eu_west_2",
|
||||
17: "aws_eu_south_1",
|
||||
18: "aws_eu_west_3",
|
||||
19: "aws_eu_north_1",
|
||||
20: "aws_me_south_1",
|
||||
21: "aws_sa_east_1",
|
||||
}
|
||||
AwsRegionId_value = map[string]int32{
|
||||
"aws_all": 0,
|
||||
"aws_us_east_2": 1,
|
||||
"aws_us_east_1": 2,
|
||||
"aws_us_west_1": 3,
|
||||
"aws_us_west_2": 4,
|
||||
"aws_af_south_1": 5,
|
||||
"aws_ap_east_1": 6,
|
||||
"aws_ap_south_1": 7,
|
||||
"aws_ap_northeast_3": 8,
|
||||
"aws_ap_northeast_2": 9,
|
||||
"aws_ap_northeast_1": 10,
|
||||
"aws_ap_southeast_2": 11,
|
||||
"aws_ap_southeast_1": 12,
|
||||
"aws_ca_central_1": 13,
|
||||
"aws_eu_central_1": 14,
|
||||
"aws_eu_west_1": 15,
|
||||
"aws_eu_west_2": 16,
|
||||
"aws_eu_south_1": 17,
|
||||
"aws_eu_west_3": 18,
|
||||
"aws_eu_north_1": 19,
|
||||
"aws_me_south_1": 20,
|
||||
"aws_sa_east_1": 21,
|
||||
}
|
||||
)
|
||||
|
||||
func (x AwsRegionId) Enum() *AwsRegionId {
|
||||
p := new(AwsRegionId)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x AwsRegionId) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (AwsRegionId) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_idl_pbtenant_tenant_proto_enumTypes[5].Descriptor()
|
||||
}
|
||||
|
||||
func (AwsRegionId) Type() protoreflect.EnumType {
|
||||
return &file_idl_pbtenant_tenant_proto_enumTypes[5]
|
||||
}
|
||||
|
||||
func (x AwsRegionId) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AwsRegionId.Descriptor instead.
|
||||
func (AwsRegionId) EnumDescriptor() ([]byte, []int) {
|
||||
return file_idl_pbtenant_tenant_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
// 云配置信息
|
||||
type CloudConfigs struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// 云配置
|
||||
Configs []*CloudConfig `protobuf:"bytes,1,rep,name=configs,proto3" json:"configs,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CloudConfigs) Reset() {
|
||||
*x = CloudConfigs{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_idl_pbtenant_tenant_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CloudConfigs) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CloudConfigs) ProtoMessage() {}
|
||||
|
||||
func (x *CloudConfigs) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_idl_pbtenant_tenant_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 CloudConfigs.ProtoReflect.Descriptor instead.
|
||||
func (*CloudConfigs) Descriptor() ([]byte, []int) {
|
||||
return file_idl_pbtenant_tenant_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *CloudConfigs) GetConfigs() []*CloudConfig {
|
||||
if x != nil {
|
||||
return x.Configs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CloudConfig struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// 云服务提供商,具体参考 CloudProvider 的定义
|
||||
Provider CloudProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=pbtenant.CloudProvider" json:"provider,omitempty"`
|
||||
// 账户名称,由用户自定义,必须全局唯一,方便多个系统之间的维护
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// 认证方式1:与 access_secret 结合使用,两者均非空时生效
|
||||
AccessId string `protobuf:"bytes,3,opt,name=access_id,json=accessId,proto3" json:"access_id,omitempty"`
|
||||
// 认证方式1:与 access_id 结合使用,两者均非空时生效
|
||||
AccessSecret string `protobuf:"bytes,4,opt,name=access_secret,json=accessSecret,proto3" json:"access_secret,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CloudConfig) Reset() {
|
||||
*x = CloudConfig{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_idl_pbtenant_tenant_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CloudConfig) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CloudConfig) ProtoMessage() {}
|
||||
|
||||
func (x *CloudConfig) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_idl_pbtenant_tenant_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 CloudConfig.ProtoReflect.Descriptor instead.
|
||||
func (*CloudConfig) Descriptor() ([]byte, []int) {
|
||||
return file_idl_pbtenant_tenant_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *CloudConfig) GetProvider() CloudProvider {
|
||||
if x != nil {
|
||||
return x.Provider
|
||||
}
|
||||
return CloudProvider_ali
|
||||
}
|
||||
|
||||
func (x *CloudConfig) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CloudConfig) GetAccessId() string {
|
||||
if x != nil {
|
||||
return x.AccessId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CloudConfig) GetAccessSecret() string {
|
||||
if x != nil {
|
||||
return x.AccessSecret
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_idl_pbtenant_tenant_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_idl_pbtenant_tenant_proto_rawDesc = []byte{
|
||||
0x0a, 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, 0x12, 0x08, 0x70, 0x62, 0x74,
|
||||
0x65, 0x6e, 0x61, 0x6e, 0x74, 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, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d,
|
||||
0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x22, 0x3f, 0x0a, 0x0c, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x43, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x67, 0x73, 0x12, 0x2f, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x01,
|
||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2e,
|
||||
0x43, 0x6c, 0x6f, 0x75, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x69, 0x67, 0x73, 0x22, 0x98, 0x01, 0x0a, 0x0b, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x43, 0x6f,
|
||||
0x6e, 0x66, 0x69, 0x67, 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, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a,
|
||||
0x09, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x63,
|
||||
0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x2a,
|
||||
0x3a, 0x0a, 0x0d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72,
|
||||
0x12, 0x07, 0x0a, 0x03, 0x61, 0x6c, 0x69, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x74, 0x65, 0x6e,
|
||||
0x63, 0x65, 0x6e, 0x74, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x68, 0x75, 0x61, 0x77, 0x65, 0x69,
|
||||
0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x61, 0x77, 0x73, 0x10, 0x03, 0x2a, 0x66, 0x0a, 0x0c, 0x43,
|
||||
0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x0f, 0x0a, 0x0b, 0x70,
|
||||
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x61, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b,
|
||||
0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x65, 0x63, 0x73, 0x10, 0x01, 0x12, 0x0f, 0x0a,
|
||||
0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x72, 0x64, 0x73, 0x10, 0x02, 0x12, 0x12,
|
||||
0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
|
||||
0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6f, 0x73,
|
||||
0x73, 0x10, 0x04, 0x2a, 0x86, 0x04, 0x0a, 0x0b, 0x41, 0x6c, 0x69, 0x52, 0x65, 0x67, 0x69, 0x6f,
|
||||
0x6e, 0x49, 0x64, 0x12, 0x0b, 0x0a, 0x07, 0x61, 0x6c, 0x69, 0x5f, 0x61, 0x6c, 0x6c, 0x10, 0x00,
|
||||
0x12, 0x12, 0x0a, 0x0e, 0x61, 0x6c, 0x69, 0x5f, 0x63, 0x6e, 0x5f, 0x71, 0x69, 0x6e, 0x67, 0x64,
|
||||
0x61, 0x6f, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x61, 0x6c, 0x69, 0x5f, 0x63, 0x6e, 0x5f, 0x62,
|
||||
0x65, 0x69, 0x6a, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x61, 0x6c, 0x69, 0x5f,
|
||||
0x63, 0x6e, 0x5f, 0x7a, 0x68, 0x61, 0x6e, 0x67, 0x6a, 0x69, 0x61, 0x6b, 0x6f, 0x75, 0x10, 0x03,
|
||||
0x12, 0x14, 0x0a, 0x10, 0x61, 0x6c, 0x69, 0x5f, 0x63, 0x6e, 0x5f, 0x68, 0x75, 0x68, 0x65, 0x68,
|
||||
0x61, 0x6f, 0x74, 0x65, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x61, 0x6c, 0x69, 0x5f, 0x63, 0x6e,
|
||||
0x5f, 0x77, 0x75, 0x6c, 0x61, 0x6e, 0x63, 0x68, 0x61, 0x62, 0x75, 0x10, 0x05, 0x12, 0x13, 0x0a,
|
||||
0x0f, 0x61, 0x6c, 0x69, 0x5f, 0x63, 0x6e, 0x5f, 0x68, 0x61, 0x6e, 0x67, 0x7a, 0x68, 0x6f, 0x75,
|
||||
0x10, 0x06, 0x12, 0x13, 0x0a, 0x0f, 0x61, 0x6c, 0x69, 0x5f, 0x63, 0x6e, 0x5f, 0x73, 0x68, 0x61,
|
||||
0x6e, 0x67, 0x68, 0x61, 0x69, 0x10, 0x07, 0x12, 0x13, 0x0a, 0x0f, 0x61, 0x6c, 0x69, 0x5f, 0x63,
|
||||
0x6e, 0x5f, 0x73, 0x68, 0x65, 0x6e, 0x7a, 0x68, 0x65, 0x6e, 0x10, 0x08, 0x12, 0x11, 0x0a, 0x0d,
|
||||
0x61, 0x6c, 0x69, 0x5f, 0x63, 0x6e, 0x5f, 0x68, 0x65, 0x79, 0x75, 0x61, 0x6e, 0x10, 0x09, 0x12,
|
||||
0x14, 0x0a, 0x10, 0x61, 0x6c, 0x69, 0x5f, 0x63, 0x6e, 0x5f, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x7a,
|
||||
0x68, 0x6f, 0x75, 0x10, 0x0a, 0x12, 0x12, 0x0a, 0x0e, 0x61, 0x6c, 0x69, 0x5f, 0x63, 0x6e, 0x5f,
|
||||
0x63, 0x68, 0x65, 0x6e, 0x67, 0x64, 0x75, 0x10, 0x0b, 0x12, 0x13, 0x0a, 0x0f, 0x61, 0x6c, 0x69,
|
||||
0x5f, 0x63, 0x6e, 0x5f, 0x68, 0x6f, 0x6e, 0x67, 0x6b, 0x6f, 0x6e, 0x67, 0x10, 0x0c, 0x12, 0x16,
|
||||
0x0a, 0x12, 0x61, 0x6c, 0x69, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x65, 0x61,
|
||||
0x73, 0x74, 0x5f, 0x31, 0x10, 0x0d, 0x12, 0x16, 0x0a, 0x12, 0x61, 0x6c, 0x69, 0x5f, 0x61, 0x70,
|
||||
0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x32, 0x10, 0x0e, 0x12, 0x16,
|
||||
0x0a, 0x12, 0x61, 0x6c, 0x69, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x65, 0x61,
|
||||
0x73, 0x74, 0x5f, 0x33, 0x10, 0x0f, 0x12, 0x16, 0x0a, 0x12, 0x61, 0x6c, 0x69, 0x5f, 0x61, 0x70,
|
||||
0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x35, 0x10, 0x10, 0x12, 0x12,
|
||||
0x0a, 0x0e, 0x61, 0x6c, 0x69, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x5f, 0x31,
|
||||
0x10, 0x11, 0x12, 0x16, 0x0a, 0x12, 0x61, 0x6c, 0x69, 0x5f, 0x61, 0x70, 0x5f, 0x6e, 0x6f, 0x72,
|
||||
0x74, 0x68, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x31, 0x10, 0x12, 0x12, 0x11, 0x0a, 0x0d, 0x61, 0x6c,
|
||||
0x69, 0x5f, 0x75, 0x73, 0x5f, 0x77, 0x65, 0x73, 0x74, 0x5f, 0x31, 0x10, 0x13, 0x12, 0x11, 0x0a,
|
||||
0x0d, 0x61, 0x6c, 0x69, 0x5f, 0x75, 0x73, 0x5f, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x31, 0x10, 0x14,
|
||||
0x12, 0x14, 0x0a, 0x10, 0x61, 0x6c, 0x69, 0x5f, 0x65, 0x75, 0x5f, 0x63, 0x65, 0x6e, 0x74, 0x72,
|
||||
0x61, 0x6c, 0x5f, 0x31, 0x10, 0x15, 0x12, 0x11, 0x0a, 0x0d, 0x61, 0x6c, 0x69, 0x5f, 0x65, 0x75,
|
||||
0x5f, 0x77, 0x65, 0x73, 0x74, 0x5f, 0x31, 0x10, 0x16, 0x12, 0x11, 0x0a, 0x0d, 0x61, 0x6c, 0x69,
|
||||
0x5f, 0x6d, 0x65, 0x5f, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x31, 0x10, 0x17, 0x2a, 0xa1, 0x03, 0x0a,
|
||||
0x0f, 0x54, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x49, 0x64,
|
||||
0x12, 0x0a, 0x0a, 0x06, 0x74, 0x63, 0x5f, 0x61, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
||||
0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x62, 0x61, 0x6e, 0x67, 0x6b, 0x6f, 0x6b, 0x10, 0x01, 0x12,
|
||||
0x11, 0x0a, 0x0d, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x62, 0x65, 0x69, 0x6a, 0x69, 0x6e, 0x67,
|
||||
0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x63, 0x68, 0x65, 0x6e,
|
||||
0x67, 0x64, 0x75, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x63,
|
||||
0x68, 0x6f, 0x6e, 0x67, 0x71, 0x69, 0x6e, 0x67, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x74, 0x63,
|
||||
0x5f, 0x61, 0x70, 0x5f, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x7a, 0x68, 0x6f, 0x75, 0x10, 0x05, 0x12,
|
||||
0x18, 0x0a, 0x14, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x7a, 0x68,
|
||||
0x6f, 0x75, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x10, 0x06, 0x12, 0x12, 0x0a, 0x0e, 0x74, 0x63, 0x5f,
|
||||
0x61, 0x70, 0x5f, 0x68, 0x6f, 0x6e, 0x67, 0x6b, 0x6f, 0x6e, 0x67, 0x10, 0x07, 0x12, 0x10, 0x0a,
|
||||
0x0c, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x6d, 0x75, 0x6d, 0x62, 0x61, 0x69, 0x10, 0x08, 0x12,
|
||||
0x0f, 0x0a, 0x0b, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x65, 0x6f, 0x75, 0x6c, 0x10, 0x09,
|
||||
0x12, 0x12, 0x0a, 0x0e, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x68, 0x61, 0x6e, 0x67, 0x68,
|
||||
0x61, 0x69, 0x10, 0x0a, 0x12, 0x16, 0x0a, 0x12, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x68,
|
||||
0x61, 0x6e, 0x67, 0x68, 0x61, 0x69, 0x5f, 0x66, 0x73, 0x69, 0x10, 0x0b, 0x12, 0x16, 0x0a, 0x12,
|
||||
0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x68, 0x65, 0x6e, 0x7a, 0x68, 0x65, 0x6e, 0x5f, 0x66,
|
||||
0x73, 0x69, 0x10, 0x0c, 0x12, 0x13, 0x0a, 0x0f, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x69,
|
||||
0x6e, 0x67, 0x61, 0x70, 0x6f, 0x72, 0x65, 0x10, 0x0d, 0x12, 0x0f, 0x0a, 0x0b, 0x74, 0x63, 0x5f,
|
||||
0x61, 0x70, 0x5f, 0x74, 0x6f, 0x6b, 0x79, 0x6f, 0x10, 0x0e, 0x12, 0x13, 0x0a, 0x0f, 0x74, 0x63,
|
||||
0x5f, 0x65, 0x75, 0x5f, 0x66, 0x72, 0x61, 0x6e, 0x6b, 0x66, 0x75, 0x72, 0x74, 0x10, 0x0f, 0x12,
|
||||
0x10, 0x0a, 0x0c, 0x74, 0x63, 0x5f, 0x65, 0x75, 0x5f, 0x6d, 0x6f, 0x73, 0x63, 0x6f, 0x77, 0x10,
|
||||
0x10, 0x12, 0x11, 0x0a, 0x0d, 0x74, 0x63, 0x5f, 0x6e, 0x61, 0x5f, 0x61, 0x73, 0x68, 0x62, 0x75,
|
||||
0x72, 0x6e, 0x10, 0x11, 0x12, 0x17, 0x0a, 0x13, 0x74, 0x63, 0x5f, 0x6e, 0x61, 0x5f, 0x73, 0x69,
|
||||
0x6c, 0x69, 0x63, 0x6f, 0x6e, 0x76, 0x61, 0x6c, 0x6c, 0x65, 0x79, 0x10, 0x12, 0x12, 0x11, 0x0a,
|
||||
0x0d, 0x74, 0x63, 0x5f, 0x6e, 0x61, 0x5f, 0x74, 0x6f, 0x72, 0x6f, 0x6e, 0x74, 0x6f, 0x10, 0x13,
|
||||
0x2a, 0xe8, 0x01, 0x0a, 0x0e, 0x48, 0x75, 0x61, 0x77, 0x65, 0x69, 0x52, 0x65, 0x67, 0x69, 0x6f,
|
||||
0x6e, 0x49, 0x64, 0x12, 0x0a, 0x0a, 0x06, 0x68, 0x77, 0x5f, 0x61, 0x6c, 0x6c, 0x10, 0x00, 0x12,
|
||||
0x11, 0x0a, 0x0d, 0x68, 0x77, 0x5f, 0x63, 0x6e, 0x5f, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x5f, 0x31,
|
||||
0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x68, 0x77, 0x5f, 0x63, 0x6e, 0x5f, 0x6e, 0x6f, 0x72, 0x74,
|
||||
0x68, 0x5f, 0x34, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x68, 0x77, 0x5f, 0x63, 0x6e, 0x5f, 0x73,
|
||||
0x6f, 0x75, 0x74, 0x68, 0x5f, 0x31, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x68, 0x77, 0x5f, 0x63,
|
||||
0x6e, 0x5f, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x32, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x68, 0x77,
|
||||
0x5f, 0x63, 0x6e, 0x5f, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x33, 0x10, 0x05, 0x12, 0x15, 0x0a, 0x11,
|
||||
0x68, 0x77, 0x5f, 0x63, 0x6e, 0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x77, 0x65, 0x73, 0x74, 0x5f,
|
||||
0x32, 0x10, 0x06, 0x12, 0x15, 0x0a, 0x11, 0x68, 0x77, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x6f, 0x75,
|
||||
0x74, 0x68, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x31, 0x10, 0x07, 0x12, 0x15, 0x0a, 0x11, 0x68, 0x77,
|
||||
0x5f, 0x61, 0x70, 0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x32, 0x10,
|
||||
0x08, 0x12, 0x15, 0x0a, 0x11, 0x68, 0x77, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68,
|
||||
0x65, 0x61, 0x73, 0x74, 0x5f, 0x33, 0x10, 0x09, 0x12, 0x11, 0x0a, 0x0d, 0x68, 0x77, 0x5f, 0x61,
|
||||
0x66, 0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x5f, 0x31, 0x10, 0x0a, 0x2a, 0xcd, 0x03, 0x0a, 0x0b,
|
||||
0x41, 0x77, 0x73, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x0b, 0x0a, 0x07, 0x61,
|
||||
0x77, 0x73, 0x5f, 0x61, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x61, 0x77, 0x73, 0x5f,
|
||||
0x75, 0x73, 0x5f, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x32, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x61,
|
||||
0x77, 0x73, 0x5f, 0x75, 0x73, 0x5f, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x31, 0x10, 0x02, 0x12, 0x11,
|
||||
0x0a, 0x0d, 0x61, 0x77, 0x73, 0x5f, 0x75, 0x73, 0x5f, 0x77, 0x65, 0x73, 0x74, 0x5f, 0x31, 0x10,
|
||||
0x03, 0x12, 0x11, 0x0a, 0x0d, 0x61, 0x77, 0x73, 0x5f, 0x75, 0x73, 0x5f, 0x77, 0x65, 0x73, 0x74,
|
||||
0x5f, 0x32, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x61, 0x77, 0x73, 0x5f, 0x61, 0x66, 0x5f, 0x73,
|
||||
0x6f, 0x75, 0x74, 0x68, 0x5f, 0x31, 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x61, 0x77, 0x73, 0x5f,
|
||||
0x61, 0x70, 0x5f, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x31, 0x10, 0x06, 0x12, 0x12, 0x0a, 0x0e, 0x61,
|
||||
0x77, 0x73, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x5f, 0x31, 0x10, 0x07, 0x12,
|
||||
0x16, 0x0a, 0x12, 0x61, 0x77, 0x73, 0x5f, 0x61, 0x70, 0x5f, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x65,
|
||||
0x61, 0x73, 0x74, 0x5f, 0x33, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x61, 0x77, 0x73, 0x5f, 0x61,
|
||||
0x70, 0x5f, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x32, 0x10, 0x09, 0x12,
|
||||
0x16, 0x0a, 0x12, 0x61, 0x77, 0x73, 0x5f, 0x61, 0x70, 0x5f, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x65,
|
||||
0x61, 0x73, 0x74, 0x5f, 0x31, 0x10, 0x0a, 0x12, 0x16, 0x0a, 0x12, 0x61, 0x77, 0x73, 0x5f, 0x61,
|
||||
0x70, 0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x32, 0x10, 0x0b, 0x12,
|
||||
0x16, 0x0a, 0x12, 0x61, 0x77, 0x73, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x65,
|
||||
0x61, 0x73, 0x74, 0x5f, 0x31, 0x10, 0x0c, 0x12, 0x14, 0x0a, 0x10, 0x61, 0x77, 0x73, 0x5f, 0x63,
|
||||
0x61, 0x5f, 0x63, 0x65, 0x6e, 0x74, 0x72, 0x61, 0x6c, 0x5f, 0x31, 0x10, 0x0d, 0x12, 0x14, 0x0a,
|
||||
0x10, 0x61, 0x77, 0x73, 0x5f, 0x65, 0x75, 0x5f, 0x63, 0x65, 0x6e, 0x74, 0x72, 0x61, 0x6c, 0x5f,
|
||||
0x31, 0x10, 0x0e, 0x12, 0x11, 0x0a, 0x0d, 0x61, 0x77, 0x73, 0x5f, 0x65, 0x75, 0x5f, 0x77, 0x65,
|
||||
0x73, 0x74, 0x5f, 0x31, 0x10, 0x0f, 0x12, 0x11, 0x0a, 0x0d, 0x61, 0x77, 0x73, 0x5f, 0x65, 0x75,
|
||||
0x5f, 0x77, 0x65, 0x73, 0x74, 0x5f, 0x32, 0x10, 0x10, 0x12, 0x12, 0x0a, 0x0e, 0x61, 0x77, 0x73,
|
||||
0x5f, 0x65, 0x75, 0x5f, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x5f, 0x31, 0x10, 0x11, 0x12, 0x11, 0x0a,
|
||||
0x0d, 0x61, 0x77, 0x73, 0x5f, 0x65, 0x75, 0x5f, 0x77, 0x65, 0x73, 0x74, 0x5f, 0x33, 0x10, 0x12,
|
||||
0x12, 0x12, 0x0a, 0x0e, 0x61, 0x77, 0x73, 0x5f, 0x65, 0x75, 0x5f, 0x6e, 0x6f, 0x72, 0x74, 0x68,
|
||||
0x5f, 0x31, 0x10, 0x13, 0x12, 0x12, 0x0a, 0x0e, 0x61, 0x77, 0x73, 0x5f, 0x6d, 0x65, 0x5f, 0x73,
|
||||
0x6f, 0x75, 0x74, 0x68, 0x5f, 0x31, 0x10, 0x14, 0x12, 0x11, 0x0a, 0x0d, 0x61, 0x77, 0x73, 0x5f,
|
||||
0x73, 0x61, 0x5f, 0x65, 0x61, 0x73, 0x74, 0x5f, 0x31, 0x10, 0x15, 0x32, 0x78, 0x0a, 0x0d, 0x54,
|
||||
0x65, 0x6e, 0x61, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x67, 0x92, 0x41,
|
||||
0x64, 0x12, 0x1e, 0xe6, 0x89, 0x80, 0xe6, 0x9c, 0x89, 0xe4, 0xba, 0x91, 0xe7, 0xa7, 0x9f, 0xe6,
|
||||
0x88, 0xb7, 0xe7, 0x9a, 0x84, 0xe8, 0xae, 0xa4, 0xe8, 0xaf, 0x81, 0xe6, 0x9c, 0x8d, 0xe5, 0x8a,
|
||||
0xa1, 0x1a, 0x42, 0x0a, 0x1f, 0x46, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6d, 0x6f,
|
||||
0x72, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x46, 0x69,
|
||||
0x74, 0x74, 0x65, 0x72, 0x12, 0x1f, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69,
|
||||
0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x63, 0x6e, 0x2f, 0x4a, 0x43, 0x43,
|
||||
0x45, 0x2f, 0x50, 0x43, 0x4d, 0x42, 0x30, 0x5a, 0x2e, 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, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_idl_pbtenant_tenant_proto_rawDescOnce sync.Once
|
||||
file_idl_pbtenant_tenant_proto_rawDescData = file_idl_pbtenant_tenant_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_idl_pbtenant_tenant_proto_rawDescGZIP() []byte {
|
||||
file_idl_pbtenant_tenant_proto_rawDescOnce.Do(func() {
|
||||
file_idl_pbtenant_tenant_proto_rawDescData = protoimpl.X.CompressGZIP(file_idl_pbtenant_tenant_proto_rawDescData)
|
||||
})
|
||||
return file_idl_pbtenant_tenant_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_idl_pbtenant_tenant_proto_enumTypes = make([]protoimpl.EnumInfo, 6)
|
||||
var file_idl_pbtenant_tenant_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_idl_pbtenant_tenant_proto_goTypes = []interface{}{
|
||||
(CloudProvider)(0), // 0: pbtenant.CloudProvider
|
||||
(CloudProduct)(0), // 1: pbtenant.CloudProduct
|
||||
(AliRegionId)(0), // 2: pbtenant.AliRegionId
|
||||
(TencentRegionId)(0), // 3: pbtenant.TencentRegionId
|
||||
(HuaweiRegionId)(0), // 4: pbtenant.HuaweiRegionId
|
||||
(AwsRegionId)(0), // 5: pbtenant.AwsRegionId
|
||||
(*CloudConfigs)(nil), // 6: pbtenant.CloudConfigs
|
||||
(*CloudConfig)(nil), // 7: pbtenant.CloudConfig
|
||||
}
|
||||
var file_idl_pbtenant_tenant_proto_depIdxs = []int32{
|
||||
7, // 0: pbtenant.CloudConfigs.configs:type_name -> pbtenant.CloudConfig
|
||||
0, // 1: pbtenant.CloudConfig.provider:type_name -> pbtenant.CloudProvider
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_idl_pbtenant_tenant_proto_init() }
|
||||
func file_idl_pbtenant_tenant_proto_init() {
|
||||
if File_idl_pbtenant_tenant_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_idl_pbtenant_tenant_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CloudConfigs); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_idl_pbtenant_tenant_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CloudConfig); 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_pbtenant_tenant_proto_rawDesc,
|
||||
NumEnums: 6,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_idl_pbtenant_tenant_proto_goTypes,
|
||||
DependencyIndexes: file_idl_pbtenant_tenant_proto_depIdxs,
|
||||
EnumInfos: file_idl_pbtenant_tenant_proto_enumTypes,
|
||||
MessageInfos: file_idl_pbtenant_tenant_proto_msgTypes,
|
||||
}.Build()
|
||||
File_idl_pbtenant_tenant_proto = out.File
|
||||
file_idl_pbtenant_tenant_proto_rawDesc = nil
|
||||
file_idl_pbtenant_tenant_proto_goTypes = nil
|
||||
file_idl_pbtenant_tenant_proto_depIdxs = nil
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc (unknown)
|
||||
// source: idl/pbtenant/tenant.proto
|
||||
|
||||
package pbtenant
|
||||
|
||||
import (
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// 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
|
||||
|
||||
// TenantServiceClient is the client API for TenantService 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 TenantServiceClient interface {
|
||||
}
|
||||
|
||||
type tenantServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewTenantServiceClient(cc grpc.ClientConnInterface) TenantServiceClient {
|
||||
return &tenantServiceClient{cc}
|
||||
}
|
||||
|
||||
// TenantServiceServer is the server API for TenantService service.
|
||||
// All implementations must embed UnimplementedTenantServiceServer
|
||||
// for forward compatibility
|
||||
type TenantServiceServer interface {
|
||||
mustEmbedUnimplementedTenantServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedTenantServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedTenantServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedTenantServiceServer) mustEmbedUnimplementedTenantServiceServer() {}
|
||||
|
||||
// UnsafeTenantServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to TenantServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeTenantServiceServer interface {
|
||||
mustEmbedUnimplementedTenantServiceServer()
|
||||
}
|
||||
|
||||
func RegisterTenantServiceServer(s grpc.ServiceRegistrar, srv TenantServiceServer) {
|
||||
s.RegisterService(&TenantService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
// TenantService_ServiceDesc is the grpc.ServiceDesc for TenantService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var TenantService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pbtenant.TenantService",
|
||||
HandlerType: (*TenantServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "idl/pbtenant/tenant.proto",
|
||||
}
|
|
@ -0,0 +1,384 @@
|
|||
{
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "idl/demo/demo.proto",
|
||||
"version": "version not set"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/demo": {
|
||||
"post": {
|
||||
"security": [],
|
||||
"tags": [
|
||||
"DemoService"
|
||||
],
|
||||
"summary": "Echo 样例接口",
|
||||
"externalDocs": {
|
||||
"description": "Find out more about the interface",
|
||||
"url": "https://github.com/grpc-ecosystem/grpc-gateway"
|
||||
},
|
||||
"operationId": "DemoService_Echo",
|
||||
"deprecated": true,
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/demoStringMessage"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/demoStringMessage"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/apis/ecs": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"EcsService"
|
||||
],
|
||||
"summary": "查询ECS全量 - 根据云类型",
|
||||
"operationId": "EcsService_ListEcs",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pbecsListReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pbecsListResp"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/apis/ecs/all": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"EcsService"
|
||||
],
|
||||
"summary": "查询所有云的ECS",
|
||||
"operationId": "EcsService_ListEcsAll",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pbecsListAllReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pbecsListResp"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/apis/ecs/detail": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"EcsService"
|
||||
],
|
||||
"summary": "查询ECS明细 - 支持云类型、区域、账户、分页等过滤条件",
|
||||
"operationId": "EcsService_ListEcsDetail",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pbecsListDetailReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pbecsListDetailResp"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"demoStringMessage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pbecsEcsInstance": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"accountName": {
|
||||
"type": "string",
|
||||
"title": "账号名称"
|
||||
},
|
||||
"chargeType": {
|
||||
"type": "string",
|
||||
"title": "收费类型"
|
||||
},
|
||||
"cpu": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "vcpu数"
|
||||
},
|
||||
"creationTime": {
|
||||
"type": "string",
|
||||
"title": "创建时间,ISO8601"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"title": "实例描述"
|
||||
},
|
||||
"expireTime": {
|
||||
"type": "string",
|
||||
"title": "过期时间"
|
||||
},
|
||||
"innerIps": {
|
||||
"type": "array",
|
||||
"title": "内网ip",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"instanceId": {
|
||||
"type": "string",
|
||||
"title": "实例id"
|
||||
},
|
||||
"instanceName": {
|
||||
"type": "string",
|
||||
"title": "实例名称"
|
||||
},
|
||||
"instanceType": {
|
||||
"type": "string",
|
||||
"title": "实例类型"
|
||||
},
|
||||
"memory": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "内存MB"
|
||||
},
|
||||
"provider": {
|
||||
"title": "云类型",
|
||||
"$ref": "#/definitions/pbtenantCloudProvider"
|
||||
},
|
||||
"publicIps": {
|
||||
"type": "array",
|
||||
"title": "公网ip",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"regionName": {
|
||||
"type": "string",
|
||||
"title": "地域,数据中心"
|
||||
},
|
||||
"resourceGroupId": {
|
||||
"type": "string",
|
||||
"title": "资源组id"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"title": "状态"
|
||||
},
|
||||
"vpcId": {
|
||||
"type": "string",
|
||||
"title": "vcp id"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pbecsListAllReq": {
|
||||
"type": "object"
|
||||
},
|
||||
"pbecsListDetailReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"accountName": {
|
||||
"type": "string",
|
||||
"title": "账户名称,根据config.yaml中的配置,默认为第一个配置的账户"
|
||||
},
|
||||
"nextToken": {
|
||||
"type": "string",
|
||||
"title": "分页相关参数,下一页的token"
|
||||
},
|
||||
"pageNumber": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "分页相关参数,页码"
|
||||
},
|
||||
"pageSize": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "分页相关参数,每页数量"
|
||||
},
|
||||
"provider": {
|
||||
"title": "云名称",
|
||||
"$ref": "#/definitions/pbtenantCloudProvider"
|
||||
},
|
||||
"regionId": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "区域Id,参考 tenant.proto 中的各个云的区域"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pbecsListDetailResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ecses": {
|
||||
"type": "array",
|
||||
"title": "Ecs 机器集合",
|
||||
"items": {
|
||||
"$ref": "#/definitions/pbecsEcsInstance"
|
||||
}
|
||||
},
|
||||
"finished": {
|
||||
"type": "boolean",
|
||||
"title": "查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询"
|
||||
},
|
||||
"nextToken": {
|
||||
"type": "string",
|
||||
"title": "分页相关参数,下一页的token"
|
||||
},
|
||||
"pageNumber": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "分页相关参数,页码"
|
||||
},
|
||||
"pageSize": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "分页相关参数,每页数量"
|
||||
},
|
||||
"requestId": {
|
||||
"type": "string",
|
||||
"title": "请求id,出现问题后提供给云厂商,排查问题"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pbecsListReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"title": "云名称",
|
||||
"$ref": "#/definitions/pbtenantCloudProvider"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pbecsListResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ecses": {
|
||||
"type": "array",
|
||||
"title": "Ecs 机器集合",
|
||||
"items": {
|
||||
"$ref": "#/definitions/pbecsEcsInstance"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"pbtenantCloudProvider": {
|
||||
"description": "- ali: 0 - 阿里云\n - tencent: 1 - 腾讯云\n - huawei: 2 - 华为云\n - aws: 3 - 亚马逊云",
|
||||
"type": "string",
|
||||
"title": "云提供商",
|
||||
"default": "ali",
|
||||
"enum": [
|
||||
"ali",
|
||||
"tencent",
|
||||
"huawei",
|
||||
"aws"
|
||||
]
|
||||
},
|
||||
"protobufAny": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"typeUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
}
|
||||
},
|
||||
"rpcStatus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"details": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/protobufAny"
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "DemoService"
|
||||
},
|
||||
{
|
||||
"name": "EcsService"
|
||||
}
|
||||
]
|
||||
}
|
21
main.go
21
main.go
|
@ -3,14 +3,17 @@ package main
|
|||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"gitlink.org.cn/JCCE/PCM/common/server"
|
||||
"gitlink.org.cn/JCCE/PCM/common/tenanter"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/demo"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JCCE/PCM/internal/server"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/gen/idl/demo"
|
||||
"google.golang.org/grpc"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -30,6 +33,8 @@ func run() error {
|
|||
|
||||
if err := demo.RegisterDemoServiceHandlerFromEndpoint(ctx, mux, *grpcServerEndpoint, opts); err != nil {
|
||||
return errors.Wrap(err, "RegisterDemoServiceHandlerFromEndpoint error")
|
||||
} else if err = pbecs.RegisterEcsServiceHandlerFromEndpoint(ctx, mux, *grpcServerEndpoint, opts); err != nil {
|
||||
return errors.Wrap(err, "RegisterEcsServiceHandlerFromEndpoint error")
|
||||
}
|
||||
|
||||
// Start HTTP server (and proxy calls to gRPC server endpoint)
|
||||
|
@ -42,6 +47,13 @@ func main() {
|
|||
flag.Parse()
|
||||
defer glog.Flush()
|
||||
|
||||
if err := tenanter.LoadCloudConfigsFromFile(configFile); err != nil {
|
||||
if !errors.Is(err, tenanter.ErrLoadTenanterFileEmpty) {
|
||||
glog.Fatalf("LoadCloudConfigsFromFile error %+v", err)
|
||||
}
|
||||
glog.Warningf("LoadCloudConfigsFromFile empty file path %s", configFile)
|
||||
}
|
||||
|
||||
glog.Infof("load tenant from file finished")
|
||||
|
||||
go func() {
|
||||
|
@ -52,6 +64,7 @@ func main() {
|
|||
|
||||
s := grpc.NewServer()
|
||||
demo.RegisterDemoServiceServer(s, &server.Server{})
|
||||
pbecs.RegisterEcsServiceServer(s, &server.Server{})
|
||||
|
||||
if err = s.Serve(lis); err != nil {
|
||||
glog.Fatalf("failed to serve: %v", err)
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
# 请先保证swagger的安装,可参考 https://goswagger.io/install.html
|
||||
|
||||
swagger mixin lan_trans/gen/openapiv2/idl/*/*.json -o lan_trans/gen/swagger.json
|
||||
swagger mixin lan_trans/openapiv2/idl/*/*.json -o lan_trans/swagger.json
|
||||
|
||||
rm -rf lan_trans/gen/openapiv2
|
||||
rm -rf lan_trans/openapiv2
|
||||
|
||||
# 将机器的sshkey保存到公有云机器121.41.88.120上
|
||||
#scp -P 22 gen/swagger.json root@121.41.88.120:/root/doc
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
echo "" > coverage.txt
|
||||
|
||||
for d in $(go list ./internal/...); do
|
||||
echo $d
|
||||
# 部分sdk内部有并发问题,无法通过检查
|
||||
go test -race -coverprofile=profile.out -covermode=atomic $d
|
||||
if [ -f profile.out ]; then
|
||||
cat profile.out >> coverage.txt
|
||||
rm profile.out
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue