ecs模块

This commit is contained in:
zhouqunjie 2022-04-15 15:54:48 +08:00
commit c3ab641e58
19 changed files with 3417 additions and 459 deletions

View File

@ -4,15 +4,112 @@ import (
"context"
"sync"
"github.com/golang/glog"
"github.com/pkg/errors"
"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"
"github.com/golang/glog"
"github.com/pkg/errors"
)
//CreateMultipleEcs 创建多云ECS
func CreateMultipleEcs(ctx context.Context, reqs *pbecs.CreateEcsMultipleReq) (*pbecs.CreateEcsMultipleResp, error) {
var (
wg sync.WaitGroup
requestIds = make([]string, 0)
)
wg.Add(len(reqs.GetCreateEcsReqs()))
c := make(chan string, len(reqs.GetCreateEcsReqs()))
for _, k := range reqs.GetCreateEcsReqs() {
k := k
go func() {
defer wg.Done()
resp, err := CreateEcs(ctx, k)
if err != nil {
glog.Errorf(k.Provider.String()+"CreateEcs error: %v", err)
c <- k.Provider.String()
return
}
c <- resp.GetRequestId()
}()
}
go func() {
defer close(c)
wg.Wait()
}()
for v := range c {
requestIds = append(requestIds, v)
}
isFinished := false
if len(requestIds) > 0 {
isFinished = true
}
return &pbecs.CreateEcsMultipleResp{
RequestId: requestIds,
Finished: isFinished,
}, nil
}
func CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (*pbecs.CreateEcsResp, error) {
var (
ecs ecser.Ecser
)
tenanters, err := tenanter.GetTenanters(req.Provider)
region, err := tenanter.NewRegion(req.Provider, req.RegionId)
if err != nil {
return nil, errors.Wrap(err, "get tenanters failed")
}
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.CreateEcs(ctx, req)
}
func DeleteEcs(ctx context.Context, req *pbecs.DeleteEcsReq) (*pbecs.DeleteEcsResp, error) {
var (
ecs ecser.Ecser
)
tenanters, err := tenanter.GetTenanters(req.Provider)
region, err := tenanter.NewRegion(req.Provider, req.RegionId)
if err != nil {
return nil, errors.Wrap(err, "get tenanters failed")
}
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.DeleteEcs(ctx, req)
}
func UpdateEcs(ctx context.Context, req *pbecs.UpdateEcsReq) (*pbecs.UpdateEcsResp, error) {
var (
ecs ecser.Ecser
)
tenanters, err := tenanter.GetTenanters(req.Provider)
region, err := tenanter.NewRegion(req.Provider, req.RegionId)
if err != nil {
return nil, errors.Wrap(err, "get tenanters failed")
}
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.UpdateEcs(ctx, req)
}
//ListDetail returns the detail of ecs instances
func ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (*pbecs.ListDetailResp, error) {
var (

View File

@ -2,14 +2,18 @@ package ecser
import (
"context"
"sync"
openapi "github.com/alibabacloud-go/darabonba-openapi/client"
string_ "github.com/alibabacloud-go/darabonba-string/client"
aliecs "github.com/alibabacloud-go/ecs-20140526/v2/client"
util "github.com/alibabacloud-go/tea-utils/service"
"github.com/alibabacloud-go/tea/tea"
"github.com/golang/glog"
"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"
"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
@ -25,14 +29,21 @@ func newAliEcsClient(region tenanter.Region, tenant tenanter.Tenanter) (Ecser, e
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())
config := &openapi.Config{}
AccessKeyId := t.GetId()
AccessKeySecret := t.GetSecret()
RegionId := region.GetName()
config.AccessKeyId = &AccessKeyId
config.AccessKeySecret = &AccessKeySecret
config.RegionId = &RegionId
client, err = aliecs.NewClient(config)
aliClientMutex.Unlock()
default:
return nil, errors.New("unsupported tenant type")
}
if err != nil {
@ -45,40 +56,170 @@ func newAliEcsClient(region tenanter.Region, tenant tenanter.Tenanter) (Ecser, e
tenanter: tenant,
}, nil
}
func (ecs *AliEcs) CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (*pbecs.CreateEcsResp, error) {
RegionId := ecs.region.GetName()
ImageId := req.GetImageId()
InstanceType := req.GetInstanceType()
SecurityGroupId := req.GetSecurityGroupId()
InstanceName := req.GetInstanceName()
Description := req.GetDescription()
ZoneId := req.GetZoneId()
VSwitchId := req.GetVSwitchId()
Amount := req.GetAmount()
DryRun := req.GetDryRun()
Category := req.GetCategory()
InstanceChargeType := req.GetInstanceChargeType()
request := &aliecs.RunInstancesRequest{
RegionId: &RegionId,
InstanceType: &InstanceType,
ImageId: &ImageId,
SecurityGroupId: &SecurityGroupId,
InstanceName: &InstanceName,
Description: &Description,
ZoneId: &ZoneId,
VSwitchId: &VSwitchId,
Amount: &Amount,
DryRun: util.EqualString(&DryRun, tea.String("true")),
SystemDisk: &aliecs.RunInstancesRequestSystemDisk{
Category: &Category,
},
InstanceChargeType: &InstanceChargeType,
}
// 创建并运行实例
resp, err := ecs.cli.RunInstances(request)
if err != nil {
return nil, errors.Wrap(err, "Ali Create ECS error")
}
isFinished := false
if len(resp.Body.InstanceIdSets.InstanceIdSet) > 0 {
isFinished = true
}
glog.Infof("--------------------阿里ECS实例创建成功--------------------")
glog.Infof(*util.ToJSONString(util.ToMap(resp)))
requestId := *resp.Body.RequestId
//订单ID。该参数只有创建包年包月ECS实例请求参数InstanceChargeType=PrePaid时有返回值。
OrderId := ""
if req.InstanceChargeType == "PrePaid" {
OrderId = *resp.Body.OrderId
}
TradePrice := float32(0)
if resp.Body.TradePrice != nil {
TradePrice = *resp.Body.TradePrice
}
InstanceIds := make([]string, 0)
for _, v := range resp.Body.InstanceIdSets.InstanceIdSet {
InstanceIds = append(InstanceIds, *v)
}
return &pbecs.CreateEcsResp{
OrderId: OrderId,
TradePrice: TradePrice,
RequestId: "Ali ECS RequestId: " + requestId,
InstanceIdSets: InstanceIds,
Finished: isFinished,
}, nil
}
func (ecs *AliEcs) DeleteEcs(ctx context.Context, req *pbecs.DeleteEcsReq) (*pbecs.DeleteEcsResp, error) {
RegionId := ecs.region.GetName()
InstanceIds := req.GetInstanceIds()
DryRun := req.GetDryRun()
Force := req.GetForce()
TerminateSubscription := req.GetTerminateSubscription()
deleteReq := &aliecs.DeleteInstancesRequest{
RegionId: &RegionId,
InstanceId: string_.Split(&InstanceIds, tea.String(","), tea.Int(-1)),
Force: util.EqualString(&Force, tea.String("true")),
DryRun: util.EqualString(&DryRun, tea.String("true")),
TerminateSubscription: util.EqualString(&TerminateSubscription, tea.String("true")),
}
resp, err := ecs.cli.DeleteInstances(deleteReq)
if err != nil {
return nil, errors.Wrap(err, "Ali Delete ECS error")
}
glog.Infof("--------------------阿里ECS实例释放成功--------------------")
glog.Infof(*util.ToJSONString(util.ToMap(resp)))
return &pbecs.DeleteEcsResp{
RequestId: *resp.Body.RequestId,
AccountName: req.AccountName,
RegionId: req.RegionId,
}, nil
}
func (ecs *AliEcs) UpdateEcs(ctx context.Context, req *pbecs.UpdateEcsReq) (*pbecs.UpdateEcsResp, error) {
Password := req.GetPassword()
HostName := req.GetHostName()
InstanceName := req.GetInstanceName()
Description := req.GetDescription()
InstanceId := req.GetInstanceIds()
UpdateReq := &aliecs.ModifyInstanceAttributeRequest{}
if req.GetInstanceIds() == "" {
return nil, errors.New("InstanceId is empty")
}
UpdateReq.InstanceId = &InstanceId
if Password != "" {
UpdateReq.Password = &Password
}
if HostName != "" {
UpdateReq.HostName = &HostName
}
if InstanceName != "" {
UpdateReq.InstanceName = &InstanceName
}
if Description != "" {
UpdateReq.Description = &Description
}
resp, err := ecs.cli.ModifyInstanceAttribute(UpdateReq)
if err != nil {
return nil, errors.Wrap(err, "Ali Update ECS error")
}
glog.Infof("--------------------阿里ECS实例修改成功--------------------")
glog.Infof(*util.ToJSONString(util.ToMap(resp)))
return &pbecs.UpdateEcsResp{
RequestId: *resp.Body.RequestId,
}, 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
request := &aliecs.DescribeInstancesRequest{}
request.PageNumber = &req.PageNumber
request.PageSize = &req.PageSize
request.NextToken = &req.NextToken
request.RegionId = ecs.cli.RegionId
resp, err := ecs.cli.DescribeInstances(request)
if err != nil {
return nil, errors.Wrap(err, "Aliyun ListDetail error")
return nil, errors.Wrap(err, "Ali ListDetail error")
}
var ecses = make([]*pbecs.EcsInstance, len(resp.Instances.Instance))
for k, v := range resp.Instances.Instance {
var ecses = make([]*pbecs.EcsInstance, len(resp.Body.Instances.Instance))
for k, v := range resp.Body.Instances.Instance {
publicIps := make([]string, 0)
for _, vv := range v.PublicIpAddress.IpAddress {
publicIps = append(publicIps, *vv)
}
InnerIps := make([]string, 0)
for _, vv := range v.VpcAttributes.PrivateIpAddress.IpAddress {
InnerIps = append(InnerIps, *vv)
}
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,
Provider: pbtenant.CloudProvider_ali,
AccountName: ecs.tenanter.AccountName(),
InstanceId: *v.InstanceId,
InstanceName: *v.InstanceName,
RegionName: ecs.region.GetName(),
PublicIps: publicIps,
InstanceType: *v.InstanceType,
Cpu: *v.Cpu,
Memory: *v.Memory,
Description: *v.Description,
Status: *v.Status,
CreationTime: *v.CreationTime,
ExpireTime: *v.ExpiredTime,
InnerIps: InnerIps,
VpcId: *v.VpcAttributes.VpcId,
ResourceGroupId: *v.ResourceGroupId,
InstanceChargeType: *v.InstanceChargeType,
}
}
isFinished := false
if len(ecses) < int(req.PageSize) {
isFinished = true
@ -89,7 +230,7 @@ func (ecs *AliEcs) ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (*p
Finished: isFinished,
PageNumber: req.PageNumber + 1,
PageSize: req.PageSize,
NextToken: resp.NextToken,
RequestId: resp.RequestId,
NextToken: *resp.Body.NextToken,
RequestId: *resp.Body.RequestId,
}, nil
}

View File

@ -2,6 +2,7 @@ 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"
@ -16,7 +17,10 @@ var (
)
type Ecser interface {
ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (resp *pbecs.ListDetailResp, err error)
CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (resp *pbecs.CreateEcsResp, err error) //创建ecs
DeleteEcs(ctx context.Context, req *pbecs.DeleteEcsReq) (resp *pbecs.DeleteEcsResp, err error) //批量删除ecs
UpdateEcs(ctx context.Context, req *pbecs.UpdateEcsReq) (resp *pbecs.UpdateEcsResp, err error) //修改ecs
ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (resp *pbecs.ListDetailResp, err error) //查询ecs详情
}
func NewEcsClient(provider pbtenant.CloudProvider, region tenanter.Region, tenant tenanter.Tenanter) (ecser Ecser, err error) {

View File

@ -2,10 +2,12 @@ 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"
"strconv"
string_ "github.com/alibabacloud-go/darabonba-string/client"
util "github.com/alibabacloud-go/tea-utils/service"
"github.com/alibabacloud-go/tea/tea"
"github.com/golang/glog"
"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"
@ -14,6 +16,9 @@ import (
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"
"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 HuaweiEcs struct {
@ -58,6 +63,139 @@ func newHuaweiEcsClient(region tenanter.Region, tenant tenanter.Tenanter) (Ecser
}, nil
}
func (ecs *HuaweiEcs) CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (*pbecs.CreateEcsResp, error) {
subnetIds := string_.Split(&req.SubnetId, tea.String(","), tea.Int(-1))
Nics := make([]model.PrePaidServerNic, 0)
for _, nic := range subnetIds {
Nics = append(Nics, model.PrePaidServerNic{
SubnetId: *nic,
})
}
Volumetype := &model.PrePaidServerRootVolume{}
switch req.SystemDisk.Category {
case "SATA":
Volumetype.Volumetype = model.GetPrePaidServerRootVolumeVolumetypeEnum().SATA
case "SAS":
Volumetype.Volumetype = model.GetPrePaidServerRootVolumeVolumetypeEnum().SAS
case "SSD":
Volumetype.Volumetype = model.GetPrePaidServerRootVolumeVolumetypeEnum().SSD
case "GPSSD":
Volumetype.Volumetype = model.GetPrePaidServerRootVolumeVolumetypeEnum().GPSSD
case "co-p1":
Volumetype.Volumetype = model.GetPrePaidServerRootVolumeVolumetypeEnum().CO_P1
case "uh-l1":
Volumetype.Volumetype = model.GetPrePaidServerRootVolumeVolumetypeEnum().UH_L1
case "ESSD":
Volumetype.Volumetype = model.GetPrePaidServerRootVolumeVolumetypeEnum().ESSD
}
PrePaidServerExtendParam := &model.PrePaidServerExtendParam{}
prePaid := model.GetPrePaidServerExtendParamChargingModeEnum().PRE_PAID
if req.InstanceChargeType == "PrePaid" {
PrePaidServerExtendParam.ChargingMode = &prePaid
}
request := &model.CreateServersRequest{
Body: &model.CreateServersRequestBody{
DryRun: util.EqualString(&req.DryRun, tea.String("true")),
Server: &model.PrePaidServer{
ImageRef: req.GetImageId(),
FlavorRef: req.InstanceType,
Name: req.InstanceName,
Vpcid: req.VpcId,
Nics: Nics,
RootVolume: Volumetype,
Count: &req.Amount,
Extendparam: PrePaidServerExtendParam,
},
}}
resp, err := ecs.cli.CreateServers(request)
if err != nil {
return nil, errors.Wrap(err, "Huawei create ecs error")
}
glog.Infof("--------------------华为ECS实例创建成功--------------------")
glog.Infof(resp.String())
isFinished := false
if len(*resp.ServerIds) > 0 {
isFinished = true
}
//订单ID。该参数只有创建包年包月ECS实例请求参数InstanceChargeType=PrePaid时有返回值。
OrderId := ""
if req.InstanceChargeType == "PrePaid" {
OrderId = *resp.OrderId
}
InstanceIds := make([]string, 0)
for _, v := range *resp.ServerIds {
InstanceIds = append(InstanceIds, v)
}
return &pbecs.CreateEcsResp{
OrderId: OrderId,
RequestId: "Huawei ECS RequestId: " + *resp.JobId,
InstanceIdSets: InstanceIds,
Finished: isFinished,
}, nil
}
func (ecs *HuaweiEcs) DeleteEcs(ctx context.Context, req *pbecs.DeleteEcsReq) (*pbecs.DeleteEcsResp, error) {
if req.GetInstanceIds() == "" {
return nil, errors.New("InstanceId is empty")
}
deleteReq := &model.DeleteServersRequest{}
InstanceIds := string_.Split(&req.InstanceIds, tea.String(","), tea.Int(-1))
Servers := make([]model.ServerId, 0)
for _, v := range InstanceIds {
Servers = append(Servers, model.ServerId{
Id: *v,
})
}
deleteReq.Body = &model.DeleteServersRequestBody{
DeletePublicip: util.EqualString(&req.DeletePublicip, tea.String("true")),
DeleteVolume: util.EqualString(&req.DeleteVolume, tea.String("true")),
Servers: Servers,
}
resp, err := ecs.cli.DeleteServers(deleteReq)
if err != nil {
return nil, errors.Wrap(err, "Huawei Delete ECS error")
}
glog.Infof("--------------------华为ECS实例删除成功--------------------")
glog.Infof(resp.String())
return &pbecs.DeleteEcsResp{
RequestId: *resp.JobId,
}, nil
}
func (ecs *HuaweiEcs) UpdateEcs(ctx context.Context, req *pbecs.UpdateEcsReq) (*pbecs.UpdateEcsResp, error) {
HostName := req.GetHostName()
InstanceName := req.GetInstanceName()
Description := req.GetDescription()
UpdateReq := &model.UpdateServerRequest{}
if req.GetInstanceIds() == "" {
return nil, errors.New("InstanceId is empty")
}
Server := &model.UpdateServerOption{}
UpdateReq.ServerId = req.GetInstanceIds()
if HostName != "" {
Server.Hostname = &HostName
}
if InstanceName != "" {
Server.Name = &InstanceName
}
if Description != "" {
Server.Description = &Description
}
UpdateReq.Body = &model.UpdateServerRequestBody{
Server: Server,
}
resp, err := ecs.cli.UpdateServer(UpdateReq)
if err != nil {
return nil, errors.Wrap(err, "Huawei Update ECS error")
}
glog.Infof("--------------------华为ECS实例修改成功--------------------")
glog.Infof(resp.String())
return &pbecs.UpdateEcsResp{
RequestId: resp.Server.Id,
}, nil
}
func (ecs *HuaweiEcs) ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (*pbecs.ListDetailResp, error) {
request := new(model.ListServersDetailsRequest)
offset := (req.PageNumber - 1) * req.PageSize
@ -73,20 +211,39 @@ func (ecs *HuaweiEcs) ListDetail(ctx context.Context, req *pbecs.ListDetailReq)
servers := *resp.Servers
var ecses = make([]*pbecs.EcsInstance, len(servers))
for k, v := range servers {
vCpu, err := strconv.ParseInt(v.Flavor.Vcpus, 10, 32)
vMemory, err := strconv.ParseInt(v.Flavor.Vcpus, 10, 32)
if err != nil {
return nil, errors.Wrap(err, "Huawei ListDetail error")
}
PublicIps := make([]string, 0)
InnerIps := make([]string, 0)
for s := range v.Addresses {
for _, a := range v.Addresses[s] {
// 判断是内网ip还是公网ip
if *a.OSEXTIPStype == model.GetServerAddressOSEXTIPStypeEnum().FIXED {
InnerIps = append(InnerIps, a.Addr)
} else {
PublicIps = append(PublicIps, a.Addr)
}
}
}
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,
Provider: pbtenant.CloudProvider_huawei,
AccountName: ecs.tenanter.AccountName(),
InstanceId: v.Id,
InstanceName: v.Name,
RegionName: ecs.region.GetName(),
InstanceType: v.Flavor.Name,
PublicIps: PublicIps,
InnerIps: InnerIps,
Cpu: int32(vCpu),
Memory: int32(vMemory),
Description: *v.Description,
Status: v.Status,
CreationTime: v.Created,
ExpireTime: v.OSSRVUSGterminatedAt,
InstanceChargeType: v.Metadata["charging_mode"],
}
}

View File

@ -2,15 +2,18 @@ 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"
string_ "github.com/alibabacloud-go/darabonba-string/client"
util "github.com/alibabacloud-go/tea-utils/service"
"github.com/alibabacloud-go/tea/tea"
"github.com/golang/glog"
"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"
"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 TencentCvm struct {
@ -41,6 +44,90 @@ func newTencentCvmClient(region tenanter.Region, tenant tenanter.Tenanter) (Ecse
}, nil
}
func (ecs *TencentCvm) CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (*pbecs.CreateEcsResp, error) {
ImageId := req.GetImageId()
InstanceType := req.GetInstanceType()
InstanceName := req.GetInstanceName()
Amount := int64(req.GetAmount())
DryRun := req.GetDryRun()
InstanceChargeType := req.GetInstanceChargeType()
ZoneId := req.GetZoneId()
request := cvm.NewRunInstancesRequest()
request.ImageId = &ImageId
request.InstanceType = &InstanceType
request.InstanceName = &InstanceName
request.DryRun = util.EqualString(&DryRun, tea.String("true"))
request.InstanceChargeType = &InstanceChargeType
request.InstanceCount = &Amount
request.Placement = &cvm.Placement{
Zone: &ZoneId,
}
resp, err := ecs.cli.RunInstances(request)
if err != nil {
return nil, errors.Wrap(err, "Tencent Create ECS error")
}
InstanceIds := make([]string, 0)
for _, v := range resp.Response.InstanceIdSet {
InstanceIds = append(InstanceIds, *v)
}
isFinished := false
if len(resp.Response.InstanceIdSet) > 0 {
isFinished = true
}
glog.Infof("--------------------腾讯ECS实例创建成功--------------------")
glog.Infof(*util.ToJSONString(util.ToMap(resp)))
return &pbecs.CreateEcsResp{
RequestId: "Tencent ECS RequestId: " + *resp.Response.RequestId,
InstanceIdSets: InstanceIds,
Finished: isFinished,
}, nil
}
func (ecs *TencentCvm) DeleteEcs(ctx context.Context, req *pbecs.DeleteEcsReq) (*pbecs.DeleteEcsResp, error) {
idStr := req.GetInstanceIds()
InstanceIds := string_.Split(&idStr, tea.String(","), tea.Int(-1))
//腾讯云支持批量操作每次请求批量实例的上限为100
if len(InstanceIds) > 100 {
return nil, errors.New("Tencent Delete ECS error InstanceIds > 100")
}
deleteReq := cvm.NewTerminateInstancesRequest()
deleteReq.InstanceIds = InstanceIds
resp, err := ecs.cli.TerminateInstances(deleteReq)
if err != nil {
return nil, errors.Wrap(err, "Tencent Delete ECS error")
}
glog.Infof("--------------------腾讯ECS实例释放成功--------------------")
glog.Infof(*util.ToJSONString(util.ToMap(resp)))
return &pbecs.DeleteEcsResp{
Provider: req.Provider,
RequestId: *resp.Response.RequestId,
AccountName: req.AccountName,
RegionId: req.RegionId,
}, nil
}
func (ecs *TencentCvm) UpdateEcs(ctx context.Context, req *pbecs.UpdateEcsReq) (*pbecs.UpdateEcsResp, error) {
InstanceName := req.GetInstanceName()
InstanceId := req.GetInstanceIds()
UpdateReq := cvm.NewModifyInstancesAttributeRequest()
if req.GetInstanceIds() == "" {
return nil, errors.New("InstanceId is empty")
}
UpdateReq.InstanceIds = string_.Split(&InstanceId, tea.String(","), tea.Int(-1))
if InstanceName != "" {
UpdateReq.InstanceName = &InstanceName
}
resp, err := ecs.cli.ModifyInstancesAttribute(UpdateReq)
if err != nil {
return nil, errors.Wrap(err, "Tencent Update ECS error")
}
glog.Infof("--------------------腾讯ECS实例修改成功--------------------")
glog.Infof(*util.ToJSONString(util.ToMap(resp)))
return &pbecs.UpdateEcsResp{
RequestId: *resp.Response.RequestId,
}, 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))
@ -52,24 +139,28 @@ func (ecs *TencentCvm) ListDetail(ctx context.Context, req *pbecs.ListDetailReq)
var ecses = make([]*pbecs.EcsInstance, len(resp.Response.InstanceSet))
for k, v := range resp.Response.InstanceSet {
ExpiredTime := ""
if v.ExpiredTime != nil {
ExpiredTime = *v.ExpiredTime
}
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,
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: ExpiredTime,
InnerIps: make([]string, len(v.PrivateIpAddresses)),
VpcId: *v.VirtualPrivateCloud.VpcId,
ResourceGroupId: "",
InstanceChargeType: *v.InstanceChargeType,
}
for k1, v1 := range v.PublicIpAddresses {
ecses[k].PublicIps[k1] = *v1

View File

@ -11,6 +11,46 @@ import (
"google.golang.org/grpc/status"
)
// CreateMultipleEcs return create cloudy ecs
func (s *Server) CreateMultipleEcs(ctx context.Context, reqs *pbecs.CreateEcsMultipleReq) (*pbecs.CreateEcsMultipleResp, error) {
resp, err := ecs.CreateMultipleEcs(ctx, reqs)
if err != nil {
glog.Errorf("ListEcsDetail error %+v", err)
return nil, status.Errorf(codes.Internal, err.Error())
}
return resp, nil
}
// CreateEcs return create ecs
func (s *Server) CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (*pbecs.CreateEcsResp, error) {
resp, err := ecs.CreateEcs(ctx, req)
if err != nil {
glog.Errorf("ListEcsDetail error %+v", err)
return nil, status.Errorf(codes.Internal, err.Error())
}
return resp, nil
}
// DeleteEcs return Delete ecs
func (s *Server) DeleteEcs(ctx context.Context, req *pbecs.DeleteEcsReq) (*pbecs.DeleteEcsResp, error) {
resp, err := ecs.DeleteEcs(ctx, req)
if err != nil {
glog.Errorf("ListEcsDetail error %+v", err)
return nil, status.Errorf(codes.Internal, err.Error())
}
return resp, nil
}
// UpdateEcs return Update ecs
func (s *Server) UpdateEcs(ctx context.Context, req *pbecs.UpdateEcsReq) (*pbecs.UpdateEcsResp, error) {
resp, err := ecs.UpdateEcs(ctx, req)
if err != nil {
glog.Errorf("ListEcsDetail error %+v", err)
return nil, status.Errorf(codes.Internal, err.Error())
}
return resp, nil
}
// ListEcsDetail return ecs detail
func (s *Server) ListEcsDetail(ctx context.Context, req *pbecs.ListDetailReq) (*pbecs.ListDetailResp, error) {
resp, err := ecs.ListDetail(ctx, req)

10
go.mod
View File

@ -3,6 +3,11 @@ module gitlink.org.cn/JCCE/PCM
go 1.17
require (
github.com/alibabacloud-go/darabonba-openapi v0.1.4
github.com/alibabacloud-go/darabonba-string v1.0.0
github.com/alibabacloud-go/ecs-20140526/v2 v2.1.0
github.com/alibabacloud-go/tea v1.1.15
github.com/alibabacloud-go/tea-utils v1.3.9
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1530
github.com/go-yaml/yaml v2.1.0+incompatible
github.com/golang/glog v1.0.0
@ -21,6 +26,10 @@ require (
)
require (
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
github.com/alibabacloud-go/openapi-util v0.0.7 // indirect
github.com/aliyun/credentials-go v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415 // indirect
github.com/golang/protobuf v1.5.2 // indirect
@ -32,6 +41,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/spf13/pflag v1.0.1 // indirect
github.com/tjfoc/gmsm v1.3.2 // 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

View File

@ -6,6 +6,7 @@ option go_package = "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs";
import "idl/pbtenant/tenant.proto";
import "google/api/annotations.proto";
//ECS
message EcsInstance {
//
pbtenant.CloudProvider provider = 1;
@ -40,9 +41,180 @@ message EcsInstance {
// id
string resource_group_id = 16;
//
string charge_type = 17;
string instance_charge_type = 17;
}
//
enum InternetChargeType {
//
PayByBandwidth = 0;
//使
PayByTraffic = 1;
}
//ECS入参
message CreateEcsMultipleReq {
repeated CreateEcsReq createEcsReqs = 1;
}
//ECS返回值
message CreateEcsMultipleResp {
// ID
repeated string request_id = 1;
// -false
bool finished = 2;
}
//ECS入参
message CreateEcsReq {
//
pbtenant.CloudProvider provider = 1;
//
string account_name = 2;
//
int32 region_id = 3;
//id
string image_id = 4;
//
string instance_charge_type = 5;
//
string instance_type = 6;
// id
string security_group_id = 7;
//id
string v_switch_id = 8;
//
string instance_name = 9;
//
string description = 10;
//id
string zone_id = 11;
//
SystemDisk system_disk = 12;
//ECS的数量
int32 amount = 13;
//,true时请求通过 Request validation has been passed with DryRun flag set
string dry_run = 14;
//N的云盘种类cloud_efficiencycloud_ssdSSD云盘cloud_essdESSD云盘cloud
string category = 15;
//PayByBandwidthPayByTraffic使
InternetChargeType internet_charge_type = 16;
//Mbit/sInternetMaxBandwidthOut的值大于0IP
int32 internet_max_bandwidth_out = 17;
// vpc id
string vpc_id = 18;
//vpcid对应VPC下已创建的子网subnetIDUUID格式
string subnet_id =19;
}
//
message SystemDisk {
//GiB20~500max{20, ImageSize}max{40, ImageId对应的镜像大小}
string size = 1;
//cloud_efficiencycloud_ssdSSD云盘cloud_essdESSD云盘cloud
string category = 2;
//
string disk_name = 3;
//
string description = 4;
//ESSD云盘作为系统盘使用时PL0IOPS 1PL1IOPS 5PL2IOPS 10PL3IOPS 100
string performance_level = 5;
//ID
string auto_snapshot_policy_id = 6;
}
//ECS返回值
message CreateEcsResp {
//
pbtenant.CloudProvider provider = 1;
// config.yaml中的配置
string account_name = 2;
// Id tenant.proto
int32 region_id = 3;
// ID
string request_id = 4;
// id
string order_id = 5;
//
float trade_price = 6;
//IDInstanceIdSet
repeated string instance_id_sets = 7;
// -false
bool finished = 8;
}
//ECS入参
message DeleteEcsReq {
//
pbtenant.CloudProvider provider = 1;
//
string account_name = 2;
//
int32 region_id = 3;
//trueAccessKey是否有效RAM用户的授权情况和是否填写了必需参数DRYRUN.SUCCESS
//false2XX HTTP状态码并直接查询资源状况
string dry_run = 4;
//Force是否强制释放****trueRunning
//falseStopped
string force = 5;
// true,false
string terminate_subscription = 6;
//ID数组以,i-8vb2nlubkow0fxbq2218,i-8vb2nlubkow0fxbq2216
string instance_ids = 7;
//IPIP资源
//true或falsefalse
string delete_publicip = 8;
//false
//true或falsefalse
string delete_volume = 9;
}
//ECS返回值
message DeleteEcsResp {
//
pbtenant.CloudProvider provider = 1;
// config.yaml中的配置
string account_name = 2;
// Id tenant.proto
int32 region_id = 3;
// ID
string request_id = 4;
}
//ECS入参
message UpdateEcsReq {
//
pbtenant.CloudProvider provider = 1;
//
string account_name = 2;
//
int32 region_id = 3;
//id
string instance_ids = 4;
// StartingECS控制台重启或者调用API RebootInstance重启
string password = 5;
//
string host_name = 6;
//
string instance_name = 7;
//
string description = 8;
//ID不能重复,
string security_group_ids = 9;
}
//ECS返回值
message UpdateEcsResp {
//
pbtenant.CloudProvider provider = 1;
// config.yaml中的配置
string account_name = 2;
// Id tenant.proto
int32 region_id = 3;
// ID
string request_id = 4;
}
//ECS入参
message ListDetailReq {
//
pbtenant.CloudProvider provider = 1;
@ -58,6 +230,7 @@ message ListDetailReq {
string next_token = 6;
}
//ECS返回值
message ListDetailResp {
// Ecs
repeated EcsInstance ecses = 1;
@ -93,27 +266,56 @@ message ListAllReq{}
// - EC2
service EcsService {
// ECS
rpc CreateMultipleEcs(CreateEcsMultipleReq) returns (CreateEcsMultipleResp) {
option (google.api.http) = {
post : "/apis/ecs/createMultiple"
body : "*"
};
}
// ECS
rpc CreateEcs(CreateEcsReq) returns (CreateEcsResp) {
option (google.api.http) = {
post : "/apis/ecs/create"
body : "*"
};
}
// ECS
rpc DeleteEcs(DeleteEcsReq) returns (DeleteEcsResp) {
option (google.api.http) = {
post : "/apis/ecs/delete"
body : "*"
};
}
// ECS
rpc UpdateEcs(UpdateEcsReq) returns (UpdateEcsResp) {
option (google.api.http) = {
put : "/apis/ecs/update"
body : "*"
};
}
// ECS明细 -
rpc ListEcsDetail(ListDetailReq) returns (ListDetailResp) {
option (google.api.http) = {
post : "/apis/ecs/detail"
body : "*"
get : "/apis/ecs/detail"
};
}
// ECS全量 -
rpc ListEcs(ListReq) returns (ListResp) {
option (google.api.http) = {
post : "/apis/ecs"
body : "*"
get : "/apis/ecs"
};
}
// ECS
rpc ListEcsAll(ListAllReq) returns (ListResp) {
option (google.api.http) = {
post : "/apis/ecs/all"
body : "*"
get : "/apis/ecs/all"
};
}
}

View File

@ -87,25 +87,27 @@ enum AliRegionId {
// _ -
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; //
tc_ap_bangkok =1; //()
tc_ap_beijing =2; //()
tc_ap_chengdu =3; //西()
tc_ap_chongqing =4; //西()
tc_ap_guangzhou =5; //(广)
tc_ap_hongkong =6; //()
tc_ap_jakarta =7; //
tc_ap_mumbai=8; // ()
tc_ap_nanjing =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 =20; //()
tc_sa_saopaulo =21; //
}
// _ -

View File

@ -77,13 +77,12 @@ func RegisterDemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/demo.DemoService/Echo", runtime.WithHTTPPathPattern("/apis/demo"))
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(ctx, inboundMarshaler, server, req, pathParams)
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 {
@ -140,13 +139,12 @@ func RegisterDemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateContext(ctx, mux, req, "/demo.DemoService/Echo", runtime.WithHTTPPathPattern("/apis/demo"))
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(ctx, inboundMarshaler, client, req, pathParams)
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)

File diff suppressed because it is too large Load Diff

View File

@ -31,8 +31,8 @@ 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
func request_EcsService_CreateMultipleEcs_0(ctx context.Context, marshaler runtime.Marshaler, client EcsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CreateEcsMultipleReq
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
@ -43,6 +43,145 @@ func request_EcsService_ListEcsDetail_0(ctx context.Context, marshaler runtime.M
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.CreateMultipleEcs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_EcsService_CreateMultipleEcs_0(ctx context.Context, marshaler runtime.Marshaler, server EcsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CreateEcsMultipleReq
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.CreateMultipleEcs(ctx, &protoReq)
return msg, metadata, err
}
func request_EcsService_CreateEcs_0(ctx context.Context, marshaler runtime.Marshaler, client EcsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CreateEcsReq
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.CreateEcs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_EcsService_CreateEcs_0(ctx context.Context, marshaler runtime.Marshaler, server EcsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CreateEcsReq
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.CreateEcs(ctx, &protoReq)
return msg, metadata, err
}
func request_EcsService_DeleteEcs_0(ctx context.Context, marshaler runtime.Marshaler, client EcsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeleteEcsReq
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.DeleteEcs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_EcsService_DeleteEcs_0(ctx context.Context, marshaler runtime.Marshaler, server EcsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeleteEcsReq
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.DeleteEcs(ctx, &protoReq)
return msg, metadata, err
}
func request_EcsService_UpdateEcs_0(ctx context.Context, marshaler runtime.Marshaler, client EcsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UpdateEcsReq
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.UpdateEcs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_EcsService_UpdateEcs_0(ctx context.Context, marshaler runtime.Marshaler, server EcsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UpdateEcsReq
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.UpdateEcs(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_EcsService_ListEcsDetail_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
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
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EcsService_ListEcsDetail_0); err != nil {
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
@ -52,11 +191,10 @@ func local_request_EcsService_ListEcsDetail_0(ctx context.Context, marshaler run
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 := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EcsService_ListEcsDetail_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -65,15 +203,18 @@ func local_request_EcsService_ListEcsDetail_0(ctx context.Context, marshaler run
}
var (
filter_EcsService_ListEcs_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
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 := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EcsService_ListEcs_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -86,11 +227,10 @@ func local_request_EcsService_ListEcs_0(ctx context.Context, marshaler runtime.M
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 := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EcsService_ListEcs_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@ -103,14 +243,6 @@ func request_EcsService_ListEcsAll_0(ctx context.Context, marshaler runtime.Mars
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
@ -120,14 +252,6 @@ func local_request_EcsService_ListEcsAll_0(ctx context.Context, marshaler runtim
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
@ -139,19 +263,110 @@ func local_request_EcsService_ListEcsAll_0(ctx context.Context, marshaler runtim
// 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) {
mux.Handle("POST", pattern_EcsService_CreateMultipleEcs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/ListEcsDetail", runtime.WithHTTPPathPattern("/apis/ecs/detail"))
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/CreateMultipleEcs")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_EcsService_ListEcsDetail_0(ctx, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_EcsService_CreateMultipleEcs_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_CreateMultipleEcs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_EcsService_CreateEcs_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/CreateEcs")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_EcsService_CreateEcs_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_CreateEcs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_EcsService_DeleteEcs_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/DeleteEcs")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_EcsService_DeleteEcs_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_DeleteEcs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("PUT", pattern_EcsService_UpdateEcs_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/UpdateEcs")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_EcsService_UpdateEcs_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_UpdateEcs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", 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 {
@ -163,19 +378,18 @@ func RegisterEcsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
})
mux.Handle("POST", pattern_EcsService_ListEcs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("GET", 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)
var err error
ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/ListEcs", runtime.WithHTTPPathPattern("/apis/ecs"))
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(ctx, inboundMarshaler, server, req, pathParams)
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 {
@ -187,19 +401,18 @@ func RegisterEcsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
})
mux.Handle("POST", pattern_EcsService_ListEcsAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("GET", 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)
var err error
ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/ListEcsAll", runtime.WithHTTPPathPattern("/apis/ecs/all"))
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(ctx, inboundMarshaler, server, req, pathParams)
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 {
@ -252,17 +465,96 @@ func RegisterEcsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn
// "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) {
mux.Handle("POST", pattern_EcsService_CreateMultipleEcs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/ListEcsDetail", runtime.WithHTTPPathPattern("/apis/ecs/detail"))
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/CreateMultipleEcs")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_EcsService_ListEcsDetail_0(ctx, inboundMarshaler, client, req, pathParams)
resp, md, err := request_EcsService_CreateMultipleEcs_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_CreateMultipleEcs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_EcsService_CreateEcs_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/CreateEcs")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_EcsService_CreateEcs_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_CreateEcs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_EcsService_DeleteEcs_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/DeleteEcs")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_EcsService_DeleteEcs_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_DeleteEcs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("PUT", pattern_EcsService_UpdateEcs_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/UpdateEcs")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_EcsService_UpdateEcs_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_UpdateEcs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", 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)
@ -273,17 +565,16 @@ func RegisterEcsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
})
mux.Handle("POST", pattern_EcsService_ListEcs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("GET", 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)
var err error
ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/ListEcs", runtime.WithHTTPPathPattern("/apis/ecs"))
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(ctx, inboundMarshaler, client, req, pathParams)
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)
@ -294,17 +585,16 @@ func RegisterEcsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
})
mux.Handle("POST", pattern_EcsService_ListEcsAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("GET", 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)
var err error
ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/ListEcsAll", runtime.WithHTTPPathPattern("/apis/ecs/all"))
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(ctx, inboundMarshaler, client, req, pathParams)
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)
@ -319,6 +609,14 @@ func RegisterEcsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
}
var (
pattern_EcsService_CreateMultipleEcs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "ecs", "createMultiple"}, ""))
pattern_EcsService_CreateEcs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "ecs", "create"}, ""))
pattern_EcsService_DeleteEcs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "ecs", "delete"}, ""))
pattern_EcsService_UpdateEcs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "ecs", "update"}, ""))
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"}, ""))
@ -327,6 +625,14 @@ var (
)
var (
forward_EcsService_CreateMultipleEcs_0 = runtime.ForwardResponseMessage
forward_EcsService_CreateEcs_0 = runtime.ForwardResponseMessage
forward_EcsService_DeleteEcs_0 = runtime.ForwardResponseMessage
forward_EcsService_UpdateEcs_0 = runtime.ForwardResponseMessage
forward_EcsService_ListEcsDetail_0 = runtime.ForwardResponseMessage
forward_EcsService_ListEcs_0 = runtime.ForwardResponseMessage

View File

@ -22,6 +22,14 @@ const _ = grpc.SupportPackageIsVersion7
//
// 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
CreateMultipleEcs(ctx context.Context, in *CreateEcsMultipleReq, opts ...grpc.CallOption) (*CreateEcsMultipleResp, error)
// 创建ECS
CreateEcs(ctx context.Context, in *CreateEcsReq, opts ...grpc.CallOption) (*CreateEcsResp, error)
// 删除ECS
DeleteEcs(ctx context.Context, in *DeleteEcsReq, opts ...grpc.CallOption) (*DeleteEcsResp, error)
// 修改ECS
UpdateEcs(ctx context.Context, in *UpdateEcsReq, opts ...grpc.CallOption) (*UpdateEcsResp, error)
// 查询ECS明细 - 支持云类型、区域、账户、分页等过滤条件
ListEcsDetail(ctx context.Context, in *ListDetailReq, opts ...grpc.CallOption) (*ListDetailResp, error)
// 查询ECS全量 - 根据云类型
@ -38,6 +46,42 @@ func NewEcsServiceClient(cc grpc.ClientConnInterface) EcsServiceClient {
return &ecsServiceClient{cc}
}
func (c *ecsServiceClient) CreateMultipleEcs(ctx context.Context, in *CreateEcsMultipleReq, opts ...grpc.CallOption) (*CreateEcsMultipleResp, error) {
out := new(CreateEcsMultipleResp)
err := c.cc.Invoke(ctx, "/pbecs.EcsService/CreateMultipleEcs", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ecsServiceClient) CreateEcs(ctx context.Context, in *CreateEcsReq, opts ...grpc.CallOption) (*CreateEcsResp, error) {
out := new(CreateEcsResp)
err := c.cc.Invoke(ctx, "/pbecs.EcsService/CreateEcs", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ecsServiceClient) DeleteEcs(ctx context.Context, in *DeleteEcsReq, opts ...grpc.CallOption) (*DeleteEcsResp, error) {
out := new(DeleteEcsResp)
err := c.cc.Invoke(ctx, "/pbecs.EcsService/DeleteEcs", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ecsServiceClient) UpdateEcs(ctx context.Context, in *UpdateEcsReq, opts ...grpc.CallOption) (*UpdateEcsResp, error) {
out := new(UpdateEcsResp)
err := c.cc.Invoke(ctx, "/pbecs.EcsService/UpdateEcs", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
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...)
@ -69,6 +113,14 @@ func (c *ecsServiceClient) ListEcsAll(ctx context.Context, in *ListAllReq, opts
// All implementations must embed UnimplementedEcsServiceServer
// for forward compatibility
type EcsServiceServer interface {
// 创建多家云ECS
CreateMultipleEcs(context.Context, *CreateEcsMultipleReq) (*CreateEcsMultipleResp, error)
// 创建ECS
CreateEcs(context.Context, *CreateEcsReq) (*CreateEcsResp, error)
// 删除ECS
DeleteEcs(context.Context, *DeleteEcsReq) (*DeleteEcsResp, error)
// 修改ECS
UpdateEcs(context.Context, *UpdateEcsReq) (*UpdateEcsResp, error)
// 查询ECS明细 - 支持云类型、区域、账户、分页等过滤条件
ListEcsDetail(context.Context, *ListDetailReq) (*ListDetailResp, error)
// 查询ECS全量 - 根据云类型
@ -82,6 +134,18 @@ type EcsServiceServer interface {
type UnimplementedEcsServiceServer struct {
}
func (UnimplementedEcsServiceServer) CreateMultipleEcs(context.Context, *CreateEcsMultipleReq) (*CreateEcsMultipleResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateMultipleEcs not implemented")
}
func (UnimplementedEcsServiceServer) CreateEcs(context.Context, *CreateEcsReq) (*CreateEcsResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateEcs not implemented")
}
func (UnimplementedEcsServiceServer) DeleteEcs(context.Context, *DeleteEcsReq) (*DeleteEcsResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteEcs not implemented")
}
func (UnimplementedEcsServiceServer) UpdateEcs(context.Context, *UpdateEcsReq) (*UpdateEcsResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateEcs not implemented")
}
func (UnimplementedEcsServiceServer) ListEcsDetail(context.Context, *ListDetailReq) (*ListDetailResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListEcsDetail not implemented")
}
@ -104,6 +168,78 @@ func RegisterEcsServiceServer(s grpc.ServiceRegistrar, srv EcsServiceServer) {
s.RegisterService(&EcsService_ServiceDesc, srv)
}
func _EcsService_CreateMultipleEcs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateEcsMultipleReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EcsServiceServer).CreateMultipleEcs(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pbecs.EcsService/CreateMultipleEcs",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EcsServiceServer).CreateMultipleEcs(ctx, req.(*CreateEcsMultipleReq))
}
return interceptor(ctx, in, info, handler)
}
func _EcsService_CreateEcs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateEcsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EcsServiceServer).CreateEcs(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pbecs.EcsService/CreateEcs",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EcsServiceServer).CreateEcs(ctx, req.(*CreateEcsReq))
}
return interceptor(ctx, in, info, handler)
}
func _EcsService_DeleteEcs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteEcsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EcsServiceServer).DeleteEcs(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pbecs.EcsService/DeleteEcs",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EcsServiceServer).DeleteEcs(ctx, req.(*DeleteEcsReq))
}
return interceptor(ctx, in, info, handler)
}
func _EcsService_UpdateEcs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateEcsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EcsServiceServer).UpdateEcs(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pbecs.EcsService/UpdateEcs",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EcsServiceServer).UpdateEcs(ctx, req.(*UpdateEcsReq))
}
return interceptor(ctx, in, info, handler)
}
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 {
@ -165,6 +301,22 @@ var EcsService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "pbecs.EcsService",
HandlerType: (*EcsServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateMultipleEcs",
Handler: _EcsService_CreateMultipleEcs_Handler,
},
{
MethodName: "CreateEcs",
Handler: _EcsService_CreateEcs_Handler,
},
{
MethodName: "DeleteEcs",
Handler: _EcsService_DeleteEcs_Handler,
},
{
MethodName: "UpdateEcs",
Handler: _EcsService_UpdateEcs_Handler,
},
{
MethodName: "ListEcsDetail",
Handler: _EcsService_ListEcsDetail_Handler,

View File

@ -269,13 +269,12 @@ func RegisterPodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/CreatePods", runtime.WithHTTPPathPattern("/apis/pod/createMulti"))
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/CreatePods")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_PodService_CreatePods_0(ctx, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_PodService_CreatePods_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 {
@ -293,13 +292,12 @@ func RegisterPodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/CreatePod", runtime.WithHTTPPathPattern("/apis/pod/create"))
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/CreatePod")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_PodService_CreatePod_0(ctx, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_PodService_CreatePod_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 {
@ -317,13 +315,12 @@ func RegisterPodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/DeletePod", runtime.WithHTTPPathPattern("/apis/pod/delete"))
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/DeletePod")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_PodService_DeletePod_0(ctx, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_PodService_DeletePod_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 {
@ -341,13 +338,12 @@ func RegisterPodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/UpdatePod", runtime.WithHTTPPathPattern("/apis/pod/update"))
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/UpdatePod")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_PodService_UpdatePod_0(ctx, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_PodService_UpdatePod_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 {
@ -365,13 +361,12 @@ func RegisterPodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPodDetail", runtime.WithHTTPPathPattern("/apis/pod/detail"))
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPodDetail")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_PodService_ListPodDetail_0(ctx, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_PodService_ListPodDetail_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 {
@ -389,13 +384,12 @@ func RegisterPodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPod", runtime.WithHTTPPathPattern("/apis/pod"))
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPod")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_PodService_ListPod_0(ctx, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_PodService_ListPod_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 {
@ -413,13 +407,12 @@ func RegisterPodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPodAll", runtime.WithHTTPPathPattern("/apis/pod/all"))
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPodAll")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_PodService_ListPodAll_0(ctx, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_PodService_ListPodAll_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 {
@ -476,13 +469,12 @@ func RegisterPodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/CreatePods", runtime.WithHTTPPathPattern("/apis/pod/createMulti"))
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/CreatePods")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_PodService_CreatePods_0(ctx, inboundMarshaler, client, req, pathParams)
resp, md, err := request_PodService_CreatePods_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@ -497,13 +489,12 @@ func RegisterPodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/CreatePod", runtime.WithHTTPPathPattern("/apis/pod/create"))
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/CreatePod")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_PodService_CreatePod_0(ctx, inboundMarshaler, client, req, pathParams)
resp, md, err := request_PodService_CreatePod_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@ -518,13 +509,12 @@ func RegisterPodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/DeletePod", runtime.WithHTTPPathPattern("/apis/pod/delete"))
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/DeletePod")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_PodService_DeletePod_0(ctx, inboundMarshaler, client, req, pathParams)
resp, md, err := request_PodService_DeletePod_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@ -539,13 +529,12 @@ func RegisterPodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/UpdatePod", runtime.WithHTTPPathPattern("/apis/pod/update"))
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/UpdatePod")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_PodService_UpdatePod_0(ctx, inboundMarshaler, client, req, pathParams)
resp, md, err := request_PodService_UpdatePod_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@ -560,13 +549,12 @@ func RegisterPodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPodDetail", runtime.WithHTTPPathPattern("/apis/pod/detail"))
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPodDetail")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_PodService_ListPodDetail_0(ctx, inboundMarshaler, client, req, pathParams)
resp, md, err := request_PodService_ListPodDetail_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@ -581,13 +569,12 @@ func RegisterPodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPod", runtime.WithHTTPPathPattern("/apis/pod"))
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPod")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_PodService_ListPod_0(ctx, inboundMarshaler, client, req, pathParams)
resp, md, err := request_PodService_ListPod_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
@ -602,13 +589,12 @@ func RegisterPodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPodAll", runtime.WithHTTPPathPattern("/apis/pod/all"))
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPodAll")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_PodService_ListPodAll_0(ctx, inboundMarshaler, client, req, pathParams)
resp, md, err := request_PodService_ListPodAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)

View File

@ -262,26 +262,28 @@ func (AliRegionId) EnumDescriptor() ([]byte, []int) {
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 // 多伦多
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_hongkong TencentRegionId = 6 //港澳台地区(中国香港)
TencentRegionId_tc_ap_jakarta TencentRegionId = 7 //亚太东南(雅加达)
TencentRegionId_tc_ap_mumbai TencentRegionId = 8 // 亚太南部(孟买)
TencentRegionId_tc_ap_nanjing TencentRegionId = 9 //华东地区(南京)
TencentRegionId_tc_ap_seoul TencentRegionId = 10 //亚太东北(首尔)
TencentRegionId_tc_ap_shanghai TencentRegionId = 11 //华东地区(上海)
TencentRegionId_tc_ap_shanghai_fsi TencentRegionId = 12 //华东地区(上海金融)
TencentRegionId_tc_ap_shenzhen_fsi TencentRegionId = 13 //华南地区(深圳金融)
TencentRegionId_tc_ap_singapore TencentRegionId = 14 //亚太东南(新加坡)
TencentRegionId_tc_ap_tokyo TencentRegionId = 15 //亚太东北(东京)
TencentRegionId_tc_eu_frankfurt TencentRegionId = 16 //欧洲地区(法兰克福)
TencentRegionId_tc_eu_moscow TencentRegionId = 17 //欧洲地区(莫斯科)
TencentRegionId_tc_na_ashburn TencentRegionId = 18 //美国东部(弗吉尼亚)
TencentRegionId_tc_na_siliconvalley TencentRegionId = 19 //美国西部(硅谷)
TencentRegionId_tc_na_toronto TencentRegionId = 20 //北美地区(多伦多)
TencentRegionId_tc_sa_saopaulo TencentRegionId = 21 //南美地区(圣保罗)
)
// Enum value maps for TencentRegionId.
@ -293,42 +295,46 @@ var (
3: "tc_ap_chengdu",
4: "tc_ap_chongqing",
5: "tc_ap_guangzhou",
6: "tc_ap_guangzhou_open",
7: "tc_ap_hongkong",
6: "tc_ap_hongkong",
7: "tc_ap_jakarta",
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",
9: "tc_ap_nanjing",
10: "tc_ap_seoul",
11: "tc_ap_shanghai",
12: "tc_ap_shanghai_fsi",
13: "tc_ap_shenzhen_fsi",
14: "tc_ap_singapore",
15: "tc_ap_tokyo",
16: "tc_eu_frankfurt",
17: "tc_eu_moscow",
18: "tc_na_ashburn",
19: "tc_na_siliconvalley",
20: "tc_na_toronto",
21: "tc_sa_saopaulo",
}
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,
"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_hongkong": 6,
"tc_ap_jakarta": 7,
"tc_ap_mumbai": 8,
"tc_ap_nanjing": 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": 20,
"tc_sa_saopaulo": 21,
}
)
@ -799,7 +805,7 @@ var file_idl_pbtenant_tenant_proto_rawDesc = []byte{
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, 0x2a, 0xa1, 0x03, 0x0a, 0x0f, 0x54, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x67,
0x16, 0x2a, 0xc1, 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,
@ -807,25 +813,27 @@ var file_idl_pbtenant_tenant_proto_rawDesc = []byte{
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, 0xfb, 0x01, 0x0a, 0x0e, 0x48, 0x75, 0x61, 0x77, 0x65, 0x69,
0x6f, 0x75, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x68, 0x6f,
0x6e, 0x67, 0x6b, 0x6f, 0x6e, 0x67, 0x10, 0x06, 0x12, 0x11, 0x0a, 0x0d, 0x74, 0x63, 0x5f, 0x61,
0x70, 0x5f, 0x6a, 0x61, 0x6b, 0x61, 0x72, 0x74, 0x61, 0x10, 0x07, 0x12, 0x10, 0x0a, 0x0c, 0x74,
0x63, 0x5f, 0x61, 0x70, 0x5f, 0x6d, 0x75, 0x6d, 0x62, 0x61, 0x69, 0x10, 0x08, 0x12, 0x11, 0x0a,
0x0d, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x6e, 0x61, 0x6e, 0x6a, 0x69, 0x6e, 0x67, 0x10, 0x09,
0x12, 0x0f, 0x0a, 0x0b, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x65, 0x6f, 0x75, 0x6c, 0x10,
0x0a, 0x12, 0x12, 0x0a, 0x0e, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x68, 0x61, 0x6e, 0x67,
0x68, 0x61, 0x69, 0x10, 0x0b, 0x12, 0x16, 0x0a, 0x12, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x73,
0x68, 0x61, 0x6e, 0x67, 0x68, 0x61, 0x69, 0x5f, 0x66, 0x73, 0x69, 0x10, 0x0c, 0x12, 0x16, 0x0a,
0x12, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x73, 0x68, 0x65, 0x6e, 0x7a, 0x68, 0x65, 0x6e, 0x5f,
0x66, 0x73, 0x69, 0x10, 0x0d, 0x12, 0x13, 0x0a, 0x0f, 0x74, 0x63, 0x5f, 0x61, 0x70, 0x5f, 0x73,
0x69, 0x6e, 0x67, 0x61, 0x70, 0x6f, 0x72, 0x65, 0x10, 0x0e, 0x12, 0x0f, 0x0a, 0x0b, 0x74, 0x63,
0x5f, 0x61, 0x70, 0x5f, 0x74, 0x6f, 0x6b, 0x79, 0x6f, 0x10, 0x0f, 0x12, 0x13, 0x0a, 0x0f, 0x74,
0x63, 0x5f, 0x65, 0x75, 0x5f, 0x66, 0x72, 0x61, 0x6e, 0x6b, 0x66, 0x75, 0x72, 0x74, 0x10, 0x10,
0x12, 0x10, 0x0a, 0x0c, 0x74, 0x63, 0x5f, 0x65, 0x75, 0x5f, 0x6d, 0x6f, 0x73, 0x63, 0x6f, 0x77,
0x10, 0x11, 0x12, 0x11, 0x0a, 0x0d, 0x74, 0x63, 0x5f, 0x6e, 0x61, 0x5f, 0x61, 0x73, 0x68, 0x62,
0x75, 0x72, 0x6e, 0x10, 0x12, 0x12, 0x17, 0x0a, 0x13, 0x74, 0x63, 0x5f, 0x6e, 0x61, 0x5f, 0x73,
0x69, 0x6c, 0x69, 0x63, 0x6f, 0x6e, 0x76, 0x61, 0x6c, 0x6c, 0x65, 0x79, 0x10, 0x13, 0x12, 0x11,
0x0a, 0x0d, 0x74, 0x63, 0x5f, 0x6e, 0x61, 0x5f, 0x74, 0x6f, 0x72, 0x6f, 0x6e, 0x74, 0x6f, 0x10,
0x14, 0x12, 0x12, 0x0a, 0x0e, 0x74, 0x63, 0x5f, 0x73, 0x61, 0x5f, 0x73, 0x61, 0x6f, 0x70, 0x61,
0x75, 0x6c, 0x6f, 0x10, 0x15, 0x2a, 0xfb, 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,

View File

@ -68,11 +68,14 @@
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"typeUrl": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
},
"additionalProperties": {}
}
},
"rpcStatus": {
"type": "object",

View File

@ -17,7 +17,7 @@
],
"paths": {
"/apis/ecs": {
"post": {
"get": {
"summary": "查询ECS全量 - 根据云类型",
"operationId": "EcsService_ListEcs",
"responses": {
@ -36,12 +36,19 @@
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/pbecsListReq"
}
"name": "provider",
"description": "云名称.\n\n - ali: 0 - 阿里云\n - tencent: 1 - 腾讯云\n - huawei: 2 - 华为云\n - k8s: 3 - K8S\n - harvester: 3 - Harvester",
"in": "query",
"required": false,
"type": "string",
"enum": [
"ali",
"tencent",
"huawei",
"k8s",
"harvester"
],
"default": "ali"
}
],
"tags": [
@ -50,7 +57,7 @@
}
},
"/apis/ecs/all": {
"post": {
"get": {
"summary": "查询所有云的ECS",
"operationId": "EcsService_ListEcsAll",
"responses": {
@ -67,13 +74,102 @@
}
}
},
"tags": [
"EcsService"
]
}
},
"/apis/ecs/create": {
"post": {
"summary": "创建ECS",
"operationId": "EcsService_CreateEcs",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/pbecsCreateEcsResp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/pbecsListAllReq"
"$ref": "#/definitions/pbecsCreateEcsReq"
}
}
],
"tags": [
"EcsService"
]
}
},
"/apis/ecs/createMultiple": {
"post": {
"summary": "创建多家云ECS",
"operationId": "EcsService_CreateMultipleEcs",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/pbecsCreateEcsMultipleResp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/pbecsCreateEcsMultipleReq"
}
}
],
"tags": [
"EcsService"
]
}
},
"/apis/ecs/delete": {
"post": {
"summary": "删除ECS",
"operationId": "EcsService_DeleteEcs",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/pbecsDeleteEcsResp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/pbecsDeleteEcsReq"
}
}
],
@ -83,7 +179,7 @@
}
},
"/apis/ecs/detail": {
"post": {
"get": {
"summary": "查询ECS明细 - 支持云类型、区域、账户、分页等过滤条件",
"operationId": "EcsService_ListEcsDetail",
"responses": {
@ -100,13 +196,91 @@
}
}
},
"parameters": [
{
"name": "provider",
"description": "云名称.\n\n - ali: 0 - 阿里云\n - tencent: 1 - 腾讯云\n - huawei: 2 - 华为云\n - k8s: 3 - K8S\n - harvester: 3 - Harvester",
"in": "query",
"required": false,
"type": "string",
"enum": [
"ali",
"tencent",
"huawei",
"k8s",
"harvester"
],
"default": "ali"
},
{
"name": "accountName",
"description": "账户名称根据config.yaml中的配置默认为第一个配置的账户.",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "regionId",
"description": "区域Id参考 tenant.proto 中的各个云的区域.",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "pageNumber",
"description": "分页相关参数,页码.",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "pageSize",
"description": "分页相关参数,每页数量.",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "nextToken",
"description": "分页相关参数下一页的token.",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
"EcsService"
]
}
},
"/apis/ecs/update": {
"put": {
"summary": "修改ECS",
"operationId": "EcsService_UpdateEcs",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/pbecsUpdateEcsResp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/pbecsListDetailReq"
"$ref": "#/definitions/pbecsUpdateEcsReq"
}
}
],
@ -117,6 +291,229 @@
}
},
"definitions": {
"pbecsCreateEcsMultipleReq": {
"type": "object",
"properties": {
"createEcsReqs": {
"type": "array",
"items": {
"$ref": "#/definitions/pbecsCreateEcsReq"
}
}
},
"title": "创建多家云ECS入参"
},
"pbecsCreateEcsMultipleResp": {
"type": "object",
"properties": {
"requestId": {
"type": "array",
"items": {
"type": "string"
},
"title": "请求ID"
},
"finished": {
"type": "boolean",
"title": "查询是否完成,如果为否-false则可以将下面三个分页参数填入到请求中继续查询"
}
},
"title": "创建多家云ECS返回值"
},
"pbecsCreateEcsReq": {
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/pbtenantCloudProvider",
"title": "云类型"
},
"accountName": {
"type": "string",
"title": "账号名称"
},
"regionId": {
"type": "integer",
"format": "int32",
"title": "地域,数据中心"
},
"imageId": {
"type": "string",
"title": "镜像id"
},
"instanceChargeType": {
"type": "string",
"title": "实例的付费方式"
},
"instanceType": {
"type": "string",
"title": "实例的资源规格"
},
"securityGroupId": {
"type": "string",
"title": "安全组id"
},
"vSwitchId": {
"type": "string",
"title": "交换机id"
},
"instanceName": {
"type": "string",
"title": "实例名称"
},
"description": {
"type": "string",
"title": "实例描述"
},
"zoneId": {
"type": "string",
"title": "可用区id"
},
"systemDisk": {
"$ref": "#/definitions/pbecsSystemDisk",
"title": "系统磁盘"
},
"amount": {
"type": "integer",
"format": "int32",
"title": "创建ECS的数量"
},
"dryRun": {
"type": "string",
"title": "预检此次请求,为true时请求通过则返回 Request validation has been passed with DryRun flag set"
},
"category": {
"type": "string",
"title": "数据盘N的云盘种类。取值范围cloud_efficiency高效云盘cloud_ssdSSD云盘cloud_essdESSD云盘cloud普通云盘。"
},
"internetChargeType": {
"$ref": "#/definitions/pbecsInternetChargeType",
"title": "网络计费类型。取值范围PayByBandwidth按固定带宽计费。PayByTraffic默认按使用流量计费"
},
"internetMaxBandwidthOut": {
"type": "integer",
"format": "int32",
"title": "公网入带宽最大值单位为Mbit/s。创建的实例如果参数InternetMaxBandwidthOut的值大于0则自动为实例分配公网IP。"
},
"vpcId": {
"type": "string",
"title": "vpc id 华为云必需"
},
"subnetId": {
"type": "string",
"title": "待创建云服务器所在的子网信息。需要指定vpcid对应VPC下已创建的子网subnet的网络IDUUID格式。华为云必需"
}
},
"title": "创建ECS入参"
},
"pbecsCreateEcsResp": {
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/pbtenantCloudProvider",
"title": "云名称"
},
"accountName": {
"type": "string",
"title": "账户名称根据config.yaml中的配置默认为第一个配置的账户"
},
"regionId": {
"type": "integer",
"format": "int32",
"title": "区域Id参考 tenant.proto 中的各个云的区域"
},
"requestId": {
"type": "string",
"title": "请求ID"
},
"orderId": {
"type": "string",
"title": "订单id"
},
"tradePrice": {
"type": "number",
"format": "float",
"title": "订单成交价"
},
"instanceIdSets": {
"type": "array",
"items": {
"type": "string"
},
"title": "实例IDInstanceIdSet列表"
},
"finished": {
"type": "boolean",
"title": "查询是否完成,如果为否-false则可以将下面三个分页参数填入到请求中继续查询"
}
},
"title": "创建ECS返回值"
},
"pbecsDeleteEcsReq": {
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/pbtenantCloudProvider",
"title": "云类型"
},
"accountName": {
"type": "string",
"title": "账号名称"
},
"regionId": {
"type": "integer",
"format": "int32",
"title": "地域,数据中心"
},
"dryRun": {
"type": "string",
"title": "是否只预检此次请求是否只预检此次请求。true发送检查请求不会查询资源状况。检查项包括AccessKey是否有效、RAM用户的授权情况和是否填写了必需参数。如果检查不通过则返回对应错误。如果检查通过会返回错误码DRYRUN.SUCCESS。\nfalse默认值发送正常请求通过检查后返回2XX HTTP状态码并直接查询资源状况。"
},
"force": {
"type": "string",
"title": "Force是否强制释放**运行中**true强制释放运行中Running的实例。强制释放相当于断电实例内存以及存储中的临时数据都会被擦除无法恢复。\nfalse默认值正常释放实例此时实例必须处于已停止Stopped状态"
},
"terminateSubscription": {
"type": "string",
"title": "是否释放已到期的包年包月实例 true,false"
},
"instanceIds": {
"type": "string",
"title": "实例ID数组以”,“分割。列i-8vb2nlubkow0fxbq2218,i-8vb2nlubkow0fxbq2216"
},
"deletePublicip": {
"type": "string",
"title": "配置删除云服务器是否删除云服务器绑定的弹性IP。如果选择不删除则系统仅做解绑定操作保留弹性IP资源。\n取值为true或false。默认false华为云"
},
"deleteVolume": {
"type": "string",
"title": "配置删除云服务器是否删除云服务器对应的数据盘如果选择不删除则系统仅做卸载操作保留云硬盘资源。默认为false。\n取值为true或false。默认false华为云"
}
},
"title": "删除ECS入参"
},
"pbecsDeleteEcsResp": {
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/pbtenantCloudProvider",
"title": "云名称"
},
"accountName": {
"type": "string",
"title": "账户名称根据config.yaml中的配置默认为第一个配置的账户"
},
"regionId": {
"type": "integer",
"format": "int32",
"title": "区域Id参考 tenant.proto 中的各个云的区域"
},
"requestId": {
"type": "string",
"title": "请求ID"
}
},
"title": "删除ECS返回值"
},
"pbecsEcsInstance": {
"type": "object",
"properties": {
@ -192,46 +589,22 @@
"type": "string",
"title": "资源组id"
},
"chargeType": {
"instanceChargeType": {
"type": "string",
"title": "收费类型"
}
}
},
"title": "ECS 实例"
},
"pbecsListAllReq": {
"type": "object"
},
"pbecsListDetailReq": {
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/pbtenantCloudProvider",
"title": "云名称"
},
"accountName": {
"type": "string",
"title": "账户名称根据config.yaml中的配置默认为第一个配置的账户"
},
"regionId": {
"type": "integer",
"format": "int32",
"title": "区域Id参考 tenant.proto 中的各个云的区域"
},
"pageNumber": {
"type": "integer",
"format": "int32",
"title": "分页相关参数,页码"
},
"pageSize": {
"type": "integer",
"format": "int32",
"title": "分页相关参数,每页数量"
},
"nextToken": {
"type": "string",
"title": "分页相关参数下一页的token"
}
}
"pbecsInternetChargeType": {
"type": "string",
"enum": [
"PayByBandwidth",
"PayByTraffic"
],
"default": "PayByBandwidth",
"description": "- PayByBandwidth: 按固定带宽计费。\n - PayByTraffic: (默认):按使用流量计费",
"title": "网络计费类型"
},
"pbecsListDetailResp": {
"type": "object",
@ -265,16 +638,8 @@
"type": "string",
"title": "请求id出现问题后提供给云厂商排查问题"
}
}
},
"pbecsListReq": {
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/pbtenantCloudProvider",
"title": "云名称"
}
}
},
"title": "查询ECS返回值"
},
"pbecsListResp": {
"type": "object",
@ -288,6 +653,102 @@
}
}
},
"pbecsSystemDisk": {
"type": "object",
"properties": {
"size": {
"type": "string",
"title": "系统盘大小单位为GiB。取值范围20~500。该参数的取值必须大于或者等于max{20, ImageSize}。默认值max{40, 参数ImageId对应的镜像大小}"
},
"category": {
"type": "string",
"title": "系统盘类型。系统盘的云盘种类。取值范围cloud_efficiency高效云盘。cloud_ssdSSD云盘。cloud_essdESSD云盘。cloud普通云盘。"
},
"diskName": {
"type": "string",
"title": "系统盘名称"
},
"description": {
"type": "string",
"title": "系统盘描述"
},
"performanceLevel": {
"type": "string",
"title": "创建ESSD云盘作为系统盘使用时设置云盘的性能等级。取值范围PL0单盘最高随机读写IOPS 1万。PL1默认单盘最高随机读写IOPS 5万。PL2单盘最高随机读写IOPS 10万。PL3单盘最高随机读写IOPS 100万。"
},
"autoSnapshotPolicyId": {
"type": "string",
"title": "系统盘采用的自动快照策略ID。"
}
},
"title": "系统磁盘"
},
"pbecsUpdateEcsReq": {
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/pbtenantCloudProvider",
"title": "云类型"
},
"accountName": {
"type": "string",
"title": "账号名称"
},
"regionId": {
"type": "integer",
"format": "int32",
"title": "地域,数据中心"
},
"instanceIds": {
"type": "string",
"title": "实例id"
},
"password": {
"type": "string",
"title": "实例状态不能为启动中Starting。重启实例后重置生效且必须是在ECS控制台重启或者调用API RebootInstance重启新密码才能生效。在操作系统内部重启不能生效。"
},
"hostName": {
"type": "string",
"title": "操作系统的主机名"
},
"instanceName": {
"type": "string",
"title": "实例名称"
},
"description": {
"type": "string",
"title": "实例描述"
},
"securityGroupIds": {
"type": "string",
"title": "实例重新加入的安全组列表安全组ID不能重复。以”,“分割"
}
},
"title": "更新ECS入参"
},
"pbecsUpdateEcsResp": {
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/pbtenantCloudProvider",
"title": "云名称"
},
"accountName": {
"type": "string",
"title": "账户名称根据config.yaml中的配置默认为第一个配置的账户"
},
"regionId": {
"type": "integer",
"format": "int32",
"title": "区域Id参考 tenant.proto 中的各个云的区域"
},
"requestId": {
"type": "string",
"title": "请求ID"
}
},
"title": "更新ECS返回值"
},
"pbtenantCloudProvider": {
"type": "string",
"enum": [
@ -304,11 +765,14 @@
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"typeUrl": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
},
"additionalProperties": {}
}
},
"rpcStatus": {
"type": "object",

View File

@ -37,7 +37,7 @@
"parameters": [
{
"name": "provider",
"description": "云名称\n\n - ali: 0 - 阿里云\n - tencent: 1 - 腾讯云\n - huawei: 2 - 华为云\n - k8s: 3 - K8S\n - harvester: 3 - Harvester",
"description": "云名称.\n\n - ali: 0 - 阿里云\n - tencent: 1 - 腾讯云\n - huawei: 2 - 华为云\n - k8s: 3 - K8S\n - harvester: 3 - Harvester",
"in": "query",
"required": false,
"type": "string",
@ -205,7 +205,7 @@
"parameters": [
{
"name": "provider",
"description": "云名称\n\n - ali: 0 - 阿里云\n - tencent: 1 - 腾讯云\n - huawei: 2 - 华为云\n - k8s: 3 - K8S\n - harvester: 3 - Harvester",
"description": "云名称.\n\n - ali: 0 - 阿里云\n - tencent: 1 - 腾讯云\n - huawei: 2 - 华为云\n - k8s: 3 - K8S\n - harvester: 3 - Harvester",
"in": "query",
"required": false,
"type": "string",
@ -220,14 +220,14 @@
},
{
"name": "accountName",
"description": "账户名称根据config.yaml中的配置默认为第一个配置的账户",
"description": "账户名称根据config.yaml中的配置默认为第一个配置的账户.",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "regionId",
"description": "区域Id参考 tenant.proto 中的各个云的区域",
"description": "区域Id参考 tenant.proto 中的各个云的区域.",
"in": "query",
"required": false,
"type": "integer",
@ -235,7 +235,7 @@
},
{
"name": "regionName",
"description": "区域名称各云厂商自定义的region name",
"description": "区域名称各云厂商自定义的region name.",
"in": "query",
"required": false,
"type": "integer",
@ -243,7 +243,7 @@
},
{
"name": "podId",
"description": "podID",
"description": "podID.",
"in": "query",
"required": false,
"type": "integer",
@ -251,7 +251,7 @@
},
{
"name": "pageNumber",
"description": "分页相关参数,页码",
"description": "分页相关参数,页码.",
"in": "query",
"required": false,
"type": "integer",
@ -259,7 +259,7 @@
},
{
"name": "pageSize",
"description": "分页相关参数,每页数量",
"description": "分页相关参数,每页数量.",
"in": "query",
"required": false,
"type": "integer",
@ -267,14 +267,14 @@
},
{
"name": "nextToken",
"description": "分页相关参数下一页的token",
"description": "分页相关参数下一页的token.",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "namespace",
"description": "namespace",
"description": "namespace.",
"in": "query",
"required": false,
"type": "string"
@ -675,11 +675,14 @@
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"typeUrl": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
},
"additionalProperties": {}
}
},
"rpcStatus": {
"type": "object",

View File

@ -15,11 +15,14 @@
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"typeUrl": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
},
"additionalProperties": {}
}
},
"rpcStatus": {
"type": "object",