approved
This commit is contained in:
commit
8d69b5ab09
|
@ -126,7 +126,7 @@ func (cci *HuaweiCci) CreatePod(ctx context.Context, req *pbpod.CreatePodReq) (*
|
|||
Status: corev1.PodStatus{},
|
||||
}
|
||||
|
||||
resp, err := cci.cli.CoreV1().Pods(req.Namespace).Create(&pod)
|
||||
resp, err := cci.cli.CoreV1().Pods(req.Namespace).Create(context.TODO(), &pod, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Huaweiyun CreatePod error")
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ func (cci *HuaweiCci) CreatePod(ctx context.Context, req *pbpod.CreatePodReq) (*
|
|||
|
||||
func (cci *HuaweiCci) DeletePod(ctx context.Context, req *pbpod.DeletePodReq) (*pbpod.DeletePodResp, error) {
|
||||
|
||||
err := cci.cli.CoreV1().Pods(req.GetNamespace()).Delete(req.PodName, &metav1.DeleteOptions{})
|
||||
err := cci.cli.CoreV1().Pods(req.GetNamespace()).Delete(context.TODO(), req.PodName, metav1.DeleteOptions{})
|
||||
|
||||
isFinished := true
|
||||
if err != nil {
|
||||
|
@ -169,7 +169,7 @@ func (cci *HuaweiCci) DeletePod(ctx context.Context, req *pbpod.DeletePodReq) (*
|
|||
|
||||
func (cci *HuaweiCci) UpdatePod(ctx context.Context, req *pbpod.UpdatePodReq) (*pbpod.UpdatePodResp, error) {
|
||||
|
||||
qresp, err := cci.cli.CoreV1().Pods(req.GetNamespace()).Get(req.PodName, metav1.GetOptions{})
|
||||
qresp, err := cci.cli.CoreV1().Pods(req.GetNamespace()).Get(context.TODO(), req.PodName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Huaweiyun UpdatePod error")
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ func (cci *HuaweiCci) UpdatePod(ctx context.Context, req *pbpod.UpdatePodReq) (*
|
|||
Status: qresp.Status,
|
||||
}
|
||||
pod.Spec.Containers[0].Image = req.ContainerImage
|
||||
resp, err := cci.cli.CoreV1().Pods(req.Namespace).Update(&pod)
|
||||
resp, err := cci.cli.CoreV1().Pods(req.Namespace).Update(context.TODO(), &pod, metav1.UpdateOptions{})
|
||||
glog.Info("Huawei update pod resp", resp)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Huaweiyun UpdatePod error")
|
||||
|
@ -207,7 +207,7 @@ func (cci *HuaweiCci) UpdatePod(ctx context.Context, req *pbpod.UpdatePodReq) (*
|
|||
|
||||
func (cci *HuaweiCci) ListPodDetail(ctx context.Context, req *pbpod.ListPodDetailReq) (*pbpod.ListPodDetailResp, error) {
|
||||
|
||||
resp, err := cci.cli.CoreV1().Pods(req.GetNamespace()).List(metav1.ListOptions{})
|
||||
resp, err := cci.cli.CoreV1().Pods(req.GetNamespace()).List(context.TODO(), metav1.ListOptions{})
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Huaweiyun ListDetail pod error")
|
||||
|
|
|
@ -112,7 +112,7 @@ func (k *K8SPoder) CreatePod(ctx context.Context, req *pbpod.CreatePodReq) (*pbp
|
|||
Status: corev1.PodStatus{},
|
||||
}
|
||||
|
||||
resp, err := k.cli.CoreV1().Pods(req.Namespace).Create(&pod)
|
||||
resp, err := k.cli.CoreV1().Pods(req.Namespace).Create(context.TODO(), &pod, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "K8S CreatePod error")
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ func (k K8SPoder) DeletePod(ctx context.Context, req *pbpod.DeletePodReq) (*pbpo
|
|||
|
||||
podName := req.PodName
|
||||
fmt.Println("K8S ContainerGroup:", podName, " Deleted")
|
||||
err := k.cli.CoreV1().Pods(req.Namespace).Delete(podName, &metav1.DeleteOptions{})
|
||||
err := k.cli.CoreV1().Pods(req.Namespace).Delete(context.TODO(), podName, metav1.DeleteOptions{})
|
||||
|
||||
glog.Infof("--------------------K8S Pod Instance deleted--------------------")
|
||||
|
||||
|
@ -157,7 +157,7 @@ func (k K8SPoder) DeletePod(ctx context.Context, req *pbpod.DeletePodReq) (*pbpo
|
|||
|
||||
func (k K8SPoder) UpdatePod(ctx context.Context, req *pbpod.UpdatePodReq) (*pbpod.UpdatePodResp, error) {
|
||||
|
||||
qresp, err := k.cli.CoreV1().Pods(req.GetNamespace()).Get(req.PodName, metav1.GetOptions{})
|
||||
qresp, err := k.cli.CoreV1().Pods(req.GetNamespace()).Get(context.TODO(), req.PodName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "K8S UpdatePod error")
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ func (k K8SPoder) UpdatePod(ctx context.Context, req *pbpod.UpdatePodReq) (*pbpo
|
|||
Status: qresp.Status,
|
||||
}
|
||||
pod.Spec.Containers[0].Image = req.ContainerImage
|
||||
resp, err := k.cli.CoreV1().Pods(req.Namespace).Update(&pod)
|
||||
resp, err := k.cli.CoreV1().Pods(req.Namespace).Update(context.TODO(), &pod, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "K8S UpdatePod error")
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ func (k K8SPoder) UpdatePod(ctx context.Context, req *pbpod.UpdatePodReq) (*pbpo
|
|||
}
|
||||
|
||||
func (k K8SPoder) ListPodDetail(ctx context.Context, req *pbpod.ListPodDetailReq) (*pbpod.ListPodDetailResp, error) {
|
||||
resp, err := k.cli.CoreV1().Pods(req.GetNamespace()).List(metav1.ListOptions{})
|
||||
resp, err := k.cli.CoreV1().Pods(req.GetNamespace()).List(context.TODO(), metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "K8S ListDetail pod error")
|
||||
}
|
||||
|
|
|
@ -212,7 +212,6 @@ func ListAll(ctx context.Context) (*pbecs.ListResp, error) {
|
|||
glog.Errorf("List error %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
mutex.Lock()
|
||||
ecses = append(ecses, resp.Ecses...)
|
||||
mutex.Unlock()
|
||||
|
@ -223,3 +222,23 @@ func ListAll(ctx context.Context) (*pbecs.ListResp, error) {
|
|||
|
||||
return &pbecs.ListResp{Ecses: ecses}, nil
|
||||
}
|
||||
|
||||
func ActionEcs(ctx context.Context, req *pbecs.ActionReq) (*pbecs.ActionResp, 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.ActionEcs(ctx, req)
|
||||
}
|
||||
|
|
|
@ -208,8 +208,8 @@ func (ecs *AliEcs) ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (*p
|
|||
RegionName: ecs.region.GetName(),
|
||||
PublicIps: publicIps,
|
||||
InstanceType: *v.InstanceType,
|
||||
Cpu: *v.Cpu,
|
||||
Memory: *v.Memory,
|
||||
Cpu: string(*v.Cpu),
|
||||
Memory: string(*v.Memory),
|
||||
Description: *v.Description,
|
||||
Status: *v.Status,
|
||||
CreationTime: *v.CreationTime,
|
||||
|
@ -234,3 +234,7 @@ func (ecs *AliEcs) ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (*p
|
|||
RequestId: *resp.Body.RequestId,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (ecs *AliEcs) ActionEcs(ctx context.Context, req *pbecs.ActionReq) (resp *pbecs.ActionResp, err error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ type Ecser interface {
|
|||
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详情
|
||||
ActionEcs(ctx context.Context, req *pbecs.ActionReq) (resp *pbecs.ActionResp, err error) //操作ecs
|
||||
}
|
||||
|
||||
func NewEcsClient(provider pbtenant.CloudProvider, region tenanter.Region, tenant tenanter.Tenanter) (ecser Ecser, err error) {
|
||||
|
@ -40,8 +41,8 @@ func NewEcsClient(provider pbtenant.CloudProvider, region tenanter.Region, tenan
|
|||
case pbtenant.CloudProvider_huawei:
|
||||
return newHuaweiEcsClient(region, tenant)
|
||||
//TODO aws
|
||||
//case pbtenant.CloudProvider_aws:
|
||||
// return newAwsEcsClient(region, tenant)
|
||||
case pbtenant.CloudProvider_harvester:
|
||||
return newHarvesterClient(tenant)
|
||||
}
|
||||
|
||||
err = errors.WithMessagef(ErrEcsListNotSupported, "cloud provider %v region %v", provider, region)
|
||||
|
|
|
@ -0,0 +1,571 @@
|
|||
package ecser
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/harvester/harvester/pkg/apis/harvesterhci.io/v1beta1"
|
||||
harvClient "github.com/harvester/harvester/pkg/generated/clientset/versioned"
|
||||
"github.com/longhorn/longhorn-manager/util"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"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"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
k8s "k8s.io/client-go/kubernetes"
|
||||
kubirtv1 "kubevirt.io/client-go/api/v1"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
prefix = "harvesterhci.io"
|
||||
vmAnnotationPVC = prefix + "/volumeClaimTemplates"
|
||||
vmAnnotationNetworkIps = "network.harvesterhci.io/ips"
|
||||
defaultCloudInitUserData = "#cloud-config\npackage_update: true\npackages:\n - qemu-guest-agent\nruncmd:\n - - systemctl\n - enable\n - '--now'\n - qemu-guest-agent\n"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Host string
|
||||
Token string
|
||||
Port int
|
||||
}
|
||||
|
||||
type HarVMer struct {
|
||||
k8sCli *k8s.Clientset
|
||||
harvCli *harvClient.Clientset
|
||||
region tenanter.Region
|
||||
tenanter tenanter.Tenanter
|
||||
}
|
||||
|
||||
func newHarvesterClient(tenant tenanter.Tenanter) (Ecser, error) {
|
||||
var (
|
||||
k8sclient *k8s.Clientset
|
||||
harvesterClient *harvClient.Clientset
|
||||
err error
|
||||
)
|
||||
switch t := tenant.(type) {
|
||||
case *tenanter.AccessKeyTenant:
|
||||
k8sclient, err = GetKubernetesClient(t.GetUrl(), t.GetToken())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
harvesterClient, err = GetHarvesterClient(t.GetUrl(), t.GetToken())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
default:
|
||||
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init harvester client error")
|
||||
}
|
||||
return &HarVMer{
|
||||
k8sCli: k8sclient,
|
||||
harvCli: harvesterClient,
|
||||
region: nil,
|
||||
tenanter: tenant,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *HarVMer) CreateEcs(ctx context.Context, req *pbecs.CreateEcsReq) (resp *pbecs.CreateEcsResp, err error) {
|
||||
var (
|
||||
vmTemplate *kubirtv1.VirtualMachineInstanceTemplateSpec
|
||||
vmImage *v1beta1.VirtualMachineImage
|
||||
)
|
||||
if req.ImageId != "" {
|
||||
vmImage, err = h.harvCli.HarvesterhciV1beta1().VirtualMachineImages(req.GetNamespace()).Get(context.TODO(), req.ImageId, k8smetav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "get vm image error")
|
||||
}
|
||||
} else {
|
||||
return nil, errors.Wrap(err, "Image ID given does not exist!")
|
||||
}
|
||||
storageClassName := vmImage.Status.StorageClassName
|
||||
vmNameBase := req.InstanceName
|
||||
|
||||
vmLabels := map[string]string{
|
||||
prefix + "/creator": "harvester",
|
||||
}
|
||||
vmiLabels := vmLabels
|
||||
_amount := req.Amount
|
||||
if _amount == 0 {
|
||||
return nil, fmt.Errorf("VM count provided is 0, no VM will be created")
|
||||
}
|
||||
|
||||
repAmount := 0
|
||||
InstanceIds := make([]string, 0)
|
||||
for i := 1; i <= int(_amount); i++ {
|
||||
var (
|
||||
vmName string
|
||||
secretRandomID string
|
||||
)
|
||||
randomID := util.RandomID()
|
||||
if _amount > 1 {
|
||||
vmName = vmNameBase + "-" + fmt.Sprint(i)
|
||||
secretRandomID = vmNameBase + "-" + randomID
|
||||
} else {
|
||||
vmName = vmNameBase
|
||||
secretRandomID = vmNameBase + "-" + randomID
|
||||
}
|
||||
|
||||
vmiLabels[prefix+"/vmName"] = vmName
|
||||
vmiLabels[prefix+"/vmNamePrefix"] = vmNameBase
|
||||
diskRandomID := util.RandomID()
|
||||
pvcName := vmName + "-disk-0-" + diskRandomID
|
||||
pvcAnnotation := "[{\"metadata\":{\"name\":\"" + pvcName + "\",\"annotations\":{\"harvesterhci.io/imageId\":\"" + req.GetNamespace() + "/" + req.GetImageId() + "\"}},\"spec\":{\"accessModes\":[\"ReadWriteMany\"],\"resources\":{\"requests\":{\"storage\":\"" + req.GetDiskSize() + "\"}},\"volumeMode\":\"Block\",\"storageClassName\":\"" + storageClassName + "\"}}]"
|
||||
|
||||
vmTemplate, err = buildVMTemplate(int(req.GetCpu()), req.GetMemory(), req.GetSshKey(), h.harvCli, pvcName, vmiLabels, vmNameBase, secretRandomID)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "")
|
||||
}
|
||||
vm := &kubirtv1.VirtualMachine{
|
||||
ObjectMeta: k8smetav1.ObjectMeta{
|
||||
Name: vmName,
|
||||
Namespace: req.GetNamespace(),
|
||||
Annotations: map[string]string{
|
||||
vmAnnotationPVC: pvcAnnotation,
|
||||
vmAnnotationNetworkIps: "[]",
|
||||
},
|
||||
Labels: vmLabels,
|
||||
},
|
||||
Spec: kubirtv1.VirtualMachineSpec{
|
||||
Running: NewTrue(),
|
||||
Template: vmTemplate,
|
||||
},
|
||||
}
|
||||
resp, err1 := h.harvCli.KubevirtV1().VirtualMachines(req.GetNamespace()).Create(context.TODO(), vm, k8smetav1.CreateOptions{})
|
||||
if err1 != nil {
|
||||
return nil, errors.Wrap(err, "VM create failed")
|
||||
}
|
||||
|
||||
var sshKey *v1beta1.KeyPair
|
||||
cloudInitSSHSection := ""
|
||||
if req.GetSshKey() != "" {
|
||||
sshArr := strings.Split(req.GetSshKey(), "/")
|
||||
if len(sshArr) != 2 {
|
||||
return nil, errors.New("sshKeyName should be in format namespace/name")
|
||||
}
|
||||
sshKey, err = h.harvCli.HarvesterhciV1beta1().KeyPairs(sshArr[0]).Get(context.TODO(), sshArr[1], k8smetav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error during getting keypair from Harvester")
|
||||
}
|
||||
cloudInitSSHSection = "\nssh_authorized_keys:\n - >-\n" + sshKey.Spec.PublicKey + "\n"
|
||||
logrus.Debugf("SSH Key Name %s given does exist!", req.GetSshKey())
|
||||
}
|
||||
if req.UserDataTemplate == "" {
|
||||
req.UserDataTemplate = defaultCloudInitUserData
|
||||
}
|
||||
// Create the secret for the VM
|
||||
if _, secreterr := createCloudInitDataFromSecret(h.k8sCli, vmName, resp.ObjectMeta.UID, secretRandomID, req.Namespace, req.UserDataTemplate+cloudInitSSHSection, req.NetworkDataTemplate); secreterr != nil {
|
||||
logrus.Errorf("Create secret failed, %s", secreterr)
|
||||
return nil, errors.Wrap(secreterr, "Create cloud init data from secret failed")
|
||||
}
|
||||
InstanceIds = append(InstanceIds, string(resp.UID))
|
||||
repAmount++
|
||||
}
|
||||
isFinished := false
|
||||
if int32(repAmount) == req.Amount {
|
||||
isFinished = true
|
||||
}
|
||||
return &pbecs.CreateEcsResp{
|
||||
Provider: pbtenant.CloudProvider_harvester,
|
||||
AccountName: h.tenanter.AccountName(),
|
||||
InstanceIdSets: InstanceIds,
|
||||
Finished: isFinished,
|
||||
}, nil
|
||||
}
|
||||
|
||||
//buildVMTemplate creates a *kubirtv1.VirtualMachineInstanceTemplateSpec from the CLI Flags and some computed values
|
||||
func buildVMTemplate(vCpu int, memory, sshKeyName string, c *harvClient.Clientset,
|
||||
pvcName string, vmiLabels map[string]string, vmName string, secretName string) (vmTemplate *kubirtv1.VirtualMachineInstanceTemplateSpec, err error) {
|
||||
vmTemplate = nil
|
||||
_memory := resource.MustParse(memory)
|
||||
if sshKeyName != "" {
|
||||
sshArr := strings.Split(sshKeyName, "/")
|
||||
if len(sshArr) != 2 {
|
||||
return nil, errors.New("sshKeyName should be in format namespace/name")
|
||||
}
|
||||
_, keyerr := c.HarvesterhciV1beta1().KeyPairs(sshArr[0]).Get(context.TODO(), sshArr[1], k8smetav1.GetOptions{})
|
||||
if keyerr != nil {
|
||||
return nil, errors.Wrap(keyerr, "error during getting keypair from Harvester")
|
||||
}
|
||||
logrus.Debugf("SSH Key Name %s given does exist!", sshKeyName)
|
||||
}
|
||||
logrus.Debug("CloudInit: ")
|
||||
vmTemplate = &kubirtv1.VirtualMachineInstanceTemplateSpec{
|
||||
ObjectMeta: k8smetav1.ObjectMeta{
|
||||
Annotations: vmiAnnotations(pvcName, sshKeyName),
|
||||
Labels: vmiLabels,
|
||||
},
|
||||
Spec: kubirtv1.VirtualMachineInstanceSpec{
|
||||
Hostname: vmName,
|
||||
Networks: []kubirtv1.Network{
|
||||
{
|
||||
Name: "default",
|
||||
NetworkSource: kubirtv1.NetworkSource{
|
||||
Multus: &kubirtv1.MultusNetwork{
|
||||
NetworkName: "default/service-network",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Volumes: []kubirtv1.Volume{
|
||||
{
|
||||
Name: "disk-0",
|
||||
VolumeSource: kubirtv1.VolumeSource{
|
||||
PersistentVolumeClaim: &kubirtv1.PersistentVolumeClaimVolumeSource{
|
||||
PersistentVolumeClaimVolumeSource: v1.PersistentVolumeClaimVolumeSource{
|
||||
ClaimName: pvcName,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "cloudinitdisk",
|
||||
VolumeSource: kubirtv1.VolumeSource{
|
||||
CloudInitNoCloud: &kubirtv1.CloudInitNoCloudSource{
|
||||
UserDataSecretRef: &v1.LocalObjectReference{Name: secretName},
|
||||
NetworkDataSecretRef: &v1.LocalObjectReference{Name: secretName},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Domain: kubirtv1.DomainSpec{
|
||||
CPU: &kubirtv1.CPU{
|
||||
Cores: uint32(vCpu),
|
||||
Sockets: uint32(1),
|
||||
Threads: uint32(1),
|
||||
},
|
||||
Memory: &kubirtv1.Memory{
|
||||
Guest: &_memory,
|
||||
},
|
||||
Devices: kubirtv1.Devices{
|
||||
Inputs: []kubirtv1.Input{
|
||||
{
|
||||
Bus: "usb",
|
||||
Type: "tablet",
|
||||
Name: "tablet",
|
||||
},
|
||||
},
|
||||
Interfaces: []kubirtv1.Interface{
|
||||
{
|
||||
Name: "default",
|
||||
Model: "virtio",
|
||||
InterfaceBindingMethod: kubirtv1.DefaultBridgeNetworkInterface().InterfaceBindingMethod,
|
||||
},
|
||||
},
|
||||
Disks: []kubirtv1.Disk{
|
||||
{
|
||||
BootOrder: PointerToUint(1),
|
||||
Name: "disk-0",
|
||||
DiskDevice: kubirtv1.DiskDevice{
|
||||
Disk: &kubirtv1.DiskTarget{
|
||||
Bus: "virtio",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "cloudinitdisk",
|
||||
DiskDevice: kubirtv1.DiskDevice{
|
||||
Disk: &kubirtv1.DiskTarget{
|
||||
Bus: "virtio",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Resources: kubirtv1.ResourceRequirements{
|
||||
Limits: v1.ResourceList{
|
||||
"cpu": resource.MustParse(strconv.Itoa(vCpu)),
|
||||
"memory": resource.MustParse(memory),
|
||||
},
|
||||
Requests: v1.ResourceList{
|
||||
"memory": resource.MustParse(memory),
|
||||
},
|
||||
},
|
||||
},
|
||||
Affinity: &v1.Affinity{
|
||||
PodAntiAffinity: &v1.PodAntiAffinity{
|
||||
PreferredDuringSchedulingIgnoredDuringExecution: []v1.WeightedPodAffinityTerm{
|
||||
{
|
||||
Weight: int32(1),
|
||||
PodAffinityTerm: v1.PodAffinityTerm{
|
||||
TopologyKey: "kubernetes.io/hostname",
|
||||
LabelSelector: &k8smetav1.LabelSelector{
|
||||
MatchLabels: map[string]string{
|
||||
prefix + "/vmNamePrefix": vmName,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// vmiAnnotations generates a map of strings to be injected as annotations from a PVC name and an SSK Keyname
|
||||
func vmiAnnotations(pvcName string, sshKeyName string) map[string]string {
|
||||
sshKey := "[]"
|
||||
if sshKeyName != "" {
|
||||
sshKey = "[\"" + sshKeyName + "\"]"
|
||||
}
|
||||
return map[string]string{
|
||||
prefix + "/diskNames": "[\"" + pvcName + "\"]",
|
||||
prefix + "/sshNames": sshKey,
|
||||
}
|
||||
}
|
||||
|
||||
//CreateCloudInitDataFromSecret creates a cloud-init configmap from a secret
|
||||
func createCloudInitDataFromSecret(c *k8s.Clientset, vmName string, uid types.UID, secretName, namespace, userData, networkData string) (secret *v1.Secret, err error) {
|
||||
toCreate := &v1.Secret{
|
||||
TypeMeta: k8smetav1.TypeMeta{
|
||||
Kind: "Secret",
|
||||
APIVersion: "v1",
|
||||
},
|
||||
ObjectMeta: k8smetav1.ObjectMeta{
|
||||
Name: secretName,
|
||||
Namespace: namespace,
|
||||
Labels: map[string]string{
|
||||
prefix + "/cloud-init-template": "harvester",
|
||||
},
|
||||
OwnerReferences: []k8smetav1.OwnerReference{
|
||||
{
|
||||
APIVersion: "kubevirt.io/v1",
|
||||
Kind: "VirtualMachine",
|
||||
Name: vmName,
|
||||
UID: uid,
|
||||
},
|
||||
},
|
||||
},
|
||||
Type: "secret",
|
||||
Data: map[string][]byte{
|
||||
"userdata": []byte(userData),
|
||||
"networkdata": []byte(networkData),
|
||||
},
|
||||
}
|
||||
resp, err := c.CoreV1().Secrets(namespace).Create(context.TODO(), toCreate, k8smetav1.CreateOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error during getting cloud-init secret")
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (h *HarVMer) DeleteEcs(ctx context.Context, req *pbecs.DeleteEcsReq) (resp *pbecs.DeleteEcsResp, err error) {
|
||||
if req.Namespace == "" {
|
||||
return nil, errors.New("namespace is required")
|
||||
}
|
||||
vm, err := h.harvCli.KubevirtV1().VirtualMachines(req.GetNamespace()).Get(context.TODO(), req.GetInstanceName(), k8smetav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "VM does not exist")
|
||||
}
|
||||
err = h.harvCli.KubevirtV1().VirtualMachines(req.GetNamespace()).Delete(context.TODO(), req.GetInstanceName(), k8smetav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
logrus.Errorf("delete vm error: %v", err)
|
||||
return nil, errors.Wrap(err, "VM could not be deleted successfully: %w")
|
||||
}
|
||||
//delete vm disk
|
||||
if req.DiskName != "" {
|
||||
for _, delName := range strings.Split(req.DiskName, ",") {
|
||||
for _, disk := range vm.Spec.Template.Spec.Volumes {
|
||||
if disk.Name == delName {
|
||||
ClaimName := disk.VolumeSource.PersistentVolumeClaim.ClaimName
|
||||
err1 := h.k8sCli.CoreV1().PersistentVolumeClaims(req.GetNamespace()).Delete(context.TODO(), ClaimName, k8smetav1.DeleteOptions{})
|
||||
if err1 != nil {
|
||||
logrus.Errorf("delete pvc failed,err:%v", err1)
|
||||
return nil, errors.Wrap(err, "VM disk not be deleted successfully")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return &pbecs.DeleteEcsResp{
|
||||
Provider: pbtenant.CloudProvider_harvester,
|
||||
AccountName: h.tenanter.AccountName(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *HarVMer) UpdateEcs(ctx context.Context, req *pbecs.UpdateEcsReq) (resp *pbecs.UpdateEcsResp, err error) {
|
||||
//查询删除的vm
|
||||
vm, err := h.harvCli.KubevirtV1().VirtualMachines(req.GetNamespace()).Get(context.TODO(), req.GetInstanceName(), k8smetav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "VM does not exist")
|
||||
}
|
||||
if req.Cpu != "" && req.Memory != "" {
|
||||
vm.Spec.Template.Spec.Domain.Resources = kubirtv1.ResourceRequirements{
|
||||
Limits: v1.ResourceList{
|
||||
"cpu": resource.MustParse(req.Cpu),
|
||||
"memory": resource.MustParse(req.Memory),
|
||||
},
|
||||
}
|
||||
}
|
||||
vm.ObjectMeta.Annotations["field.cattle.io/description"] = req.Description
|
||||
if req.Cpu != "" {
|
||||
j, err := strconv.ParseUint(req.Cpu, 10, 32)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "cpu is not a number")
|
||||
}
|
||||
vm.Spec.Template.Spec.Domain.CPU = &kubirtv1.CPU{
|
||||
Cores: uint32(j),
|
||||
Sockets: uint32(1),
|
||||
Threads: uint32(1),
|
||||
}
|
||||
}
|
||||
if req.Memory != "" {
|
||||
_memory := resource.MustParse(req.Memory)
|
||||
vm.Spec.Template.Spec.Domain.Memory = &kubirtv1.Memory{
|
||||
Guest: &_memory,
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Harvester client connection failed")
|
||||
}
|
||||
//update
|
||||
_, err = h.harvCli.KubevirtV1().VirtualMachines(req.GetNamespace()).Update(context.TODO(), vm, k8smetav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "VM update failed")
|
||||
}
|
||||
if req.IsRestart {
|
||||
//重启
|
||||
err = restartVmByName(h.harvCli, req.GetNamespace(), req.GetInstanceName())
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "VM restart failed")
|
||||
}
|
||||
}
|
||||
return &pbecs.UpdateEcsResp{
|
||||
Provider: pbtenant.CloudProvider_harvester,
|
||||
AccountName: h.tenanter.AccountName(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *HarVMer) ListDetail(ctx context.Context, req *pbecs.ListDetailReq) (resp *pbecs.ListDetailResp, err error) {
|
||||
vmList, err := h.harvCli.KubevirtV1().VirtualMachines(req.GetNamespace()).List(context.TODO(), k8smetav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "VM list failed")
|
||||
}
|
||||
vmiList, err := h.harvCli.KubevirtV1().VirtualMachineInstances(req.GetNamespace()).List(context.TODO(), k8smetav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "VMI list failed")
|
||||
}
|
||||
vmiMap := map[string]kubirtv1.VirtualMachineInstance{}
|
||||
for _, vmi := range vmiList.Items {
|
||||
vmiMap[vmi.Name] = vmi
|
||||
}
|
||||
var ecses = make([]*pbecs.EcsInstance, len(vmList.Items))
|
||||
for k, vm := range vmList.Items {
|
||||
running := *vm.Spec.Running
|
||||
var state string
|
||||
if running {
|
||||
state = "Running"
|
||||
} else {
|
||||
state = "Not Running"
|
||||
}
|
||||
IP := make([]string, 0)
|
||||
if vmiMap[vm.Name].Status.Interfaces == nil {
|
||||
IP = append(IP, "")
|
||||
} else {
|
||||
IP = append(IP, vmiMap[vm.Name].Status.Interfaces[0].IP)
|
||||
}
|
||||
ecses[k] = &pbecs.EcsInstance{
|
||||
Provider: pbtenant.CloudProvider_harvester,
|
||||
AccountName: h.tenanter.AccountName(),
|
||||
Status: state,
|
||||
InstanceName: vm.Name,
|
||||
Node: vmiMap[vm.Name].Status.NodeName,
|
||||
Cpu: vm.Spec.Template.Spec.Domain.Resources.Limits.Cpu().String(),
|
||||
Memory: vm.Spec.Template.Spec.Domain.Resources.Limits.Memory().String(),
|
||||
PublicIps: IP,
|
||||
CreationTime: vm.CreationTimestamp.String(),
|
||||
Description: vm.ObjectMeta.Annotations["field.cattle.io/description"],
|
||||
Namespace: vm.Namespace,
|
||||
}
|
||||
}
|
||||
isFinished := false
|
||||
if len(ecses) > 0 {
|
||||
isFinished = true
|
||||
}
|
||||
return &pbecs.ListDetailResp{
|
||||
Ecses: ecses,
|
||||
Finished: isFinished,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *HarVMer) ActionEcs(ctx context.Context, req *pbecs.ActionReq) (resp *pbecs.ActionResp, err error) {
|
||||
status := ""
|
||||
switch req.GetActionType() {
|
||||
case pbecs.ActionType_start:
|
||||
err := startVmByName(h.harvCli, req.GetNamespace(), req.GetVmName())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
status = "Running"
|
||||
case pbecs.ActionType_stop:
|
||||
err := stopVmByName(h.harvCli, req.GetNamespace(), req.GetVmName())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
status = "Off"
|
||||
case pbecs.ActionType_restart:
|
||||
err := restartVmByName(h.harvCli, req.GetNamespace(), req.GetVmName())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
status = "Running"
|
||||
}
|
||||
return &pbecs.ActionResp{
|
||||
Provider: pbtenant.CloudProvider_harvester,
|
||||
AccountName: h.tenanter.AccountName(),
|
||||
Status: status,
|
||||
}, nil
|
||||
}
|
||||
|
||||
//startVmByName starts a VM by first issuing a GET using the VM name, then updating the resulting VM object
|
||||
func startVmByName(c *harvClient.Clientset, namespace, vmName string) error {
|
||||
vm, err := c.KubevirtV1().VirtualMachines(namespace).Get(context.TODO(), vmName, k8smetav1.GetOptions{})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "VM not found")
|
||||
}
|
||||
*vm.Spec.Running = true
|
||||
_, err = c.KubevirtV1().VirtualMachines(namespace).Update(context.TODO(), vm, k8smetav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "VM start failed")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//stopVmByName will stop a VM by first finding it by its name and then call stopBMbyRef function
|
||||
func stopVmByName(c *harvClient.Clientset, namespace, vmName string) error {
|
||||
vm, err := c.KubevirtV1().VirtualMachines(namespace).Get(context.TODO(), vmName, k8smetav1.GetOptions{})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "VM not found")
|
||||
}
|
||||
*vm.Spec.Running = false
|
||||
_, err = c.KubevirtV1().VirtualMachines(namespace).Update(context.TODO(), vm, k8smetav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "VM stop failed")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//restartVMbyName will restart a VM by first finding it by its name and then call restartVMbyRef function
|
||||
func restartVmByName(c *harvClient.Clientset, namespace, vmName string) error {
|
||||
vm, err := c.KubevirtV1().VirtualMachines(namespace).Get(context.TODO(), vmName, k8smetav1.GetOptions{})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "VM not found")
|
||||
}
|
||||
err = stopVmByName(c, namespace, vm.Name)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "VM stop failed")
|
||||
}
|
||||
select {
|
||||
case <-time.Tick(1 * time.Second):
|
||||
return startVmByName(c, namespace, vm.Name)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,444 @@
|
|||
package ecser
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/x509"
|
||||
"encoding/json"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
harvclient "github.com/harvester/harvester/pkg/generated/clientset/versioned"
|
||||
"io/ioutil"
|
||||
k8s "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/pkg/namesgenerator"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rancher/cli/cliclient"
|
||||
"github.com/rancher/cli/config"
|
||||
"github.com/rancher/norman/clientbase"
|
||||
ntypes "github.com/rancher/norman/types"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
regen "github.com/zach-klippenstein/goregen"
|
||||
k8sv1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
letters = "abcdefghijklmnopqrstuvwxyz0123456789"
|
||||
cfgFile = "cli2.json"
|
||||
)
|
||||
|
||||
var (
|
||||
// ManagementResourceTypes lists the types we use the management client for
|
||||
ManagementResourceTypes = []string{"cluster", "node", "project"}
|
||||
// ProjectResourceTypes lists the types we use the cluster client for
|
||||
ProjectResourceTypes = []string{"secret", "namespacedSecret", "workload"}
|
||||
// ClusterResourceTypes lists the types we use the project client for
|
||||
ClusterResourceTypes = []string{"persistentVolume", "storageClass", "namespace"}
|
||||
clientMutex = &sync.Mutex{}
|
||||
)
|
||||
|
||||
type MemberData struct {
|
||||
Name string
|
||||
MemberType string
|
||||
AccessType string
|
||||
}
|
||||
|
||||
type RoleTemplate struct {
|
||||
ID string
|
||||
Name string
|
||||
Description string
|
||||
}
|
||||
|
||||
type RoleTemplateBinding struct {
|
||||
ID string
|
||||
User string
|
||||
Role string
|
||||
Created string
|
||||
}
|
||||
|
||||
func loadAndVerifyCert(path string) (string, error) {
|
||||
caCert, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return verifyCert(caCert)
|
||||
}
|
||||
|
||||
func verifyCert(caCert []byte) (string, error) {
|
||||
// replace the escaped version of the line break
|
||||
caCert = bytes.Replace(caCert, []byte(`\n`), []byte("\n"), -1)
|
||||
|
||||
block, _ := pem.Decode(caCert)
|
||||
|
||||
if nil == block {
|
||||
return "", errors.New("No cert was found")
|
||||
}
|
||||
|
||||
parsedCert, err := x509.ParseCertificate(block.Bytes)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if !parsedCert.IsCA {
|
||||
return "", errors.New("CACerts is not valid")
|
||||
}
|
||||
return string(caCert), nil
|
||||
}
|
||||
|
||||
func loadConfig(ctx *cli.Context) (config.Config, error) {
|
||||
// path will always be set by the global flag default
|
||||
path := ctx.GlobalString("config")
|
||||
path = filepath.Join(path, cfgFile)
|
||||
|
||||
cf := config.Config{
|
||||
Path: path,
|
||||
Servers: make(map[string]*config.ServerConfig),
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile(path)
|
||||
if os.IsNotExist(err) {
|
||||
return cf, nil
|
||||
} else if err != nil {
|
||||
return cf, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(content, &cf)
|
||||
cf.Path = path
|
||||
|
||||
return cf, err
|
||||
}
|
||||
|
||||
func lookupConfig(ctx *cli.Context) (*config.ServerConfig, error) {
|
||||
cf, err := loadConfig(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cs := cf.FocusedServer()
|
||||
if cs == nil {
|
||||
return nil, errors.New("no configuration found, run `login`")
|
||||
}
|
||||
|
||||
return cs, nil
|
||||
}
|
||||
|
||||
func GetClient(ctx *cli.Context) (*cliclient.MasterClient, error) {
|
||||
cf, err := lookupConfig(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
mc, err := cliclient.NewMasterClient(cf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return mc, nil
|
||||
}
|
||||
|
||||
// GetResourceType maps an incoming resource type to a valid one from the schema
|
||||
func GetResourceType(c *cliclient.MasterClient, resource string) (string, error) {
|
||||
if c.ManagementClient != nil {
|
||||
for key := range c.ManagementClient.APIBaseClient.Types {
|
||||
if strings.EqualFold(key, resource) {
|
||||
return key, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
if c.ProjectClient != nil {
|
||||
for key := range c.ProjectClient.APIBaseClient.Types {
|
||||
if strings.EqualFold(key, resource) {
|
||||
return key, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
if c.ClusterClient != nil {
|
||||
for key := range c.ClusterClient.APIBaseClient.Types {
|
||||
if strings.EqualFold(key, resource) {
|
||||
return key, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("unknown resource type: %s", resource)
|
||||
}
|
||||
|
||||
func Lookup(c *cliclient.MasterClient, name string, types ...string) (*ntypes.Resource, error) {
|
||||
var byName *ntypes.Resource
|
||||
|
||||
for _, schemaType := range types {
|
||||
rt, err := GetResourceType(c, schemaType)
|
||||
if err != nil {
|
||||
logrus.Debugf("Error GetResourceType: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
var schemaClient clientbase.APIBaseClientInterface
|
||||
// the schemaType dictates which client we need to use
|
||||
if c.ManagementClient != nil {
|
||||
if _, ok := c.ManagementClient.APIBaseClient.Types[rt]; ok {
|
||||
schemaClient = c.ManagementClient
|
||||
}
|
||||
}
|
||||
if c.ProjectClient != nil {
|
||||
if _, ok := c.ProjectClient.APIBaseClient.Types[rt]; ok {
|
||||
schemaClient = c.ProjectClient
|
||||
}
|
||||
}
|
||||
if c.ClusterClient != nil {
|
||||
if _, ok := c.ClusterClient.APIBaseClient.Types[rt]; ok {
|
||||
schemaClient = c.ClusterClient
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to get the resource by ID
|
||||
var resource ntypes.Resource
|
||||
|
||||
if err := schemaClient.ByID(schemaType, name, &resource); !clientbase.IsNotFound(err) && err != nil {
|
||||
logrus.Debugf("Error schemaClient.ByID: %v", err)
|
||||
return nil, err
|
||||
} else if err == nil && resource.ID == name {
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// Resource was not found assuming the ID, check if it's the name of a resource
|
||||
var collection ntypes.ResourceCollection
|
||||
|
||||
listOpts := &ntypes.ListOpts{
|
||||
Filters: map[string]interface{}{
|
||||
"name": name,
|
||||
"removed_null": 1,
|
||||
},
|
||||
}
|
||||
|
||||
if err := schemaClient.List(schemaType, listOpts, &collection); !clientbase.IsNotFound(err) && err != nil {
|
||||
logrus.Debugf("Error schemaClient.List: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(collection.Data) > 1 {
|
||||
ids := []string{}
|
||||
for _, data := range collection.Data {
|
||||
ids = append(ids, data.ID)
|
||||
}
|
||||
return nil, fmt.Errorf("multiple resources of type %s found for name %s: %v", schemaType, name, ids)
|
||||
}
|
||||
|
||||
// No matches for this schemaType, try the next one
|
||||
if len(collection.Data) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
if byName != nil {
|
||||
return nil, fmt.Errorf("multiple resources named %s: %s:%s, %s:%s", name, collection.Data[0].Type,
|
||||
collection.Data[0].ID, byName.Type, byName.ID)
|
||||
}
|
||||
|
||||
byName = &collection.Data[0]
|
||||
|
||||
}
|
||||
|
||||
if byName == nil {
|
||||
return nil, fmt.Errorf("not found: %s", name)
|
||||
}
|
||||
|
||||
return byName, nil
|
||||
}
|
||||
|
||||
func RandomName() string {
|
||||
return strings.Replace(namesgenerator.GetRandomName(0), "_", "-", -1)
|
||||
}
|
||||
|
||||
// RandomLetters returns a string with random letters of length n
|
||||
func RandomLetters(n int) string {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
b := make([]byte, n)
|
||||
for i := range b {
|
||||
b[i] = letters[rand.Intn(len(letters))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func appendTabDelim(buf *bytes.Buffer, value string) {
|
||||
if buf.Len() == 0 {
|
||||
buf.WriteString(value)
|
||||
} else {
|
||||
buf.WriteString("\t")
|
||||
buf.WriteString(value)
|
||||
}
|
||||
}
|
||||
|
||||
func SimpleFormat(values [][]string) (string, string) {
|
||||
headerBuffer := bytes.Buffer{}
|
||||
valueBuffer := bytes.Buffer{}
|
||||
for _, v := range values {
|
||||
appendTabDelim(&headerBuffer, v[0])
|
||||
if strings.Contains(v[1], "{{") {
|
||||
appendTabDelim(&valueBuffer, v[1])
|
||||
} else {
|
||||
appendTabDelim(&valueBuffer, "{{."+v[1]+"}}")
|
||||
}
|
||||
}
|
||||
|
||||
headerBuffer.WriteString("\n")
|
||||
valueBuffer.WriteString("\n")
|
||||
|
||||
return headerBuffer.String(), valueBuffer.String()
|
||||
}
|
||||
|
||||
func defaultAction(fn func(ctx *cli.Context) error) func(ctx *cli.Context) error {
|
||||
return func(ctx *cli.Context) error {
|
||||
if ctx.Bool("help") {
|
||||
err := cli.ShowAppHelp(ctx)
|
||||
if err != nil {
|
||||
logrus.Info("Issue encountered during executing help command")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return fn(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
func SplitOnColon(s string) []string {
|
||||
return strings.Split(s, ":")
|
||||
}
|
||||
|
||||
func parseClusterAndProjectID(id string) (string, string, error) {
|
||||
// Validate id
|
||||
// Examples:
|
||||
// c-qmpbm:p-mm62v
|
||||
// c-qmpbm:project-mm62v
|
||||
// See https://github.com/rancher/rancher/issues/14400
|
||||
if match, _ := regexp.MatchString("((local)|(c-[[:alnum:]]{5})):(p|project)-[[:alnum:]]{5}", id); match {
|
||||
parts := SplitOnColon(id)
|
||||
return parts[0], parts[1], nil
|
||||
}
|
||||
return "", "", fmt.Errorf("unable to extract clusterid and projectid from [%s]", id)
|
||||
}
|
||||
|
||||
// getClusterNames maps cluster ID to name and defaults to ID if name is blank
|
||||
func getClusterNames(ctx *cli.Context, c *cliclient.MasterClient) (map[string]string, error) {
|
||||
clusterNames := make(map[string]string)
|
||||
clusterCollection, err := c.ManagementClient.Cluster.List(defaultListOpts(ctx))
|
||||
if err != nil {
|
||||
return clusterNames, err
|
||||
}
|
||||
|
||||
for _, cluster := range clusterCollection.Data {
|
||||
if cluster.Name == "" {
|
||||
clusterNames[cluster.ID] = cluster.ID
|
||||
} else {
|
||||
clusterNames[cluster.ID] = cluster.Name
|
||||
}
|
||||
}
|
||||
return clusterNames, nil
|
||||
}
|
||||
|
||||
func baseListOpts() *ntypes.ListOpts {
|
||||
return &ntypes.ListOpts{
|
||||
Filters: map[string]interface{}{
|
||||
"limit": -1,
|
||||
"all": true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func defaultListOpts(ctx *cli.Context) *ntypes.ListOpts {
|
||||
listOpts := baseListOpts()
|
||||
if ctx != nil && !ctx.Bool("all") {
|
||||
listOpts.Filters["removed_null"] = "1"
|
||||
listOpts.Filters["state_ne"] = []string{
|
||||
"inactive",
|
||||
"stopped",
|
||||
"removing",
|
||||
}
|
||||
delete(listOpts.Filters, "all")
|
||||
}
|
||||
if ctx != nil && ctx.Bool("system") {
|
||||
delete(listOpts.Filters, "system")
|
||||
} else {
|
||||
listOpts.Filters["system"] = "false"
|
||||
}
|
||||
return listOpts
|
||||
}
|
||||
|
||||
//NewTrue returns a pointer to true
|
||||
func NewTrue() *bool {
|
||||
b := true
|
||||
return &b
|
||||
}
|
||||
|
||||
// RandomID returns a random string used as an ID internally in Harvester.
|
||||
func RandomID() string {
|
||||
res, err := regen.Generate("[a-z]{3}[0-9][a-z]")
|
||||
if err != nil {
|
||||
fmt.Println("Random function was not successful!")
|
||||
return ""
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// GetHarvesterClient creates a Client for Harvester from Config input
|
||||
func GetHarvesterClient(host string, token string) (*harvclient.Clientset, error) {
|
||||
clientConfig := &rest.Config{
|
||||
Host: host,
|
||||
BearerToken: token,
|
||||
TLSClientConfig: rest.TLSClientConfig{
|
||||
Insecure: true,
|
||||
},
|
||||
}
|
||||
clientConfig.Host = host
|
||||
clientMutex.Lock()
|
||||
forConfig, err := harvclient.NewForConfig(clientConfig)
|
||||
clientMutex.Unlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return forConfig, nil
|
||||
}
|
||||
|
||||
// GetKubernetesClient creates a Client for Kubernetes from Config input
|
||||
func GetKubernetesClient(host string, token string) (*k8s.Clientset, error) {
|
||||
clientConfig := &rest.Config{
|
||||
Host: fmt.Sprintf("%s:%d", host, 6443),
|
||||
BearerToken: token,
|
||||
TLSClientConfig: rest.TLSClientConfig{
|
||||
Insecure: true,
|
||||
},
|
||||
}
|
||||
|
||||
clientConfig.Host = host
|
||||
clientMutex.Lock()
|
||||
k8sCli, err := k8s.NewForConfig(clientConfig)
|
||||
clientMutex.Unlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return k8sCli, nil
|
||||
}
|
||||
|
||||
func MustPVCTemplatesToString(pvcs []k8sv1.PersistentVolumeClaim) string {
|
||||
result, err := PVCTemplatesToString(pvcs)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func PVCTemplatesToString(pvcs []k8sv1.PersistentVolumeClaim) (string, error) {
|
||||
b, err := json.Marshal(pvcs)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(b), nil
|
||||
}
|
||||
|
||||
func PointerToUint(i uint) *uint {
|
||||
return &i
|
||||
}
|
|
@ -237,8 +237,8 @@ func (ecs *HuaweiEcs) ListDetail(ctx context.Context, req *pbecs.ListDetailReq)
|
|||
InstanceType: v.Flavor.Name,
|
||||
PublicIps: PublicIps,
|
||||
InnerIps: InnerIps,
|
||||
Cpu: int32(vCpu),
|
||||
Memory: int32(vMemory),
|
||||
Cpu: strconv.FormatInt(vCpu, 10),
|
||||
Memory: strconv.FormatInt(vMemory, 10),
|
||||
Description: *v.Description,
|
||||
Status: v.Status,
|
||||
CreationTime: v.Created,
|
||||
|
@ -261,3 +261,7 @@ func (ecs *HuaweiEcs) ListDetail(ctx context.Context, req *pbecs.ListDetailReq)
|
|||
RequestId: "",
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (ecs *HuaweiEcs) ActionEcs(ctx context.Context, req *pbecs.ActionReq) (resp *pbecs.ActionResp, err error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package ecser
|
|||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
string_ "github.com/alibabacloud-go/darabonba-string/client"
|
||||
util "github.com/alibabacloud-go/tea-utils/service"
|
||||
|
@ -151,8 +152,8 @@ func (ecs *TencentCvm) ListDetail(ctx context.Context, req *pbecs.ListDetailReq)
|
|||
RegionName: ecs.region.GetName(),
|
||||
PublicIps: make([]string, len(v.PublicIpAddresses)),
|
||||
InstanceType: *v.InstanceType,
|
||||
Cpu: int32(*v.CPU),
|
||||
Memory: int32(*v.Memory),
|
||||
Cpu: strconv.FormatInt(*v.CPU, 10),
|
||||
Memory: strconv.FormatInt(*v.Memory, 10),
|
||||
Description: "",
|
||||
Status: *v.InstanceState,
|
||||
CreationTime: *v.CreatedTime,
|
||||
|
@ -184,3 +185,7 @@ func (ecs *TencentCvm) ListDetail(ctx context.Context, req *pbecs.ListDetailReq)
|
|||
RequestId: *resp.Response.RequestId,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (ecs *TencentCvm) ActionEcs(ctx context.Context, req *pbecs.ActionReq) (resp *pbecs.ActionResp, err error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
@ -80,3 +80,13 @@ func (s *Server) ListEcsAll(ctx context.Context, req *pbecs.ListAllReq) (*pbecs.
|
|||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ActionEcs return ecs action
|
||||
func (s *Server) ActionEcs(ctx context.Context, req *pbecs.ActionReq) (*pbecs.ActionResp, error) {
|
||||
resp, err := ecs.ActionEcs(ctx, req)
|
||||
if err != nil {
|
||||
glog.Errorf("ActionEcs error %+v", err)
|
||||
return nil, status.Errorf(codes.Internal, err.Error())
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
|
139
go.mod
139
go.mod
|
@ -10,52 +10,157 @@ require (
|
|||
github.com/alibabacloud-go/tea-utils v1.3.9
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1530
|
||||
github.com/bitly/go-simplejson v0.5.0
|
||||
github.com/docker/docker v20.10.6+incompatible
|
||||
github.com/go-yaml/yaml v2.1.0+incompatible
|
||||
github.com/golang/glog v1.0.0
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.0
|
||||
github.com/harvester/harvester v1.0.0
|
||||
github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.0.82
|
||||
github.com/longhorn/longhorn-manager v1.2.3-rc2
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/rancher/cli v2.2.0+incompatible
|
||||
github.com/rancher/norman v0.0.0-20211201154850-abe17976423e
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.377
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.377
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.377
|
||||
github.com/urfave/cli v1.22.2
|
||||
github.com/zach-klippenstein/goregen v0.0.0-20160303162051-795b5e3961ea
|
||||
google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e
|
||||
google.golang.org/grpc v1.45.0
|
||||
google.golang.org/protobuf v1.28.0
|
||||
k8s.io/api v0.0.0-20190620084959-7cf5895f2711
|
||||
k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719
|
||||
k8s.io/client-go v0.0.0-20190620085101-78d2af792bab
|
||||
k8s.io/api v0.22.3
|
||||
k8s.io/apimachinery v0.22.3
|
||||
k8s.io/client-go v12.0.0+incompatible
|
||||
kubevirt.io/client-go v0.45.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/PuerkitoBio/purell v1.1.1 // indirect
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
||||
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/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/blang/semver v3.5.1+incompatible // indirect
|
||||
github.com/c9s/goprocinfo v0.0.0-20210130143923-c95fcf8c64a8 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.1 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415 // indirect
|
||||
github.com/emicklei/go-restful v2.10.0+incompatible // indirect
|
||||
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.1 // indirect
|
||||
github.com/ghodss/yaml v1.0.0 // indirect
|
||||
github.com/go-logr/logr v0.4.0 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.19.5 // indirect
|
||||
github.com/go-openapi/spec v0.20.3 // indirect
|
||||
github.com/go-openapi/swag v0.19.14 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/google/gofuzz v1.0.0 // indirect
|
||||
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d // indirect
|
||||
github.com/imdario/mergo v0.3.5 // indirect
|
||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
|
||||
github.com/json-iterator/go v1.1.10 // indirect
|
||||
github.com/google/go-cmp v0.5.7 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/gxui v0.0.0-20151028112939-f85e0a97b3a4 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/googleapis/gnostic v0.5.5 // indirect
|
||||
github.com/gorilla/handlers v1.4.2 // indirect
|
||||
github.com/gorilla/websocket v1.4.2 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/imdario/mergo v0.3.12 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.11 // indirect
|
||||
github.com/k8snetworkplumbingwg/network-attachment-definition-client v0.0.0-20200331171230-d50e42f2b669 // indirect
|
||||
github.com/kubernetes-csi/external-snapshotter/v2 v2.1.1 // indirect
|
||||
github.com/longhorn/go-iscsi-helper v0.0.0-20201111045018-ee87992ec536 // indirect
|
||||
github.com/mailru/easyjson v0.7.6 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
|
||||
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/openshift/custom-resource-status v0.0.0-20200602122900-c002fd1547ca // indirect
|
||||
github.com/pborman/uuid v1.2.0 // indirect
|
||||
github.com/prometheus/client_golang v1.11.0 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.32.0 // indirect
|
||||
github.com/prometheus/procfs v0.6.0 // indirect
|
||||
github.com/rancher/lasso v0.0.0-20210709145333-6c6cd7fd6607 // indirect
|
||||
github.com/rancher/system-upgrade-controller/pkg/apis v0.0.0-20210727200656-10b094e30007 // indirect
|
||||
github.com/rancher/types v0.0.0-20220328215343-4370ff10ecd5 // indirect
|
||||
github.com/rancher/wrangler v0.8.10 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.0.1 // indirect
|
||||
github.com/satori/go.uuid v1.2.0 // indirect
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/tjfoc/gmsm v1.3.2 // indirect
|
||||
golang.org/x/crypto v0.0.0-20210920023735-84f357641f63 // indirect
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
|
||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
|
||||
google.golang.org/appengine v1.6.6 // indirect
|
||||
gopkg.in/inf.v0 v0.9.0 // indirect
|
||||
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.66.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
k8s.io/klog v0.3.1 // indirect
|
||||
k8s.io/utils v0.0.0-20190221042446-c2654d5206da // indirect
|
||||
k8s.io/apiextensions-apiserver v0.22.3 // indirect
|
||||
k8s.io/component-base v0.21.4 // indirect
|
||||
k8s.io/klog/v2 v2.10.0 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 // indirect
|
||||
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a // indirect
|
||||
kubevirt.io/containerized-data-importer v1.36.0 // indirect
|
||||
kubevirt.io/controller-lifecycle-operator-sdk v0.2.0 // indirect
|
||||
sigs.k8s.io/cluster-api v0.4.4 // indirect
|
||||
sigs.k8s.io/controller-runtime v0.9.7 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
)
|
||||
|
||||
replace (
|
||||
github.com/dgrijalva/jwt-go => github.com/dgrijalva/jwt-go v3.2.1-0.20200107013213-dc14462fd587+incompatible
|
||||
github.com/docker/distribution => github.com/docker/distribution v0.0.0-20191216044856-a8371794149d
|
||||
github.com/docker/docker => github.com/docker/docker v1.4.2-0.20200203170920-46ec8731fbce
|
||||
github.com/go-kit/kit => github.com/go-kit/kit v0.3.0
|
||||
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.4.1
|
||||
github.com/knative/pkg => github.com/rancher/pkg v0.0.0-20190514055449-b30ab9de040e
|
||||
github.com/openshift/api => github.com/openshift/api v0.0.0-20191219222812-2987a591a72c
|
||||
github.com/openshift/client-go => github.com/openshift/client-go v0.0.0-20200521150516-05eb9880269c
|
||||
github.com/operator-framework/operator-lifecycle-manager => github.com/operator-framework/operator-lifecycle-manager v0.0.0-20190128024246-5eb7ae5bdb7a
|
||||
github.com/rancher/rancher/pkg/apis => github.com/rancher/rancher/pkg/apis v0.0.0-20211208233239-77392a65423d
|
||||
github.com/rancher/rancher/pkg/client => github.com/rancher/rancher/pkg/client v0.0.0-20211208233239-77392a65423d
|
||||
|
||||
helm.sh/helm/v3 => github.com/rancher/helm/v3 v3.5.4-rancher.1
|
||||
k8s.io/api => k8s.io/api v0.21.2
|
||||
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.21.2
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.21.2
|
||||
k8s.io/apiserver => k8s.io/apiserver v0.21.2
|
||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.21.2
|
||||
k8s.io/client-go => k8s.io/client-go v0.21.2
|
||||
k8s.io/cloud-provider => k8s.io/cloud-provider v0.21.2
|
||||
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.21.2
|
||||
k8s.io/code-generator => k8s.io/code-generator v0.21.2
|
||||
k8s.io/component-base => k8s.io/component-base v0.21.2
|
||||
k8s.io/component-helpers => k8s.io/component-helpers v0.21.2
|
||||
k8s.io/controller-manager => k8s.io/controller-manager v0.21.2
|
||||
k8s.io/cri-api => k8s.io/cri-api v0.21.2
|
||||
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.21.2
|
||||
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.21.2
|
||||
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.21.2
|
||||
k8s.io/kube-proxy => k8s.io/kube-proxy v0.21.2
|
||||
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.21.2
|
||||
k8s.io/kubectl => k8s.io/kubectl v0.21.2
|
||||
k8s.io/kubelet => k8s.io/kubelet v0.21.2
|
||||
k8s.io/kubernetes => k8s.io/kubernetes v1.21.2
|
||||
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.21.2
|
||||
k8s.io/metrics => k8s.io/metrics v0.21.2
|
||||
k8s.io/mount-utils => k8s.io/mount-utils v0.21.2
|
||||
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.21.2
|
||||
|
||||
kubevirt.io/client-go => github.com/kubevirt/client-go v0.45.0
|
||||
kubevirt.io/containerized-data-importer => github.com/rancher/kubevirt-containerized-data-importer v1.26.1-0.20210802100720-9bcf4e7ba0ce
|
||||
sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v0.4.4
|
||||
)
|
||||
|
|
|
@ -23,9 +23,9 @@ message EcsInstance {
|
|||
// 实例类型
|
||||
string instance_type = 7;
|
||||
// vcpu数
|
||||
int32 cpu = 8;
|
||||
string cpu = 8;
|
||||
// 内存MB
|
||||
int32 memory = 9;
|
||||
string memory = 9;
|
||||
// 实例描述
|
||||
string description = 10;
|
||||
// 状态
|
||||
|
@ -42,6 +42,11 @@ message EcsInstance {
|
|||
string resource_group_id = 16;
|
||||
// 收费类型
|
||||
string instance_charge_type = 17;
|
||||
// -----------harvester---------
|
||||
//虚拟机所在的节点
|
||||
string node = 18;
|
||||
//namespace
|
||||
string namespace =20;
|
||||
}
|
||||
|
||||
//网络计费类型
|
||||
|
@ -104,6 +109,45 @@ message CreateEcsReq {
|
|||
string vpc_id = 18;
|
||||
//待创建云服务器所在的子网信息。需要指定vpcid对应VPC下已创建的子网(subnet)的网络ID,UUID格式。华为云必需
|
||||
string subnet_id =19;
|
||||
//-------------harvester---------------
|
||||
//命名空间
|
||||
string namespace =20;
|
||||
//vCpu
|
||||
int32 cpu = 21;
|
||||
//memory
|
||||
string memory = 22;
|
||||
//ssh_key
|
||||
string ssh_key = 23;
|
||||
//diskName
|
||||
string disk_name = 24;
|
||||
//disk类型 disk,cd-rom
|
||||
string disk_type = 25;
|
||||
//卷大小
|
||||
string disk_size = 26;
|
||||
//bus 总线指示要模拟的磁盘设备的类型,支持virtio, sata, scsi.
|
||||
string bus = 27;
|
||||
//网络名称
|
||||
string network_name =28;
|
||||
//network_model 网络模式,支持e1000, e1000e, ne2k_pci, pcnet, rtl8139, virtio.
|
||||
string network_model=29;
|
||||
//网络
|
||||
string network =30;
|
||||
//网络连接方法,默认bridge
|
||||
string network_type =31;
|
||||
//osType //系统类型
|
||||
string os_type = 32;
|
||||
//machineType //机器类型 none、q35、pc
|
||||
string machine_type = 33;
|
||||
//machineName //主机名称,默认为虚拟机名称
|
||||
string machine_name =34;
|
||||
//userDataTemplate //用户数据模板
|
||||
string user_data_template = 35;
|
||||
//networkDataTemplate //网络数据模板
|
||||
string network_data_template = 36;
|
||||
//vmTemplateName //模板名称
|
||||
string vm_template_name =37;
|
||||
//vmTemplateVersion //版本号
|
||||
string vm_template_version = 38;
|
||||
}
|
||||
|
||||
//系统磁盘
|
||||
|
@ -166,6 +210,13 @@ message DeleteEcsReq {
|
|||
//配置删除云服务器是否删除云服务器对应的数据盘,如果选择不删除,则系统仅做卸载操作,保留云硬盘资源。默认为false。
|
||||
//取值为true或false。默认false;华为云
|
||||
string delete_volume = 9;
|
||||
//----------------harvester----------------
|
||||
//虚拟机名称
|
||||
string instance_name = 10;
|
||||
//namespace
|
||||
string namespace = 11;
|
||||
//diskName,以“,” 分割
|
||||
string disk_name = 12;
|
||||
}
|
||||
|
||||
//删除ECS返回值
|
||||
|
@ -200,6 +251,15 @@ message UpdateEcsReq {
|
|||
string description = 8;
|
||||
//实例重新加入的安全组列表,安全组ID不能重复。以”,“分割
|
||||
string security_group_ids = 9;
|
||||
//---------------harvester-----------------
|
||||
//namespace
|
||||
string namespace = 10;
|
||||
//cpu
|
||||
string cpu = 11;
|
||||
//memory
|
||||
string memory = 12;
|
||||
//修改配置后是否重启
|
||||
bool is_restart = 13;
|
||||
}
|
||||
|
||||
//更新ECS返回值
|
||||
|
@ -228,6 +288,9 @@ message ListDetailReq {
|
|||
int32 page_size = 5;
|
||||
// 分页相关参数,下一页的token
|
||||
string next_token = 6;
|
||||
//--------harvester---------
|
||||
//namespace
|
||||
string namespace = 7;
|
||||
}
|
||||
|
||||
//查询ECS返回值
|
||||
|
@ -246,6 +309,44 @@ message ListDetailResp {
|
|||
string request_id = 6;
|
||||
}
|
||||
|
||||
//虚拟机状态操作
|
||||
enum ActionType {
|
||||
//启动
|
||||
start = 0;
|
||||
//停止
|
||||
stop = 1;
|
||||
//重启
|
||||
restart = 2;
|
||||
}
|
||||
|
||||
message ActionReq {
|
||||
// 云名称
|
||||
pbtenant.CloudProvider provider = 1;
|
||||
// 账户名称,根据config.yaml中的配置,默认为第一个配置的账户
|
||||
string account_name = 2;
|
||||
// 区域Id,参考 tenant.proto 中的各个云的区域
|
||||
int32 region_id = 3;
|
||||
//命名空间
|
||||
string namespace = 4;
|
||||
//虚拟机名称
|
||||
string vm_name = 5 ;
|
||||
//虚拟机操作状态
|
||||
ActionType action_type = 6 ;
|
||||
}
|
||||
|
||||
message ActionResp {
|
||||
// 云名称
|
||||
pbtenant.CloudProvider provider = 1;
|
||||
// 账户名称,根据config.yaml中的配置,默认为第一个配置的账户
|
||||
string account_name = 2;
|
||||
// Ecs 机器集合
|
||||
repeated EcsInstance ecses = 3;
|
||||
// 查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询
|
||||
bool finished = 4;
|
||||
//vm状态
|
||||
string status = 5;
|
||||
}
|
||||
|
||||
message ListReq {
|
||||
// 云名称
|
||||
pbtenant.CloudProvider provider = 1;
|
||||
|
@ -318,4 +419,12 @@ service EcsService {
|
|||
get : "/apis/ecs/all"
|
||||
};
|
||||
}
|
||||
|
||||
//操作ecs(start-stop-restart)
|
||||
rpc ActionEcs(ActionReq) returns (ActionResp){
|
||||
option (google.api.http) = {
|
||||
post : "/apis/ecs/action"
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
}
|
|
@ -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
|
@ -257,6 +257,40 @@ func local_request_EcsService_ListEcsAll_0(ctx context.Context, marshaler runtim
|
|||
|
||||
}
|
||||
|
||||
func request_EcsService_ActionEcs_0(ctx context.Context, marshaler runtime.Marshaler, client EcsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ActionReq
|
||||
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.ActionEcs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_EcsService_ActionEcs_0(ctx context.Context, marshaler runtime.Marshaler, server EcsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ActionReq
|
||||
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.ActionEcs(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterEcsServiceHandlerServer registers the http handlers for service EcsService to "mux".
|
||||
// UnaryRPC :call EcsServiceServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
|
@ -269,13 +303,12 @@ func RegisterEcsServiceHandlerServer(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, "/pbecs.EcsService/CreateMultipleEcs", runtime.WithHTTPPathPattern("/apis/ecs/createMultiple"))
|
||||
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(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 {
|
||||
|
@ -293,13 +326,12 @@ func RegisterEcsServiceHandlerServer(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, "/pbecs.EcsService/CreateEcs", runtime.WithHTTPPathPattern("/apis/ecs/create"))
|
||||
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(ctx, inboundMarshaler, server, req, pathParams)
|
||||
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 {
|
||||
|
@ -317,13 +349,12 @@ func RegisterEcsServiceHandlerServer(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, "/pbecs.EcsService/DeleteEcs", runtime.WithHTTPPathPattern("/apis/ecs/delete"))
|
||||
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(ctx, inboundMarshaler, server, req, pathParams)
|
||||
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 {
|
||||
|
@ -341,13 +372,12 @@ func RegisterEcsServiceHandlerServer(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, "/pbecs.EcsService/UpdateEcs", runtime.WithHTTPPathPattern("/apis/ecs/update"))
|
||||
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(ctx, inboundMarshaler, server, req, pathParams)
|
||||
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 {
|
||||
|
@ -365,13 +395,12 @@ func RegisterEcsServiceHandlerServer(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, "/pbecs.EcsService/ListEcsDetail", runtime.WithHTTPPathPattern("/apis/ecs/detail"))
|
||||
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(ctx, inboundMarshaler, server, req, pathParams)
|
||||
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 {
|
||||
|
@ -389,13 +418,12 @@ func RegisterEcsServiceHandlerServer(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, "/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 {
|
||||
|
@ -413,13 +441,12 @@ func RegisterEcsServiceHandlerServer(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, "/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 {
|
||||
|
@ -431,6 +458,29 @@ func RegisterEcsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_EcsService_ActionEcs_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/ActionEcs")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_EcsService_ActionEcs_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_ActionEcs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -476,13 +526,12 @@ func RegisterEcsServiceHandlerClient(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, "/pbecs.EcsService/CreateMultipleEcs", runtime.WithHTTPPathPattern("/apis/ecs/createMultiple"))
|
||||
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(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)
|
||||
|
@ -497,13 +546,12 @@ func RegisterEcsServiceHandlerClient(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, "/pbecs.EcsService/CreateEcs", runtime.WithHTTPPathPattern("/apis/ecs/create"))
|
||||
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(ctx, inboundMarshaler, client, req, pathParams)
|
||||
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)
|
||||
|
@ -518,13 +566,12 @@ func RegisterEcsServiceHandlerClient(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, "/pbecs.EcsService/DeleteEcs", runtime.WithHTTPPathPattern("/apis/ecs/delete"))
|
||||
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(ctx, inboundMarshaler, client, req, pathParams)
|
||||
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)
|
||||
|
@ -539,13 +586,12 @@ func RegisterEcsServiceHandlerClient(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, "/pbecs.EcsService/UpdateEcs", runtime.WithHTTPPathPattern("/apis/ecs/update"))
|
||||
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(ctx, inboundMarshaler, client, req, pathParams)
|
||||
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)
|
||||
|
@ -560,13 +606,12 @@ func RegisterEcsServiceHandlerClient(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, "/pbecs.EcsService/ListEcsDetail", runtime.WithHTTPPathPattern("/apis/ecs/detail"))
|
||||
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(ctx, inboundMarshaler, client, req, pathParams)
|
||||
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)
|
||||
|
@ -581,13 +626,12 @@ func RegisterEcsServiceHandlerClient(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, "/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)
|
||||
|
@ -602,13 +646,12 @@ func RegisterEcsServiceHandlerClient(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, "/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)
|
||||
|
@ -619,6 +662,26 @@ func RegisterEcsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_EcsService_ActionEcs_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/ActionEcs")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_EcsService_ActionEcs_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_ActionEcs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -636,6 +699,8 @@ var (
|
|||
pattern_EcsService_ListEcs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"apis", "ecs"}, ""))
|
||||
|
||||
pattern_EcsService_ListEcsAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "ecs", "all"}, ""))
|
||||
|
||||
pattern_EcsService_ActionEcs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "ecs", "action"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -652,4 +717,6 @@ var (
|
|||
forward_EcsService_ListEcs_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_EcsService_ListEcsAll_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_EcsService_ActionEcs_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
|
|
@ -36,6 +36,8 @@ type EcsServiceClient interface {
|
|||
ListEcs(ctx context.Context, in *ListReq, opts ...grpc.CallOption) (*ListResp, error)
|
||||
// 查询所有云的ECS
|
||||
ListEcsAll(ctx context.Context, in *ListAllReq, opts ...grpc.CallOption) (*ListResp, error)
|
||||
//操作ecs(start-stop-restart)
|
||||
ActionEcs(ctx context.Context, in *ActionReq, opts ...grpc.CallOption) (*ActionResp, error)
|
||||
}
|
||||
|
||||
type ecsServiceClient struct {
|
||||
|
@ -109,6 +111,15 @@ func (c *ecsServiceClient) ListEcsAll(ctx context.Context, in *ListAllReq, opts
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *ecsServiceClient) ActionEcs(ctx context.Context, in *ActionReq, opts ...grpc.CallOption) (*ActionResp, error) {
|
||||
out := new(ActionResp)
|
||||
err := c.cc.Invoke(ctx, "/pbecs.EcsService/ActionEcs", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// EcsServiceServer is the server API for EcsService service.
|
||||
// All implementations must embed UnimplementedEcsServiceServer
|
||||
// for forward compatibility
|
||||
|
@ -127,6 +138,8 @@ type EcsServiceServer interface {
|
|||
ListEcs(context.Context, *ListReq) (*ListResp, error)
|
||||
// 查询所有云的ECS
|
||||
ListEcsAll(context.Context, *ListAllReq) (*ListResp, error)
|
||||
//操作ecs(start-stop-restart)
|
||||
ActionEcs(context.Context, *ActionReq) (*ActionResp, error)
|
||||
mustEmbedUnimplementedEcsServiceServer()
|
||||
}
|
||||
|
||||
|
@ -155,6 +168,9 @@ func (UnimplementedEcsServiceServer) ListEcs(context.Context, *ListReq) (*ListRe
|
|||
func (UnimplementedEcsServiceServer) ListEcsAll(context.Context, *ListAllReq) (*ListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListEcsAll not implemented")
|
||||
}
|
||||
func (UnimplementedEcsServiceServer) ActionEcs(context.Context, *ActionReq) (*ActionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ActionEcs not implemented")
|
||||
}
|
||||
func (UnimplementedEcsServiceServer) mustEmbedUnimplementedEcsServiceServer() {}
|
||||
|
||||
// UnsafeEcsServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
|
@ -294,6 +310,24 @@ func _EcsService_ListEcsAll_Handler(srv interface{}, ctx context.Context, dec fu
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _EcsService_ActionEcs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ActionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(EcsServiceServer).ActionEcs(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pbecs.EcsService/ActionEcs",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(EcsServiceServer).ActionEcs(ctx, req.(*ActionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// EcsService_ServiceDesc is the grpc.ServiceDesc for EcsService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
@ -329,6 +363,10 @@ var EcsService_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "ListEcsAll",
|
||||
Handler: _EcsService_ListEcsAll_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ActionEcs",
|
||||
Handler: _EcsService_ActionEcs_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "idl/pbecs/ecs.proto",
|
||||
|
|
|
@ -201,7 +201,7 @@ type CreatePodsReq struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// 云类型
|
||||
// 创建请求集合
|
||||
CreatePodReq []*CreatePodReq `protobuf:"bytes,1,rep,name=createPodReq,proto3" json:"createPodReq,omitempty"`
|
||||
}
|
||||
|
||||
|
@ -462,12 +462,14 @@ type CreatePodResp struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Pod集合
|
||||
Pods []*PodInstance `protobuf:"bytes,1,rep,name=pods,proto3" json:"pods,omitempty"`
|
||||
// 查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询
|
||||
Finished bool `protobuf:"varint,2,opt,name=finished,proto3" json:"finished,omitempty"`
|
||||
Finished bool `protobuf:"varint,1,opt,name=finished,proto3" json:"finished,omitempty"`
|
||||
// 请求id,出现问题后提供给云厂商,排查问题
|
||||
RequestId string `protobuf:"bytes,3,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||
RequestId string `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||
// podId
|
||||
PodId string `protobuf:"bytes,3,opt,name=pod_id,json=podId,proto3" json:"pod_id,omitempty"`
|
||||
// podName
|
||||
PodName string `protobuf:"bytes,4,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreatePodResp) Reset() {
|
||||
|
@ -502,13 +504,6 @@ func (*CreatePodResp) Descriptor() ([]byte, []int) {
|
|||
return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *CreatePodResp) GetPods() []*PodInstance {
|
||||
if x != nil {
|
||||
return x.Pods
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CreatePodResp) GetFinished() bool {
|
||||
if x != nil {
|
||||
return x.Finished
|
||||
|
@ -523,6 +518,20 @@ func (x *CreatePodResp) GetRequestId() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (x *CreatePodResp) GetPodId() string {
|
||||
if x != nil {
|
||||
return x.PodId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreatePodResp) GetPodName() string {
|
||||
if x != nil {
|
||||
return x.PodName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type DeletePodReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -621,12 +630,14 @@ type DeletePodResp struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Pod集合
|
||||
Pods []*PodInstance `protobuf:"bytes,1,rep,name=pods,proto3" json:"pods,omitempty"`
|
||||
// 查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询
|
||||
Finished bool `protobuf:"varint,2,opt,name=finished,proto3" json:"finished,omitempty"`
|
||||
Finished bool `protobuf:"varint,1,opt,name=finished,proto3" json:"finished,omitempty"`
|
||||
// 请求id,出现问题后提供给云厂商,排查问题
|
||||
RequestId string `protobuf:"bytes,3,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||
RequestId string `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||
// podId
|
||||
PodId string `protobuf:"bytes,3,opt,name=pod_id,json=podId,proto3" json:"pod_id,omitempty"`
|
||||
// podName
|
||||
PodName string `protobuf:"bytes,4,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeletePodResp) Reset() {
|
||||
|
@ -661,13 +672,6 @@ func (*DeletePodResp) Descriptor() ([]byte, []int) {
|
|||
return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *DeletePodResp) GetPods() []*PodInstance {
|
||||
if x != nil {
|
||||
return x.Pods
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DeletePodResp) GetFinished() bool {
|
||||
if x != nil {
|
||||
return x.Finished
|
||||
|
@ -682,6 +686,20 @@ func (x *DeletePodResp) GetRequestId() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (x *DeletePodResp) GetPodId() string {
|
||||
if x != nil {
|
||||
return x.PodId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DeletePodResp) GetPodName() string {
|
||||
if x != nil {
|
||||
return x.PodName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UpdatePodReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -834,12 +852,14 @@ type UpdatePodResp struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Pod集合
|
||||
Pod *PodInstance `protobuf:"bytes,1,opt,name=pod,proto3" json:"pod,omitempty"`
|
||||
// 查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询
|
||||
Finished bool `protobuf:"varint,2,opt,name=finished,proto3" json:"finished,omitempty"`
|
||||
Finished bool `protobuf:"varint,1,opt,name=finished,proto3" json:"finished,omitempty"`
|
||||
// 请求id,出现问题后提供给云厂商,排查问题
|
||||
RequestId string `protobuf:"bytes,3,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||
RequestId string `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||
// podId
|
||||
PodId string `protobuf:"bytes,3,opt,name=pod_id,json=podId,proto3" json:"pod_id,omitempty"`
|
||||
// podName
|
||||
PodName string `protobuf:"bytes,4,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UpdatePodResp) Reset() {
|
||||
|
@ -874,13 +894,6 @@ func (*UpdatePodResp) Descriptor() ([]byte, []int) {
|
|||
return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *UpdatePodResp) GetPod() *PodInstance {
|
||||
if x != nil {
|
||||
return x.Pod
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdatePodResp) GetFinished() bool {
|
||||
if x != nil {
|
||||
return x.Finished
|
||||
|
@ -895,6 +908,20 @@ func (x *UpdatePodResp) GetRequestId() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (x *UpdatePodResp) GetPodId() string {
|
||||
if x != nil {
|
||||
return x.PodId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UpdatePodResp) GetPodName() string {
|
||||
if x != nil {
|
||||
return x.PodName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ListPodDetailReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -1424,35 +1451,15 @@ var file_idl_pbpod_pod_proto_rawDesc = []byte{
|
|||
0x70, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x70, 0x63,
|
||||
0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18,
|
||||
0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,
|
||||
0x22, 0x72, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73,
|
||||
0x70, 0x12, 0x26, 0x0a, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||
0x12, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x50, 0x6f, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61,
|
||||
0x6e, 0x63, 0x65, 0x52, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6e,
|
||||
0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x69, 0x6e,
|
||||
0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x49, 0x64, 0x22, 0xd3, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50,
|
||||
0x6f, 0x64, 0x52, 0x65, 0x71, 0x12, 0x33, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65,
|
||||
0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61,
|
||||
0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72,
|
||||
0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x15, 0x0a,
|
||||
0x06, 0x70, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70,
|
||||
0x6f, 0x64, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12,
|
||||
0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1b, 0x0a,
|
||||
0x09, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x08, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x72, 0x0a, 0x0d, 0x44, 0x65,
|
||||
0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x04, 0x70,
|
||||
0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x70, 0x6f,
|
||||
0x64, 0x2e, 0x50, 0x6f, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x04, 0x70,
|
||||
0x6f, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12,
|
||||
0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x22, 0x9a,
|
||||
0x03, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x12,
|
||||
0x22, 0x7c, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73,
|
||||
0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x1d, 0x0a,
|
||||
0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06,
|
||||
0x70, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f,
|
||||
0x64, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xd3,
|
||||
0x01, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x12,
|
||||
0x33, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f,
|
||||
0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76,
|
||||
|
@ -1465,26 +1472,48 @@ var file_idl_pbpod_pod_proto_rawDesc = []byte{
|
|||
0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x67, 0x69, 0x6f,
|
||||
0x6e, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x67, 0x69,
|
||||
0x6f, 0x6e, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
|
||||
0x72, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63,
|
||||
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a,
|
||||
0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
||||
0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
|
||||
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x70, 0x75, 0x5f, 0x70, 0x6f, 0x64, 0x18,
|
||||
0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x70, 0x75, 0x50, 0x6f, 0x64, 0x12, 0x1d, 0x0a,
|
||||
0x0a, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x70, 0x6f, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x09, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x50, 0x6f, 0x64, 0x12, 0x25, 0x0a, 0x0e,
|
||||
0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x0b,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x50, 0x6f, 0x6c,
|
||||
0x69, 0x63, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x0c, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x22, 0x70, 0x0a, 0x0d, 0x55,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x03,
|
||||
0x70, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x70, 0x6f,
|
||||
0x64, 0x2e, 0x50, 0x6f, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x03, 0x70,
|
||||
0x6f, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x1d,
|
||||
0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x22, 0xba, 0x02,
|
||||
0x6f, 0x6e, 0x49, 0x64, 0x22, 0x7c, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f,
|
||||
0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65,
|
||||
0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64,
|
||||
0x12, 0x15, 0x0a, 0x06, 0x70, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x05, 0x70, 0x6f, 0x64, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61,
|
||||
0x6d, 0x65, 0x22, 0x9a, 0x03, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64,
|
||||
0x52, 0x65, 0x71, 0x12, 0x33, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74,
|
||||
0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x08,
|
||||
0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
|
||||
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x70,
|
||||
0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f, 0x64,
|
||||
0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a,
|
||||
0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x72,
|
||||
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
|
||||
0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x74,
|
||||
0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x6d, 0x61, 0x67,
|
||||
0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61,
|
||||
0x69, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x70, 0x75, 0x5f,
|
||||
0x70, 0x6f, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x70, 0x75, 0x50, 0x6f,
|
||||
0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x70, 0x6f, 0x64, 0x18,
|
||||
0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x50, 0x6f, 0x64,
|
||||
0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x70, 0x6f, 0x6c, 0x69,
|
||||
0x63, 0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72,
|
||||
0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c,
|
||||
0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x22,
|
||||
0x7c, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a,
|
||||
0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x70,
|
||||
0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f, 0x64,
|
||||
0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xba, 0x02,
|
||||
0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52,
|
||||
0x65, 0x71, 0x12, 0x33, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2e,
|
||||
|
@ -1618,36 +1647,33 @@ var file_idl_pbpod_pod_proto_depIdxs = []int32{
|
|||
16, // 0: pbpod.PodInstance.provider:type_name -> pbtenant.CloudProvider
|
||||
3, // 1: pbpod.CreatePodsReq.createPodReq:type_name -> pbpod.CreatePodReq
|
||||
16, // 2: pbpod.CreatePodReq.provider:type_name -> pbtenant.CloudProvider
|
||||
0, // 3: pbpod.CreatePodResp.pods:type_name -> pbpod.PodInstance
|
||||
16, // 4: pbpod.DeletePodReq.provider:type_name -> pbtenant.CloudProvider
|
||||
0, // 5: pbpod.DeletePodResp.pods:type_name -> pbpod.PodInstance
|
||||
16, // 6: pbpod.UpdatePodReq.provider:type_name -> pbtenant.CloudProvider
|
||||
0, // 7: pbpod.UpdatePodResp.pod:type_name -> pbpod.PodInstance
|
||||
16, // 8: pbpod.ListPodDetailReq.provider:type_name -> pbtenant.CloudProvider
|
||||
0, // 9: pbpod.ListPodDetailResp.pods:type_name -> pbpod.PodInstance
|
||||
16, // 10: pbpod.ListPodReq.provider:type_name -> pbtenant.CloudProvider
|
||||
0, // 11: pbpod.ListPodResp.pods:type_name -> pbpod.PodInstance
|
||||
16, // 12: pbpod.GetPodRegionReq.provider:type_name -> pbtenant.CloudProvider
|
||||
17, // 13: pbpod.GetPodRegionResp.regions:type_name -> pbtenant.Region
|
||||
1, // 14: pbpod.PodService.CreatePods:input_type -> pbpod.CreatePodsReq
|
||||
3, // 15: pbpod.PodService.CreatePod:input_type -> pbpod.CreatePodReq
|
||||
5, // 16: pbpod.PodService.DeletePod:input_type -> pbpod.DeletePodReq
|
||||
7, // 17: pbpod.PodService.UpdatePod:input_type -> pbpod.UpdatePodReq
|
||||
9, // 18: pbpod.PodService.ListPodDetail:input_type -> pbpod.ListPodDetailReq
|
||||
11, // 19: pbpod.PodService.ListPod:input_type -> pbpod.ListPodReq
|
||||
15, // 20: pbpod.PodService.ListPodAll:input_type -> pbpod.ListPodAllReq
|
||||
2, // 21: pbpod.PodService.CreatePods:output_type -> pbpod.CreatePodsResp
|
||||
4, // 22: pbpod.PodService.CreatePod:output_type -> pbpod.CreatePodResp
|
||||
6, // 23: pbpod.PodService.DeletePod:output_type -> pbpod.DeletePodResp
|
||||
8, // 24: pbpod.PodService.UpdatePod:output_type -> pbpod.UpdatePodResp
|
||||
10, // 25: pbpod.PodService.ListPodDetail:output_type -> pbpod.ListPodDetailResp
|
||||
12, // 26: pbpod.PodService.ListPod:output_type -> pbpod.ListPodResp
|
||||
12, // 27: pbpod.PodService.ListPodAll:output_type -> pbpod.ListPodResp
|
||||
21, // [21:28] is the sub-list for method output_type
|
||||
14, // [14:21] is the sub-list for method input_type
|
||||
14, // [14:14] is the sub-list for extension type_name
|
||||
14, // [14:14] is the sub-list for extension extendee
|
||||
0, // [0:14] is the sub-list for field type_name
|
||||
16, // 3: pbpod.DeletePodReq.provider:type_name -> pbtenant.CloudProvider
|
||||
16, // 4: pbpod.UpdatePodReq.provider:type_name -> pbtenant.CloudProvider
|
||||
16, // 5: pbpod.ListPodDetailReq.provider:type_name -> pbtenant.CloudProvider
|
||||
0, // 6: pbpod.ListPodDetailResp.pods:type_name -> pbpod.PodInstance
|
||||
16, // 7: pbpod.ListPodReq.provider:type_name -> pbtenant.CloudProvider
|
||||
0, // 8: pbpod.ListPodResp.pods:type_name -> pbpod.PodInstance
|
||||
16, // 9: pbpod.GetPodRegionReq.provider:type_name -> pbtenant.CloudProvider
|
||||
17, // 10: pbpod.GetPodRegionResp.regions:type_name -> pbtenant.Region
|
||||
1, // 11: pbpod.PodService.CreatePods:input_type -> pbpod.CreatePodsReq
|
||||
3, // 12: pbpod.PodService.CreatePod:input_type -> pbpod.CreatePodReq
|
||||
5, // 13: pbpod.PodService.DeletePod:input_type -> pbpod.DeletePodReq
|
||||
7, // 14: pbpod.PodService.UpdatePod:input_type -> pbpod.UpdatePodReq
|
||||
9, // 15: pbpod.PodService.ListPodDetail:input_type -> pbpod.ListPodDetailReq
|
||||
11, // 16: pbpod.PodService.ListPod:input_type -> pbpod.ListPodReq
|
||||
15, // 17: pbpod.PodService.ListPodAll:input_type -> pbpod.ListPodAllReq
|
||||
2, // 18: pbpod.PodService.CreatePods:output_type -> pbpod.CreatePodsResp
|
||||
4, // 19: pbpod.PodService.CreatePod:output_type -> pbpod.CreatePodResp
|
||||
6, // 20: pbpod.PodService.DeletePod:output_type -> pbpod.DeletePodResp
|
||||
8, // 21: pbpod.PodService.UpdatePod:output_type -> pbpod.UpdatePodResp
|
||||
10, // 22: pbpod.PodService.ListPodDetail:output_type -> pbpod.ListPodDetailResp
|
||||
12, // 23: pbpod.PodService.ListPod:output_type -> pbpod.ListPodResp
|
||||
12, // 24: pbpod.PodService.ListPodAll:output_type -> pbpod.ListPodResp
|
||||
18, // [18:25] is the sub-list for method output_type
|
||||
11, // [11:18] is the sub-list for method input_type
|
||||
11, // [11:11] is the sub-list for extension type_name
|
||||
11, // [11:11] is the sub-list for extension extendee
|
||||
0, // [0:11] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_idl_pbpod_pod_proto_init() }
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -68,11 +68,14 @@
|
|||
"protobufAny": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"@type": {
|
||||
"typeUrl": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": {}
|
||||
"value": {
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
}
|
||||
},
|
||||
"rpcStatus": {
|
||||
"type": "object",
|
||||
|
|
|
@ -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",
|
||||
|
@ -56,6 +56,39 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"/apis/ecs/action": {
|
||||
"post": {
|
||||
"summary": "操作ecs(start-stop-restart)",
|
||||
"operationId": "EcsService_ActionEcs",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pbecsActionResp"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pbecsActionReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"EcsService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/apis/ecs/all": {
|
||||
"get": {
|
||||
"summary": "查询所有云的ECS",
|
||||
|
@ -199,7 +232,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",
|
||||
|
@ -214,14 +247,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",
|
||||
|
@ -229,7 +262,7 @@
|
|||
},
|
||||
{
|
||||
"name": "pageNumber",
|
||||
"description": "分页相关参数,页码",
|
||||
"description": "分页相关参数,页码.",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "integer",
|
||||
|
@ -237,7 +270,7 @@
|
|||
},
|
||||
{
|
||||
"name": "pageSize",
|
||||
"description": "分页相关参数,每页数量",
|
||||
"description": "分页相关参数,每页数量.",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "integer",
|
||||
|
@ -245,7 +278,14 @@
|
|||
},
|
||||
{
|
||||
"name": "nextToken",
|
||||
"description": "分页相关参数,下一页的token",
|
||||
"description": "分页相关参数,下一页的token.",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "namespace",
|
||||
"description": "--------harvester---------\nnamespace.",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
|
@ -291,6 +331,75 @@
|
|||
}
|
||||
},
|
||||
"definitions": {
|
||||
"pbecsActionReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"$ref": "#/definitions/pbtenantCloudProvider",
|
||||
"title": "云名称"
|
||||
},
|
||||
"accountName": {
|
||||
"type": "string",
|
||||
"title": "账户名称,根据config.yaml中的配置,默认为第一个配置的账户"
|
||||
},
|
||||
"regionId": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "区域Id,参考 tenant.proto 中的各个云的区域"
|
||||
},
|
||||
"namespace": {
|
||||
"type": "string",
|
||||
"title": "命名空间"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string",
|
||||
"title": "虚拟机名称"
|
||||
},
|
||||
"actionType": {
|
||||
"$ref": "#/definitions/pbecsActionType",
|
||||
"title": "虚拟机操作状态"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pbecsActionResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"$ref": "#/definitions/pbtenantCloudProvider",
|
||||
"title": "云名称"
|
||||
},
|
||||
"accountName": {
|
||||
"type": "string",
|
||||
"title": "账户名称,根据config.yaml中的配置,默认为第一个配置的账户"
|
||||
},
|
||||
"ecses": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/pbecsEcsInstance"
|
||||
},
|
||||
"title": "Ecs 机器集合"
|
||||
},
|
||||
"finished": {
|
||||
"type": "boolean",
|
||||
"title": "查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"title": "vm状态"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pbecsActionType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"start",
|
||||
"stop",
|
||||
"restart"
|
||||
],
|
||||
"default": "start",
|
||||
"description": "- start: 启动\n - stop: 停止\n - restart: 重启",
|
||||
"title": "虚拟机状态操作"
|
||||
},
|
||||
"pbecsCreateEcsMultipleReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -401,6 +510,83 @@
|
|||
"subnetId": {
|
||||
"type": "string",
|
||||
"title": "待创建云服务器所在的子网信息。需要指定vpcid对应VPC下已创建的子网(subnet)的网络ID,UUID格式。华为云必需"
|
||||
},
|
||||
"namespace": {
|
||||
"type": "string",
|
||||
"title": "-------------harvester---------------\n命名空间"
|
||||
},
|
||||
"cpu": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "vCpu"
|
||||
},
|
||||
"memory": {
|
||||
"type": "string",
|
||||
"title": "memory"
|
||||
},
|
||||
"sshKey": {
|
||||
"type": "string",
|
||||
"title": "ssh_key"
|
||||
},
|
||||
"diskName": {
|
||||
"type": "string",
|
||||
"title": "diskName"
|
||||
},
|
||||
"diskType": {
|
||||
"type": "string",
|
||||
"title": "disk类型 disk,cd-rom"
|
||||
},
|
||||
"diskSize": {
|
||||
"type": "string",
|
||||
"title": "卷大小"
|
||||
},
|
||||
"bus": {
|
||||
"type": "string",
|
||||
"description": "bus 总线指示要模拟的磁盘设备的类型,支持virtio, sata, scsi."
|
||||
},
|
||||
"networkName": {
|
||||
"type": "string",
|
||||
"title": "网络名称"
|
||||
},
|
||||
"networkModel": {
|
||||
"type": "string",
|
||||
"description": "network_model 网络模式,支持e1000, e1000e, ne2k_pci, pcnet, rtl8139, virtio."
|
||||
},
|
||||
"network": {
|
||||
"type": "string",
|
||||
"title": "网络"
|
||||
},
|
||||
"networkType": {
|
||||
"type": "string",
|
||||
"title": "网络连接方法,默认bridge"
|
||||
},
|
||||
"osType": {
|
||||
"type": "string",
|
||||
"title": "osType //系统类型"
|
||||
},
|
||||
"machineType": {
|
||||
"type": "string",
|
||||
"title": "machineType //机器类型 none、q35、pc"
|
||||
},
|
||||
"machineName": {
|
||||
"type": "string",
|
||||
"title": "machineName //主机名称,默认为虚拟机名称"
|
||||
},
|
||||
"userDataTemplate": {
|
||||
"type": "string",
|
||||
"title": "userDataTemplate //用户数据模板"
|
||||
},
|
||||
"networkDataTemplate": {
|
||||
"type": "string",
|
||||
"title": "networkDataTemplate //网络数据模板"
|
||||
},
|
||||
"vmTemplateName": {
|
||||
"type": "string",
|
||||
"title": "vmTemplateName //模板名称"
|
||||
},
|
||||
"vmTemplateVersion": {
|
||||
"type": "string",
|
||||
"title": "vmTemplateVersion //版本号"
|
||||
}
|
||||
},
|
||||
"title": "创建ECS入参"
|
||||
|
@ -487,6 +673,18 @@
|
|||
"deleteVolume": {
|
||||
"type": "string",
|
||||
"title": "配置删除云服务器是否删除云服务器对应的数据盘,如果选择不删除,则系统仅做卸载操作,保留云硬盘资源。默认为false。\n取值为true或false。默认false;华为云"
|
||||
},
|
||||
"instanceName": {
|
||||
"type": "string",
|
||||
"title": "----------------harvester----------------\n虚拟机名称"
|
||||
},
|
||||
"namespace": {
|
||||
"type": "string",
|
||||
"title": "namespace"
|
||||
},
|
||||
"diskName": {
|
||||
"type": "string",
|
||||
"title": "diskName,以“,” 分割"
|
||||
}
|
||||
},
|
||||
"title": "删除ECS入参"
|
||||
|
@ -549,13 +747,11 @@
|
|||
"title": "实例类型"
|
||||
},
|
||||
"cpu": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"type": "string",
|
||||
"title": "vcpu数"
|
||||
},
|
||||
"memory": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"type": "string",
|
||||
"title": "内存MB"
|
||||
},
|
||||
"description": {
|
||||
|
@ -592,6 +788,14 @@
|
|||
"instanceChargeType": {
|
||||
"type": "string",
|
||||
"title": "收费类型"
|
||||
},
|
||||
"node": {
|
||||
"type": "string",
|
||||
"title": "-----------harvester---------\n虚拟机所在的节点"
|
||||
},
|
||||
"namespace": {
|
||||
"type": "string",
|
||||
"title": "namespace"
|
||||
}
|
||||
},
|
||||
"title": "ECS 实例"
|
||||
|
@ -722,6 +926,22 @@
|
|||
"securityGroupIds": {
|
||||
"type": "string",
|
||||
"title": "实例重新加入的安全组列表,安全组ID不能重复。以”,“分割"
|
||||
},
|
||||
"namespace": {
|
||||
"type": "string",
|
||||
"title": "---------------harvester-----------------\nnamespace"
|
||||
},
|
||||
"cpu": {
|
||||
"type": "string",
|
||||
"title": "cpu"
|
||||
},
|
||||
"memory": {
|
||||
"type": "string",
|
||||
"title": "memory"
|
||||
},
|
||||
"isRestart": {
|
||||
"type": "boolean",
|
||||
"title": "修改配置后是否重启"
|
||||
}
|
||||
},
|
||||
"title": "更新ECS入参"
|
||||
|
@ -765,11 +985,14 @@
|
|||
"protobufAny": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"@type": {
|
||||
"typeUrl": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": {}
|
||||
"value": {
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
}
|
||||
},
|
||||
"rpcStatus": {
|
||||
"type": "object",
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
"parameters": [
|
||||
{
|
||||
"name": "provider",
|
||||
"description": "cloud name\n\n - ali: 0 - 阿里云\n - tencent: 1 - 腾讯云\n - huawei: 2 - 华为云\n - k8s: 3 - K8S\n - harvester: 3 - Harvester",
|
||||
"description": "cloud name.\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"
|
||||
|
@ -381,13 +381,6 @@
|
|||
"pbpodCreatePodResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pods": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/pbpodPodInstance"
|
||||
},
|
||||
"title": "Pod集合"
|
||||
},
|
||||
"finished": {
|
||||
"type": "boolean",
|
||||
"title": "查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询"
|
||||
|
@ -395,6 +388,14 @@
|
|||
"requestId": {
|
||||
"type": "string",
|
||||
"title": "请求id,出现问题后提供给云厂商,排查问题"
|
||||
},
|
||||
"podId": {
|
||||
"type": "string",
|
||||
"title": "podId"
|
||||
},
|
||||
"podName": {
|
||||
"type": "string",
|
||||
"title": "podName"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -406,7 +407,7 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/pbpodCreatePodReq"
|
||||
},
|
||||
"title": "云类型"
|
||||
"title": "创建请求集合"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -459,13 +460,6 @@
|
|||
"pbpodDeletePodResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pods": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/pbpodPodInstance"
|
||||
},
|
||||
"title": "Pod集合"
|
||||
},
|
||||
"finished": {
|
||||
"type": "boolean",
|
||||
"title": "查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询"
|
||||
|
@ -473,6 +467,14 @@
|
|||
"requestId": {
|
||||
"type": "string",
|
||||
"title": "请求id,出现问题后提供给云厂商,排查问题"
|
||||
},
|
||||
"podId": {
|
||||
"type": "string",
|
||||
"title": "podId"
|
||||
},
|
||||
"podName": {
|
||||
"type": "string",
|
||||
"title": "podName"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -645,10 +647,6 @@
|
|||
"pbpodUpdatePodResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pod": {
|
||||
"$ref": "#/definitions/pbpodPodInstance",
|
||||
"title": "Pod集合"
|
||||
},
|
||||
"finished": {
|
||||
"type": "boolean",
|
||||
"title": "查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询"
|
||||
|
@ -656,6 +654,14 @@
|
|||
"requestId": {
|
||||
"type": "string",
|
||||
"title": "请求id,出现问题后提供给云厂商,排查问题"
|
||||
},
|
||||
"podId": {
|
||||
"type": "string",
|
||||
"title": "podId"
|
||||
},
|
||||
"podName": {
|
||||
"type": "string",
|
||||
"title": "podName"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -675,11 +681,14 @@
|
|||
"protobufAny": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"@type": {
|
||||
"typeUrl": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": {}
|
||||
"value": {
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
}
|
||||
},
|
||||
"rpcStatus": {
|
||||
"type": "object",
|
||||
|
|
|
@ -15,11 +15,14 @@
|
|||
"protobufAny": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"@type": {
|
||||
"typeUrl": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": {}
|
||||
"value": {
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
}
|
||||
},
|
||||
"rpcStatus": {
|
||||
"type": "object",
|
||||
|
|
Loading…
Reference in New Issue