parent
4f2bc720d9
commit
aff1665783
|
@ -4,34 +4,50 @@ 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, req *pbecs.CreateEcsReq) (*pbecs.CreateEcsResp, error) {
|
||||
//CreateMultipleEcs 创建多云ECS
|
||||
func CreateMultipleEcs(ctx context.Context, reqs *pbecs.CreateEcsMultipleReq) (*pbecs.CreateEcsMultipleResp, error) {
|
||||
var (
|
||||
ecs ecser.Ecser
|
||||
wg sync.WaitGroup
|
||||
requestIds = make([]string, 0)
|
||||
)
|
||||
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")
|
||||
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
|
||||
}
|
||||
break
|
||||
}
|
||||
c <- resp.GetRequestId()
|
||||
}()
|
||||
}
|
||||
return ecs.CreateEcs(ctx, req)
|
||||
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) {
|
||||
|
|
|
@ -4,20 +4,16 @@ import (
|
|||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/alibabacloud-go/tea/tea"
|
||||
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
|
||||
openapi "github.com/alibabacloud-go/darabonba-openapi/client"
|
||||
|
||||
"github.com/golang/glog"
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
var aliClientMutex sync.Mutex
|
||||
|
@ -90,7 +86,6 @@ func (ecs *AliEcs) CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (*pbe
|
|||
InstanceChargeType: &InstanceChargeType,
|
||||
}
|
||||
// 创建并运行实例
|
||||
glog.Infof("CreateEcs req: %+v", req)
|
||||
resp, err := ecs.cli.RunInstances(request)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Ali Create ECS error")
|
||||
|
@ -100,6 +95,8 @@ func (ecs *AliEcs) CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (*pbe
|
|||
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 := ""
|
||||
|
@ -117,7 +114,7 @@ func (ecs *AliEcs) CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (*pbe
|
|||
return &pbecs.CreateEcsResp{
|
||||
OrderId: OrderId,
|
||||
TradePrice: TradePrice,
|
||||
RequestId: requestId,
|
||||
RequestId: "Ali ECS RequestId: " + requestId,
|
||||
InstanceIdSets: InstanceIds,
|
||||
Finished: isFinished,
|
||||
}, nil
|
||||
|
|
|
@ -4,17 +4,10 @@ import (
|
|||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/golang/glog"
|
||||
|
||||
string_ "github.com/alibabacloud-go/darabonba-string/client"
|
||||
|
||||
util "github.com/alibabacloud-go/tea-utils/service"
|
||||
"github.com/alibabacloud-go/tea/tea"
|
||||
|
||||
"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/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"
|
||||
|
@ -23,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 {
|
||||
|
@ -133,7 +129,7 @@ func (ecs *HuaweiEcs) CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (*
|
|||
}
|
||||
return &pbecs.CreateEcsResp{
|
||||
OrderId: OrderId,
|
||||
RequestId: *resp.JobId,
|
||||
RequestId: "Huawei ECS RequestId: " + *resp.JobId,
|
||||
InstanceIdSets: InstanceIds,
|
||||
Finished: isFinished,
|
||||
}, nil
|
||||
|
|
|
@ -4,21 +4,16 @@ import (
|
|||
"context"
|
||||
|
||||
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"
|
||||
|
||||
"gitlink.org.cn/JCCE/PCM/common/tenanter"
|
||||
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
|
||||
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
|
||||
cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
|
||||
"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 {
|
||||
|
@ -68,7 +63,6 @@ func (ecs *TencentCvm) CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (
|
|||
Zone: &ZoneId,
|
||||
}
|
||||
resp, err := ecs.cli.RunInstances(request)
|
||||
glog.Infof("CreateEcs req: %+v", req)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Tencent Create ECS error")
|
||||
}
|
||||
|
@ -80,8 +74,10 @@ func (ecs *TencentCvm) CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (
|
|||
if len(resp.Response.InstanceIdSet) > 0 {
|
||||
isFinished = true
|
||||
}
|
||||
glog.Infof("--------------------腾讯ECS实例创建成功--------------------")
|
||||
glog.Infof(*util.ToJSONString(util.ToMap(resp)))
|
||||
return &pbecs.CreateEcsResp{
|
||||
RequestId: *resp.Response.RequestId,
|
||||
RequestId: "Tencent ECS RequestId: " + *resp.Response.RequestId,
|
||||
InstanceIdSets: InstanceIds,
|
||||
Finished: isFinished,
|
||||
}, nil
|
||||
|
@ -100,9 +96,10 @@ func (ecs *TencentCvm) DeleteEcs(ctx context.Context, req *pbecs.DeleteEcsReq) (
|
|||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Tencent Delete ECS error")
|
||||
}
|
||||
glog.Infof("--------------------实例释放成功--------------------")
|
||||
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,
|
||||
|
@ -124,7 +121,7 @@ func (ecs *TencentCvm) UpdateEcs(ctx context.Context, req *pbecs.UpdateEcsReq) (
|
|||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Tencent Update ECS error")
|
||||
}
|
||||
glog.Infof("--------------------实例修改成功--------------------")
|
||||
glog.Infof("--------------------腾讯ECS实例修改成功--------------------")
|
||||
glog.Infof(*util.ToJSONString(util.ToMap(resp)))
|
||||
return &pbecs.UpdateEcsResp{
|
||||
RequestId: *resp.Response.RequestId,
|
||||
|
|
|
@ -11,6 +11,16 @@ 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)
|
||||
|
|
|
@ -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;
|
||||
|
@ -51,6 +52,19 @@ enum InternetChargeType {
|
|||
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;
|
||||
|
@ -92,6 +106,7 @@ message CreateEcsReq {
|
|||
string subnet_id =19;
|
||||
}
|
||||
|
||||
//系统磁盘
|
||||
message SystemDisk {
|
||||
//系统盘大小,单位为GiB。取值范围:20~500。该参数的取值必须大于或者等于max{20, ImageSize}。默认值:max{40, 参数ImageId对应的镜像大小}
|
||||
string size = 1;
|
||||
|
@ -107,6 +122,7 @@ message SystemDisk {
|
|||
string auto_snapshot_policy_id = 6;
|
||||
}
|
||||
|
||||
//创建ECS返回值
|
||||
message CreateEcsResp {
|
||||
// 云名称
|
||||
pbtenant.CloudProvider provider = 1;
|
||||
|
@ -126,6 +142,7 @@ message CreateEcsResp {
|
|||
bool finished = 8;
|
||||
}
|
||||
|
||||
//删除ECS入参
|
||||
message DeleteEcsReq {
|
||||
// 云类型
|
||||
pbtenant.CloudProvider provider = 1;
|
||||
|
@ -151,6 +168,7 @@ message DeleteEcsReq {
|
|||
string delete_volume = 9;
|
||||
}
|
||||
|
||||
//删除ECS返回值
|
||||
message DeleteEcsResp {
|
||||
// 云名称
|
||||
pbtenant.CloudProvider provider = 1;
|
||||
|
@ -162,6 +180,7 @@ message DeleteEcsResp {
|
|||
string request_id = 4;
|
||||
}
|
||||
|
||||
//更新ECS入参
|
||||
message UpdateEcsReq {
|
||||
// 云类型
|
||||
pbtenant.CloudProvider provider = 1;
|
||||
|
@ -183,6 +202,7 @@ message UpdateEcsReq {
|
|||
string security_group_ids = 9;
|
||||
}
|
||||
|
||||
//更新ECS返回值
|
||||
message UpdateEcsResp {
|
||||
// 云名称
|
||||
pbtenant.CloudProvider provider = 1;
|
||||
|
@ -194,6 +214,7 @@ message UpdateEcsResp {
|
|||
string request_id = 4;
|
||||
}
|
||||
|
||||
//查询ECS入参
|
||||
message ListDetailReq {
|
||||
// 云名称
|
||||
pbtenant.CloudProvider provider = 1;
|
||||
|
@ -209,6 +230,7 @@ message ListDetailReq {
|
|||
string next_token = 6;
|
||||
}
|
||||
|
||||
//查询ECS返回值
|
||||
message ListDetailResp {
|
||||
// Ecs 机器集合
|
||||
repeated EcsInstance ecses = 1;
|
||||
|
@ -244,6 +266,14 @@ 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) = {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,6 +31,40 @@ var _ = runtime.String
|
|||
var _ = utilities.NewDoubleArray
|
||||
var _ = metadata.Join
|
||||
|
||||
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)
|
||||
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.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
|
||||
|
@ -229,6 +263,29 @@ 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_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)
|
||||
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_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()
|
||||
|
@ -408,6 +465,26 @@ 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_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)
|
||||
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_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()
|
||||
|
@ -532,6 +609,8 @@ 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"}, ""))
|
||||
|
@ -546,6 +625,8 @@ var (
|
|||
)
|
||||
|
||||
var (
|
||||
forward_EcsService_CreateMultipleEcs_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_EcsService_CreateEcs_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_EcsService_DeleteEcs_0 = runtime.ForwardResponseMessage
|
||||
|
|
|
@ -22,6 +22,8 @@ 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
|
||||
|
@ -44,6 +46,15 @@ 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...)
|
||||
|
@ -102,6 +113,8 @@ 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
|
||||
|
@ -121,6 +134,9 @@ 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")
|
||||
}
|
||||
|
@ -152,6 +168,24 @@ 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 {
|
||||
|
@ -267,6 +301,10 @@ 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,
|
||||
|
|
|
@ -111,6 +111,39 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"/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",
|
||||
|
@ -256,6 +289,35 @@
|
|||
}
|
||||
},
|
||||
"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": {
|
||||
|
@ -338,7 +400,8 @@
|
|||
"type": "string",
|
||||
"title": "待创建云服务器所在的子网信息。需要指定vpcid对应VPC下已创建的子网(subnet)的网络ID,UUID格式。华为云必需"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "创建ECS入参"
|
||||
},
|
||||
"pbecsCreateEcsResp": {
|
||||
"type": "object",
|
||||
|
@ -380,7 +443,8 @@
|
|||
"type": "boolean",
|
||||
"title": "查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "创建ECS返回值"
|
||||
},
|
||||
"pbecsDeleteEcsReq": {
|
||||
"type": "object",
|
||||
|
@ -422,7 +486,8 @@
|
|||
"type": "string",
|
||||
"title": "配置删除云服务器是否删除云服务器对应的数据盘,如果选择不删除,则系统仅做卸载操作,保留云硬盘资源。默认为false。\n取值为true或false。默认false;华为云"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "删除ECS入参"
|
||||
},
|
||||
"pbecsDeleteEcsResp": {
|
||||
"type": "object",
|
||||
|
@ -444,7 +509,8 @@
|
|||
"type": "string",
|
||||
"title": "请求ID"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "删除ECS返回值"
|
||||
},
|
||||
"pbecsEcsInstance": {
|
||||
"type": "object",
|
||||
|
@ -525,7 +591,8 @@
|
|||
"type": "string",
|
||||
"title": "收费类型"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "ECS 实例"
|
||||
},
|
||||
"pbecsInternetChargeType": {
|
||||
"type": "string",
|
||||
|
@ -569,7 +636,8 @@
|
|||
"type": "string",
|
||||
"title": "请求id,出现问题后提供给云厂商,排查问题"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "查询ECS返回值"
|
||||
},
|
||||
"pbecsListResp": {
|
||||
"type": "object",
|
||||
|
@ -610,7 +678,8 @@
|
|||
"type": "string",
|
||||
"title": "系统盘采用的自动快照策略ID。"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "系统磁盘"
|
||||
},
|
||||
"pbecsUpdateEcsReq": {
|
||||
"type": "object",
|
||||
|
@ -652,7 +721,8 @@
|
|||
"type": "string",
|
||||
"title": "实例重新加入的安全组列表,安全组ID不能重复。以”,“分割"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "更新ECS入参"
|
||||
},
|
||||
"pbecsUpdateEcsResp": {
|
||||
"type": "object",
|
||||
|
@ -674,7 +744,8 @@
|
|||
"type": "string",
|
||||
"title": "请求ID"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "更新ECS返回值"
|
||||
},
|
||||
"pbtenantCloudProvider": {
|
||||
"type": "string",
|
||||
|
|
Loading…
Reference in New Issue