From af20f46d915e3e725a69c43e382e58dea7ba84bd Mon Sep 17 00:00:00 2001 From: Renzheng Wang Date: Fri, 20 Sep 2024 08:52:30 +0800 Subject: [PATCH] Support/batch naming (#89) * support naming in batch on creating uhost --- CHANGELOG.md | 4 + Makefile | 3 +- base/config.go | 2 +- cmd/uhost.go | 118 ++++++++++++- go.mod | 2 +- go.sum | 2 + .../ucloud/ucloud-sdk-go/services/udb/apis.go | 69 +++++++- .../ucloud-sdk-go/services/udb/models.go | 50 ++++-- .../ucloud-sdk-go/services/uhost/apis.go | 117 +++++++------ .../ucloud-sdk-go/services/uhost/models.go | 116 +++++++------ .../ucloud-sdk-go/services/umem/apis.go | 160 ++++++++++++++++-- .../ucloud-sdk-go/services/unet/apis.go | 89 +++++++++- .../ucloud-sdk-go/services/unet/models.go | 30 ++++ .../ucloud-sdk-go/ucloud/version/version.go | 2 +- vendor/modules.txt | 2 +- 15 files changed, 617 insertions(+), 149 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7da0642ab8..9fc72fd0df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.0 (2024-09-20) + +* support naming in batch on creating uhost + ## 0.2.0 (2024-06-12) * ssh key pair and security group support for creating uhost diff --git a/Makefile b/Makefile index 32ed3a3856..d9d35d62ba 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -export VERSION=0.2.0 +export VERSION=0.3.0 + GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor) .PHONY : install diff --git a/base/config.go b/base/config.go index f94042e325..b4ecb7f72d 100644 --- a/base/config.go +++ b/base/config.go @@ -39,7 +39,7 @@ const DefaultBaseURL = "https://api.ucloud.cn/" const DefaultProfile = "default" // Version 版本号 -const Version = "0.2.0" +const Version = "0.3.0" var UserAgent = fmt.Sprintf("UCloud-CLI/%s", Version) diff --git a/cmd/uhost.go b/cmd/uhost.go index b03bf900a1..25e8065fb8 100644 --- a/cmd/uhost.go +++ b/cmd/uhost.go @@ -415,8 +415,23 @@ func NewCmdUHostCreate() *cobra.Command { wg := &sync.WaitGroup{} tokens := make(chan struct{}, concurrent) wg.Add(count) + batchRename, err := regexp.Match(`[%d,%d]`, []byte(*req.Name)) + if err != nil || !batchRename { + batchRename = false + } + if batchRename { + var actualRequest uhost.CreateUHostInstanceRequest + actualRequest = *req + if len(bindEipIDs) > 0 { + if len(bindEipIDs) != count { + return fmt.Errorf("bind-eip count should be equal to uhost count") + } + actualRequest.NetworkInterface = nil + } + wg.Add(1 - count) + createMultipleUhostWrapper(&actualRequest, count, updateEIPReq, bindEipIDs, async, make(chan bool, 1), wg, tokens) - if count <= 5 { + } else if count <= 5 { for i := 0; i < count; i++ { bindEipID := "" if len(bindEipIDs) > i { @@ -560,6 +575,23 @@ func NewCmdUHostCreate() *cobra.Command { return cmd } +// createMultipleUhostWrapper 处理UI和并发控制 +func createMultipleUhostWrapper(req *uhost.CreateUHostInstanceRequest, count int, updateEIPReq *unet.UpdateEIPAttributeRequest, bindEipIDs []string, async bool, retCh chan<- bool, wg *sync.WaitGroup, tokens chan struct{}) { + //控制并发数量 + tokens <- struct{}{} + defer func() { + <-tokens + //设置延时,使报错能渲染出来 + time.Sleep(time.Second / 5) + wg.Done() + }() + + success, logs := createMultipleUhost(req, count, updateEIPReq, bindEipIDs, async) + retCh <- success + logs = append(logs, fmt.Sprintf("result:%t", success)) + base.LogInfo(logs...) +} + // createUhostWrapper 处理UI和并发控制 func createUhostWrapper(req *uhost.CreateUHostInstanceRequest, updateEIPReq *unet.UpdateEIPAttributeRequest, bindEipID string, async bool, retCh chan<- bool, wg *sync.WaitGroup, tokens chan struct{}, idx int) { //控制并发数量 @@ -577,6 +609,90 @@ func createUhostWrapper(req *uhost.CreateUHostInstanceRequest, updateEIPReq *une base.LogInfo(logs...) } +func createMultipleUhost(req *uhost.CreateUHostInstanceRequest, count int, updateEIPReq *unet.UpdateEIPAttributeRequest, bindEipIDs []string, async bool) (bool, []string) { + resp, err := base.BizClient.CreateUHostInstance(req) + block := ux.NewBlock() + ux.Doc.Append(block) + logs := []string{"=================================================="} + logs = append(logs, fmt.Sprintf("api:CreateUHostInstance, request:%v", base.ToQueryMap(req))) + if err != nil { + logs = append(logs, fmt.Sprintf("err:%v", err)) + block.Append(base.ParseError(err)) + return false, logs + } + if len(bindEipIDs) > 0 && len(bindEipIDs) != count { + block.Append(fmt.Sprintf("expect eip count %d, accept %d", count, len(bindEipIDs))) + return false, logs + } + + logs = append(logs, fmt.Sprintf("resp:%#v", resp)) + if req.MaxCount == nil { + req.MaxCount = sdk.Int(1) + } + req.MaxCount = sdk.Int(count) + if len(resp.UHostIds) != *req.MaxCount { + block.Append(fmt.Sprintf("expect uhost count %d, accept %d", count, len(resp.UHostIds))) + return false, logs + } + for i, uhostID := range resp.UHostIds { + text := fmt.Sprintf("the uhost[%s]", uhostID) + if len(req.Disks) > 1 { + text = fmt.Sprintf("%s which attached a data disk", text) + if len(req.NetworkInterface) > 0 { + text = fmt.Sprintf("%s and binded an eip", text) + } + } else if len(req.NetworkInterface) > 0 { + text = fmt.Sprintf("%s which binded an eip", text) + } + text = fmt.Sprintf("%s is initializing", text) + + if async { + block.Append(text) + } else { + uhostSpoller.Sspoll(resp.UHostIds[0], text, []string{status.HOST_RUNNING, status.HOST_FAIL}, block, &req.CommonBase) + } + bindEipID := bindEipIDs[i] + if bindEipID != "" { + eip := base.PickResourceID(bindEipID) + logs = append(logs, fmt.Sprintf("bind eip: %s", eip)) + eipLogs, err := sbindEIP(sdk.String(uhostID), sdk.String("uhost"), &eip, req.ProjectId, req.Region) + logs = append(logs, eipLogs...) + if err != nil { + block.Append(fmt.Sprintf("bind eip[%s] with uhost[%s] failed: %v", eip, uhostID, err)) + return false, logs + } + block.Append(fmt.Sprintf("bind eip[%s] with uhost[%s] successfully", eip, uhostID)) + } else if len(req.NetworkInterface) > 0 { + ipSet, err := getEIPByUHostId(uhostID) + if err != nil { + block.Append(err.Error()) + return false, logs + } + block.Append(fmt.Sprintf("IP:%s Line:%s", ipSet.IP, ipSet.Type)) + if *updateEIPReq.Name != "" || *updateEIPReq.Remark != "" { + var message string + if *updateEIPReq.Name != "" && *updateEIPReq.Remark != "" { + message = "name and remark" + } else if *updateEIPReq.Name != "" { + message = "name" + } else { + message = "remark" + } + + logs = append(logs, fmt.Sprintf("update attribute %s of eip[%s] binded uhost[%s]", message, ipSet.IPId, uhostID)) + updateEIPReq.EIPId = sdk.String(ipSet.IPId) + _, err = base.BizClient.UpdateEIPAttribute(updateEIPReq) + if err != nil { + block.Append(fmt.Sprintf("update attribute %s of eip[%s] binded uhost[%s] got err, %s", message, ipSet.IPId, uhostID, err)) + return false, logs + } + block.Append(fmt.Sprintf("update attribute %s of eip[%s] binded uhost[%s] successfully", message, ipSet.IPId, uhostID)) + } + } + } + return true, logs +} + func createUhost(req *uhost.CreateUHostInstanceRequest, updateEIPReq *unet.UpdateEIPAttributeRequest, bindEipID string, async bool) (bool, []string) { resp, err := base.BizClient.CreateUHostInstance(req) block := ux.NewBlock() diff --git a/go.mod b/go.mod index 95fd05f6c6..58b024d2b4 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/sirupsen/logrus v1.3.0 github.com/spf13/cobra v0.0.3 github.com/spf13/pflag v1.0.3 - github.com/ucloud/ucloud-sdk-go v0.22.17 + github.com/ucloud/ucloud-sdk-go v0.22.25 golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 ) diff --git a/go.sum b/go.sum index 7ba140b464..587a20d04f 100644 --- a/go.sum +++ b/go.sum @@ -51,6 +51,8 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/ucloud/ucloud-sdk-go v0.22.17 h1:EFn+GxVKS5Tj8hIPie3qL6Zgk25fmWcHqJ06K8wl+Qo= github.com/ucloud/ucloud-sdk-go v0.22.17/go.mod h1:dyLmFHmUfgb4RZKYQP9IArlvQ2pxzFthfhwxRzOEPIw= +github.com/ucloud/ucloud-sdk-go v0.22.25 h1:ceKeH7WFnpUt9nJSubn+mnxS1iKGrk/Q+HLwa0iYwmQ= +github.com/ucloud/ucloud-sdk-go v0.22.25/go.mod h1:dyLmFHmUfgb4RZKYQP9IArlvQ2pxzFthfhwxRzOEPIw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/apis.go index 719de416f7..4039e1caf8 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/apis.go @@ -646,8 +646,8 @@ type CreateUDBInstanceRequest struct { // UDB实例模式类型, 可选值如下: "Normal": 普通版UDB实例 "HA": 高可用版UDB实例 默认是"Normal" InstanceMode *string `required:"false"` - // 【该字段已废弃,请谨慎使用】 - InstanceType *string `required:"false" deprecated:"true"` + // UDB数据库机型: "SATA_SSD": "SSD机型" , "PCIE_SSD": "SSD高性能机型" , "Normal_Volume": "标准大容量机型", "SATA_SSD_Volume": "SSD大容量机型" , "PCIE_SSD_Volume": "SSD高性能大容量机型", "NVMe_SSD": "快杰机型" + InstanceType *string `required:"false"` // 规格类型ID,当SpecificationType为1时有效 MachineType *string `required:"false"` @@ -2967,6 +2967,68 @@ func (c *UDBClient) GetUDBInstanceSSLCertURL(req *GetUDBInstanceSSLCertURLReques return &res, nil } +// ListUDBMachineTypeRequest is request schema for ListUDBMachineType action +type ListUDBMachineTypeRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Zone *string `required:"true"` + + // UDB实例模式类型, 可选值如下: "Normal": 普通版UDB实例 "HA": 高可用版UDB实例 默认是"Normal" + InstanceMode *string `required:"false"` +} + +// ListUDBMachineTypeResponse is response schema for ListUDBMachineType action +type ListUDBMachineTypeResponse struct { + response.CommonBase + + // 计算规格列表 + DataSet []MachineType + + // 默认计算规格 + DefaultMachineType MachineType + + // 接口返回信息 + Message string +} + +// NewListUDBMachineTypeRequest will create request of ListUDBMachineType action. +func (c *UDBClient) NewListUDBMachineTypeRequest() *ListUDBMachineTypeRequest { + req := &ListUDBMachineTypeRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: ListUDBMachineType + +获取UDB云数据库支持的计算规格列表,暂不支持获取跨可用区实例的计算规格,目前支持的数据库品类包括:NVMe版和SSD云盘版MySQL +*/ +func (c *UDBClient) ListUDBMachineType(req *ListUDBMachineTypeRequest) (*ListUDBMachineTypeResponse, error) { + var err error + var res ListUDBMachineTypeResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ListUDBMachineType", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // ListUDBUserTablesRequest is request schema for ListUDBUserTables action type ListUDBUserTablesRequest struct { request.CommonBase @@ -3369,6 +3431,9 @@ type ResizeUDBInstanceRequest struct { // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"false"` + // 数据库的CPU核数(只对普通版的SQLServer有用) + CPU *int `required:"false"` + // 使用的代金券id CouponId *string `required:"false"` diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/models.go index edb8c587a2..340f55945b 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/models.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/models.go @@ -47,6 +47,18 @@ type UDBBackupSet struct { Zone string } +/* +UFileDataSet - 增加ufile的描述 +*/ +type UFileDataSet struct { + + // bucket名称 + Bucket string + + // Ufile的令牌tokenid + TokenID string +} + /* UDBSlaveInstanceSet - DescribeUDBSlaveInstance */ @@ -140,7 +152,7 @@ type UDBSlaveInstanceSet struct { SSDType string // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType - SpecificationType string + SpecificationType int // 对mysql的slave而言是master的DBId,对master则为空, 对mongodb则是副本集id SrcDBId string @@ -173,18 +185,6 @@ type UDBSlaveInstanceSet struct { Zone string } -/* -UFileDataSet - 增加ufile的描述 -*/ -type UFileDataSet struct { - - // bucket名称 - Bucket string - - // Ufile的令牌tokenid - TokenID string -} - /* UDBInstanceSet - DescribeUDBInstance */ @@ -509,6 +509,30 @@ type ConnNumMap struct { Num int } +/* +MachineType - mysql数据库机型 +*/ +type MachineType struct { + + // 规格cpu核数 + Cpu int + + // 计算规格描述,格式为"nCmG",表示n核mG内存实例 + Description string + + // 内存/cpu配比 + Group string + + // 计算规格id, 目前支持CPU和内存比1:2、1:4、1:8三类配比规格;规格的格式为:"机型.配比.CPU核数规格";机型支持o和n两种机型,分别代表快杰NVMe和SSD云盘机型;配比映射关系如下:2m代表CPU内存配比1比2,4m代表CPU内存配比1比4,8m代表CPU内存配比1比8,CPU核数规格射关系如下:small代表1C,medium代表2C,xlarge代表4C,2xlarge代表8C,4xlarge代表16C,8xlarge代表32C,16xlarge代表64C,例如 "o.mysql4m.medium"表示创建快杰NVMe机型2C8G的实例,"o.mysql8m.4xlarge"表示创建快杰NVMe机型16C128G的实例 + ID string + + // 规格内存大小,单位(GB) + Memory int + + // 内部云主机机型,可选"o/n" + Os string +} + /* TableData - 用户表详情 */ diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/apis.go index f0c0857955..2b17057122 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/apis.go @@ -90,6 +90,9 @@ type CreateCustomImageRequest struct { // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"false"` + // 【数组】关联的云盘数据盘id列表。注意: 云盘数据盘需要开启快照服务 + DataUDiskIds []string `required:"false"` + // 镜像描述 ImageDescription *string `required:"false"` @@ -104,6 +107,9 @@ type CreateCustomImageRequest struct { type CreateCustomImageResponse struct { response.CommonBase + // 云盘数据盘快照id列表 + DataSnapshotIds []string + // 镜像Id ImageId string } @@ -195,12 +201,6 @@ func (c *UHostClient) CreateIsolationGroup(req *CreateIsolationGroupRequest) (*C return &res, nil } -/* -UHostDiskCustomBackup is request schema for complex param -*/ -type UHostDiskCustomBackup struct { -} - /* CreateUHostInstanceParamNetworkInterfaceIPv6 is request schema for complex param */ @@ -231,12 +231,42 @@ type CreateUHostInstanceParamNetworkInterfaceEIP struct { ShareBandwidthId *string `required:"false"` } +/* +UHostDiskCustomBackup is request schema for complex param +*/ +type UHostDiskCustomBackup struct { +} + +/* +CreateUHostInstanceParamNetworkInterface is request schema for complex param +*/ +type CreateUHostInstanceParamNetworkInterface struct { + + // 申请并绑定一个教育网EIP。True为申请并绑定,False为不会申请绑定,默认False。当前只支持具有HPC特性的机型。 + CreateCernetIp *bool `required:"false"` + + // + EIP *CreateUHostInstanceParamNetworkInterfaceEIP `required:"false"` +} + +/* +CreateUHostInstanceParamVolumes is request schema for complex param +*/ +type CreateUHostInstanceParamVolumes struct { + + // 【该字段已废弃,请谨慎使用】 + CouponId *string `required:"false" deprecated:"true"` + + // 【该字段已废弃,请谨慎使用】 + IsBoot *string `required:"false" deprecated:"true"` +} + /* UHostDisk is request schema for complex param */ type UHostDisk struct { - // 磁盘备份方案。枚举值:\\ > NONE,无备份 \\ > DATAARK,数据方舟【已下线,不再支持】 \\ > SNAPSHOT,快照 \\当前磁盘支持的备份模式参考 [[api:uhost-api:disk_type|磁盘类型]],默认值:NONE + // 磁盘备份方案。枚举值:\\ > NONE,无备份 \\ > SNAPSHOT,快照 \\当前磁盘支持的备份模式参考 [[api:uhost-api:disk_type|磁盘类型]],默认值:NONE BackupType *string `required:"false"` // 云盘代金券id。不适用于系统盘/本地盘。请通过DescribeCoupon接口查询,或登录用户中心查看 @@ -261,18 +291,6 @@ type UHostDisk struct { Type *string `required:"true"` } -/* -CreateUHostInstanceParamNetworkInterface is request schema for complex param -*/ -type CreateUHostInstanceParamNetworkInterface struct { - - // 申请并绑定一个教育网EIP。True为申请并绑定,False为不会申请绑定,默认False。当前只支持具有HPC特性的机型。 - CreateCernetIp *bool `required:"false"` - - // - EIP *CreateUHostInstanceParamNetworkInterfaceEIP `required:"false"` -} - /* CreateUHostInstanceParamSecGroupId is request schema for complex param */ @@ -290,22 +308,10 @@ CreateUHostInstanceParamFeatures is request schema for complex param */ type CreateUHostInstanceParamFeatures struct { - // 弹性网卡特性。开启了弹性网卡权限位,此特性才生效,默认 false 未开启,true 开启,仅与 NetCapability Normal 兼容。 + // 弹性网卡特性。开启了弹性网卡权限位,此特性才生效,默认 false 未开启,true 开启。 UNI *bool `required:"false"` } -/* -CreateUHostInstanceParamVolumes is request schema for complex param -*/ -type CreateUHostInstanceParamVolumes struct { - - // 【该字段已废弃,请谨慎使用】 - CouponId *string `required:"false" deprecated:"true"` - - // 【该字段已废弃,请谨慎使用】 - IsBoot *string `required:"false" deprecated:"true"` -} - // CreateUHostInstanceRequest is request schema for CreateUHostInstance action type CreateUHostInstanceRequest struct { request.CommonBase @@ -319,7 +325,7 @@ type CreateUHostInstanceRequest struct { // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"true"` - // 告警模板id,如果传了告警模板id,且告警模板id正确,则绑定告警模板。绑定告警模板失败只会在后台有日志,不会影响创建主机流程,也不会在前端报错。 + // 告警模板id,如果传了告警模板id,且告警模板id正确,则绑定告警模板。绑定告警模板失败不会影响创建主机流程。 AlarmTemplateId *int `required:"false"` // 数据盘是否需要自动分区挂载。当镜像支持“Cloud-init”Feature时可填写此字段。取值 >“On” 自动挂载(默认值)> “Off” 不自动挂载。 @@ -349,7 +355,7 @@ type CreateUHostInstanceRequest struct { // GPU卡核心数。仅GPU机型支持此字段(可选范围与MachineType+GpuType相关) GPU *int `required:"false"` - // GPU类型,枚举值["K80", "P40", "V100", "T4","T4A", "T4S","2080Ti","2080Ti-4C","1080Ti", "T4/4", "MI100", "V100S",2080","2080TiS","2080TiPro","3090","A100"],MachineType为G时必填 + // GPU类型,枚举值["K80", "P40", "V100", "T4","T4A", "T4S","2080Ti","2080Ti-4C","1080Ti", "T4/4", "V100S",2080","2080TiS","2080TiPro","3090","4090","A100"]。MachineType为G时必填 GpuType *string `required:"false"` // 【私有专区属性】专区云主机开启宿住关联属性 @@ -382,7 +388,7 @@ type CreateUHostInstanceRequest struct { // 主机登陆模式。密码(默认选项): Password,密钥:KeyPair。 LoginMode *string `required:"true"` - // 云主机机型(V2.0),在本字段和字段UHostType中,仅需要其中1个字段即可。枚举值["N", "C", "G", "O", "OS", "OM", "OPRO", "OMAX", "O.BM", "O.EPC"]。参考[[api:uhost-api:uhost_type|云主机机型说明]]。 + // 云主机机型(V2.0),在本字段和字段UHostType中,仅需要其中1个字段即可。枚举值["N", "C", "G", "O", "OM", "OMEM", "OPRO", "OPROG"]。参考[[api:uhost-api:uhost_type|云主机机型说明]]。 MachineType *string `required:"false"` // 本次最大创建主机数量,取值范围是[1,100],默认值为1。- 库存数量不足时,按库存数量创建。- 配额不足时,返回错误。- 使用隔离组时,以隔离组可用数量为准。 @@ -391,13 +397,13 @@ type CreateUHostInstanceRequest struct { // 内存大小。单位:MB。范围 :[1024, 262144],取值为1024的倍数(可选范围参考控制台)。默认值:8192 Memory *int `required:"false"` - // 最低cpu平台,枚举值["Intel/Auto", "Intel/IvyBridge", "Intel/Haswell", "Intel/Broadwell", "Intel/Skylake", "Intel/Cascadelake", "Intel/CascadelakeR", "Intel/IceLake", "Amd/Epyc2", "Amd/Auto","Ampere/Auto","Ampere/Altra"],默认值是"Intel/Auto"。 + // 最低cpu平台,枚举值["Intel/Auto", "Intel/IvyBridge", "Intel/Haswell", "Intel/Broadwell", "Intel/Skylake", "Intel/Cascadelake", "Intel/CascadelakeR", "Intel/IceLake", "Intel/SapphireRapids", "Amd/Epyc2", "Amd/Auto","Ampere/Auto","Ampere/Altra"],默认值是"Intel/Auto"。 MinimalCpuPlatform *string `required:"false"` // UHost实例名称。默认:UHost。请遵照[[api:uhost-api:specification|字段规范]]设定实例名称。 Name *string `required:"false"` - // 网络增强特性。枚举值:Normal,不开启; Super,开启网络增强1.0; Ultra,开启网络增强2.0(详情参考官网文档) + // 网络增强特性。枚举值:Normal,不开启; Super,开启网络增强1.0; Ultra,开启网络增强2.0;Extreme,开启网络增强3.0(详情参考官网文档) NetCapability *string `required:"false"` // 【该字段已废弃,请谨慎使用】 @@ -406,7 +412,7 @@ type CreateUHostInstanceRequest struct { // NetworkInterface []CreateUHostInstanceParamNetworkInterface `required:"false"` - // UHost密码。请遵照[[api:uhost-api:specification|字段规范]]设定密码。密码需使用base64进行编码,举例如下:# echo -n Password1 | base64UGFzc3dvcmQx。 + // UHost密码。请遵照[[api:uhost-api:specification|字段规范]]设定密码。密码需使用base64进行编码,举例如下:# echo -n Password1 | base64 UGFzc3dvcmQx。 Password *string `required:"false"` // 【数组】创建云主机时指定内网IP。若不传值,则随机分配当前子网下的IP。调用方式举例:PrivateIp.0=x.x.x.x。当前只支持一个内网IP。 @@ -745,6 +751,9 @@ type DescribeImageRequest struct { // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"false"` + // 镜像归属,枚举值:["gpu","app","uhost"]。"gpu": 对gpu进行处理过的行业镜像;"app":轻量云主机专用的镜像;"uhost":云主机镜像市场的行业镜像。FuncType传参错误会被忽略 + FuncType *string `required:"false"` + // 镜像Id ImageId *string `required:"false"` @@ -1147,21 +1156,6 @@ func (c *UHostClient) GetAttachedDiskUpgradePrice(req *GetAttachedDiskUpgradePri return &res, nil } -/* -GetUHostInstancePriceParamVolumes is request schema for complex param -*/ -type GetUHostInstancePriceParamVolumes struct { - - // 【该字段已废弃,请谨慎使用】 - IsBoot *string `required:"false" deprecated:"true"` - - // 【该字段已废弃,请谨慎使用】 - Size *int `required:"false" deprecated:"true"` - - // 【该字段已废弃,请谨慎使用】 - Type *string `required:"false" deprecated:"true"` -} - /* getUHostInstancePriceParamDisks is request schema for complex param */ @@ -1180,6 +1174,21 @@ type getUHostInstancePriceParamDisks struct { Type *string `required:"true"` } +/* +GetUHostInstancePriceParamVolumes is request schema for complex param +*/ +type GetUHostInstancePriceParamVolumes struct { + + // 【该字段已废弃,请谨慎使用】 + IsBoot *string `required:"false" deprecated:"true"` + + // 【该字段已废弃,请谨慎使用】 + Size *int `required:"false" deprecated:"true"` + + // 【该字段已废弃,请谨慎使用】 + Type *string `required:"false" deprecated:"true"` +} + // GetUHostInstancePriceRequest is request schema for GetUHostInstancePrice action type GetUHostInstancePriceRequest struct { request.CommonBase @@ -1501,7 +1510,7 @@ type GetUHostUpgradePriceRequest struct { // 内存大小。单位:MB。范围 :[1024, 262144],取值为1024的倍数(可选范围参考控制台)。默认值为当前实例的内存大小。 Memory *int `required:"false"` - // 网卡升降级(1,表示升级,2表示降级,0表示不变) + // 网卡升降级(1,表示升级,2表示降级,0表示不变)。仅支持网络增强1.0和网络增强2.0的开启和关闭,不支持网络增强特性互相转换,如网络增强1.0升级到网络增强2.0是不被支持的。 NetCapValue *int `required:"false"` // 【该字段已废弃,请谨慎使用】 diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/models.go index 0642928c5f..f2a919b4b3 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/models.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/models.go @@ -26,6 +26,21 @@ type KeyPair struct { ProjectId string } +/* +Collection - CPU和内存可支持的规格 +*/ +type Collection struct { + + // CPU规格 + Cpu int + + // 内存规格 + Memory []int + + // CPU和内存规格只能在列出来的CPU平台支持 + MinimalCpuPlatform []string +} + /* FeatureModes - 可以支持的模式类别 */ @@ -78,18 +93,15 @@ type BootDiskInfo struct { } /* -Collection - CPU和内存可支持的规格 +MachineSizes - GPU、CPU和内存信息 */ -type Collection struct { - - // CPU规格 - Cpu int +type MachineSizes struct { - // 内存规格 - Memory []int + // CPU和内存可支持的规格 + Collection []Collection - // CPU和内存规格只能在列出来的CPU平台支持 - MinimalCpuPlatform []string + // Gpu为GPU可支持的规格即GPU颗数,非GPU机型,Gpu为0 + Gpu int } /* @@ -116,6 +128,18 @@ type Features struct { Name string } +/* +Performance - GPU的性能指标 +*/ +type Performance struct { + + // 交互展示参数,可忽略 + Rate int + + // 值,单位是TFlops + Value float64 +} + /* Disks - 磁盘信息 */ @@ -146,30 +170,6 @@ type CpuPlatforms struct { Intel []string } -/* -Performance - GPU的性能指标 -*/ -type Performance struct { - - // 交互展示参数,可忽略 - Rate int - - // 值,单位是TFlops - Value float64 -} - -/* -MachineSizes - GPU、CPU和内存信息 -*/ -type MachineSizes struct { - - // CPU和内存可支持的规格 - Collection []Collection - - // Gpu为GPU可支持的规格即GPU颗数,非GPU机型,Gpu为0 - Gpu int -} - /* AvailableInstanceTypes - https://ushare.ucloudadmin.com/pages/viewpage.action?pageId=104662646 */ @@ -214,10 +214,13 @@ type UHostImageSet struct { // 创建时间,格式为Unix时间戳 CreateTime int + // 关联的云盘数据盘快照Id列表 + DataSnapshotIds []string + // 特殊状态标识,目前包含NetEnhnced(网络增强1.0), NetEnhanced_Ultra(网络增强2.0), NetEnhanced_Extreme(网络增强3.0), HotPlug(热升级), GPU(GPU镜像),CloudInit, IPv6(支持IPv6网络),RssdAttachable(支持RSSD云盘),Vgpu_AMD(支持AMD的vgpu),Vgpu_NVIDIA(支持NVIDIA的vgpu),Aarch64_Type(支持arm64架构) Features []string - // 行业镜像类型(仅行业镜像将返回这个值) + // 镜像归属,枚举值:["gpu","app","uhost"]。"gpu": 对gpu进行处理过的行业镜像;"app":轻量云主机专用的镜像;"uhost":云主机镜像市场的行业镜像 FuncType string // 镜像描述 @@ -241,6 +244,9 @@ type UHostImageSet struct { // 介绍链接(仅行业镜像将返回这个值) Links string + // 系统EOL的时间,格式:YYYY/MM/DD + MaintainEol string + // 默认值为空'''。当CentOS 7.3/7.4/7.5等镜像会标记为“Broadwell” MinimalCPU string @@ -299,15 +305,6 @@ type IsolationGroup struct { SpreadInfoSet []SpreadInfo } -/* -SpotAttribute - 竞价实例属性 -*/ -type SpotAttribute struct { - - // 回收时间 - RecycleTime int -} - /* UDSetUDHostAttribute - 私有专区对应的宿主机属性 */ @@ -356,18 +353,6 @@ type UHostDiskSet struct { Type string } -/* -UHostKeyPair - 主机密钥信息 -*/ -type UHostKeyPair struct { - - // 密钥对ID - KeyPairId string - - // 主机密钥对状态,Normal 正常,Deleted 删除 - KeyPairState string -} - /* UHostIPSet - DescribeUHostInstance */ @@ -407,6 +392,27 @@ type UHostIPSet struct { Weight int } +/* +UHostKeyPair - 主机密钥信息 +*/ +type UHostKeyPair struct { + + // 密钥对ID + KeyPairId string + + // 主机密钥对状态,Normal 正常,Deleted 删除 + KeyPairState string +} + +/* +SpotAttribute - 竞价实例属性 +*/ +type SpotAttribute struct { + + // 回收时间 + RecycleTime int +} + /* UHostInstanceSet - DescribeUHostInstance */ diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/umem/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/umem/apis.go index 79f676b0e5..42031068b5 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/umem/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/umem/apis.go @@ -139,6 +139,68 @@ func (c *UMemClient) CheckURedisAllowance(req *CheckURedisAllowanceRequest) (*Ch return &res, nil } +// CreateScanHotBigKeysRequest is request schema for CreateScanHotBigKeys action +type CreateScanHotBigKeysRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Zone *string `required:"true"` + + // 资源id + GroupId *string `required:"true"` + + // 是否要重试任务,如果是的话,TaskId必填 + IsRetry *bool `required:"false"` + + // 要重试的任务id + TaskId *string `required:"false"` + + // 任务类型。"ScanBigKeys":扫大key,"ScanHotKeys":扫热key + Type *string `required:"true"` +} + +// CreateScanHotBigKeysResponse is response schema for CreateScanHotBigKeys action +type CreateScanHotBigKeysResponse struct { + response.CommonBase +} + +// NewCreateScanHotBigKeysRequest will create request of CreateScanHotBigKeys action. +func (c *UMemClient) NewCreateScanHotBigKeysRequest() *CreateScanHotBigKeysRequest { + req := &CreateScanHotBigKeysRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +/* +API: CreateScanHotBigKeys + +创建执行扫大key和热key的任务 +*/ +func (c *UMemClient) CreateScanHotBigKeys(req *CreateScanHotBigKeysRequest) (*CreateScanHotBigKeysResponse, error) { + var err error + var res CreateScanHotBigKeysResponse + + reqCopier := *req + + err = c.Client.InvokeAction("CreateScanHotBigKeys", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // CreateUMemBackupRequest is request schema for CreateUMemBackup action type CreateUMemBackupRequest struct { request.CommonBase @@ -217,7 +279,7 @@ type CreateUMemSpaceRequest struct { // Year , Month, Dynamic 默认: Month ChargeType *string `required:"false"` - // 是否是cluster模式(参数为cluster创建redis cluster,其他参数或者不传该参数仍然创建老版本分布式) + // 【待废弃】是否是cluster模式(参数为cluster创建redis cluster,其他参数或者不传该参数仍然创建老版本分布式) ClusterMode *string `required:"false"` // 使用的代金券id @@ -232,10 +294,16 @@ type CreateUMemSpaceRequest struct { // URedis密码。请遵照[[api:uhost-api:specification|字段规范]]设定密码。密码需使用base64进行编码,举例如下:# echo -n Password1 | base64UGFzc3dvcmQx。 Password *string `required:"false"` + // 分片端口, 默认为 6379 + Port *int `required:"false"` + // 协议:memcache, redis (默认redis).注意:redis无single类型 Protocol *string `required:"false"` - // 分布式代理CPU核数 + // 代理端口, 默认为 6379 + ProxyPort *int `required:"false"` + + // 分布式代理CPU核数,不填或者传0时默认不创建代理 ProxySize *int `required:"false"` // 购买时长 默认: 1 @@ -250,12 +318,15 @@ type CreateUMemSpaceRequest struct { // 子网ID SubnetId *string `required:"false"` - // + // 业务组名称 Tag *string `required:"false"` // 空间类型:single(无热备),double(热备)(默认: double) Type *string `required:"false"` + // 是否创建负载均衡型分布式代理,true时表示创建负载均衡型代理 + UlbMode *bool `required:"false"` + // VPC的ID VPCId *string `required:"false"` @@ -465,6 +536,9 @@ type CreateURedisGroupRequest struct { // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"true"` + // 回档的AOF文件ID + AOFID *string `required:"false"` + // 是否自动备份,enable或disable,默认disable AutoBackup *string `required:"false"` @@ -501,9 +575,18 @@ type CreateURedisGroupRequest struct { // 初始化密码,需要 base64 编码 Password *string `required:"false"` + // 端口 + Port *int `required:"false"` + // 购买时长,默认为1 Quantity *int `required:"false"` + // 如果是通过回档创建实例,需要传回档实例的GroupId + RollbackGroupId *string `required:"false"` + + // 回档时间点 + RollbackTime *int `required:"false"` + // 每个节点的内存大小,单位GB,默认1GB,目前仅支持1/2/4/8/16/32,六种 Size *int `required:"false"` @@ -1134,6 +1217,9 @@ type DescribeUMemPriceRequest struct { // 空间类型:single(无热备),double(热备)(默认: double) Type *string `required:"true"` + + // umem分布式代理类型,默认false,true为负载均衡型代理 + UlbMode *string `required:"false"` } // DescribeUMemPriceResponse is response schema for DescribeUMemPrice action @@ -1256,6 +1342,24 @@ type DescribeUMemUpgradePriceRequest struct { // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"false"` + // 进行容量调整分片的分片ID(性能增强型不需要传入) + BlockIds []string `required:"false"` + + // 进行容量调整的分片的目标容量,单位 GB(性能增强型不需要传入) + BlockSize []int `required:"false"` + + // 是否为性能增强型。默认为false,或者不填,true为性能增强型。 + HighPerformance *string `required:"false"` + + // 如果是拆分按钮查询价格就填 true, 否则就填 false,默认为 false + IsSplit *string `required:"false"` + + // 代理升级后CPU核数 + NewCPU *int `required:"false"` + + // 代理id + ProxyId *string `required:"false"` + // 购买UMem大小,单位:GB Size *int `required:"true"` @@ -1445,6 +1549,15 @@ func (c *UMemClient) DescribeUMemcachePrice(req *DescribeUMemcachePriceRequest) type DescribeUMemcacheUpgradePriceRequest struct { request.CommonBase + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Zone *string `required:"false"` + // 需要升级的空间的GroupId,请参考DescribeUMemcacheGroup接口 GroupId *string `required:"true"` @@ -1456,8 +1569,14 @@ type DescribeUMemcacheUpgradePriceRequest struct { type DescribeUMemcacheUpgradePriceResponse struct { response.CommonBase - // 价格,单位:元 - Price float64 + // 列表价格 + ListPrice int + + // 原价 + OriginalPrice int + + // 价格 + Price int } // NewDescribeUMemcacheUpgradePriceRequest will create request of DescribeUMemcacheUpgradePrice action. @@ -1897,15 +2016,21 @@ func (c *UMemClient) DescribeURedisSlowlog(req *DescribeURedisSlowlogRequest) (* type DescribeURedisUpgradePriceRequest struct { request.CommonBase - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"false"` // 要升级的空间的GroupId,请参考DescribeURedisGroup接口 GroupId *string `required:"true"` + // 查询高性能Redis, 默认为false, 或者不填, 查询高性能为true + HighPerformance *bool `required:"false"` + // 购买uredis大小,单位:GB,范围是[1-32] Size *int `required:"true"` @@ -1917,7 +2042,10 @@ type DescribeURedisUpgradePriceRequest struct { type DescribeURedisUpgradePriceResponse struct { response.CommonBase - // 扩容差价,单位: 元,保留小数点后两位有效数字 + // 原价 + OriginalPrice int + + // 价格 Price float64 } @@ -2595,16 +2723,16 @@ func (c *UMemClient) ResizeUMemSpace(req *ResizeUMemSpaceRequest) (*ResizeUMemSp type ResizeURedisGroupRequest struct { request.CommonBase - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) // ProjectId *string `required:"false"` - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) - // Zone *string `required:"false"` + // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Zone *string `required:"true"` - // + // 计费类型 ChargeType *string `required:"false"` // 代金券ID 请参考DescribeCoupon接口 @@ -2613,9 +2741,15 @@ type ResizeURedisGroupRequest struct { // 组ID GroupId *string `required:"true"` + // 高性能Redis, 默认为false, 或者不填, 高性能为true + HighPerformance *bool `required:"false"` + // 内存大小, 单位:GB (需要大于原size,且小于等于32) 目前仅支持1/2/4/8/16/32 G 六种容量规格 Size *int `required:"true"` + // 任务执行时间戳,默认为0或者不传时,为立即执行,传入时间需满足未来一天范围 + StartTime *int `required:"false"` + // 空间类型:single(无热备),double(热备)(默认: double) Type *string `required:"false"` } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/apis.go index ba6c516e22..ed5f326830 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/apis.go @@ -122,6 +122,9 @@ type AllocateShareBandwidthRequest struct { // 【该字段已废弃,请谨慎使用】 ShareBandwidthGuarantee *int `required:"false" deprecated:"true"` + + // 业务组名称, 默认为 "Default" + Tag *string `required:"false"` } // AllocateShareBandwidthResponse is response schema for AllocateShareBandwidth action @@ -356,7 +359,7 @@ type CreateFirewallRequest struct { // 防火墙描述,默认为空 Remark *string `required:"false"` - // 防火墙规则,例如:TCP|22|192.168.1.1/22|DROP|LOW|禁用22端口,第一个参数代表协议:第二个参数代表端口号,第三个参数为ip,第四个参数为ACCEPT(接受)和DROP(拒绝),第五个参数优先级:HIGH(高),MEDIUM(中),LOW(低),第六个参数为该条规则的自定义备注,bj1不支持添加备注 + // 防火墙规则,例如:TCP|22|192.168.1.1/22|DROP|LOW|禁用22端口,第一个参数代表协议:第二个参数代表端口号,第三个参数为ip,第四个参数为ACCEPT(接受)和DROP(拒绝),第五个参数优先级:HIGH(高),MEDIUM(中),LOW(低),第六个参数为该条规则的自定义备注,备注最大长度64 Rule []string `required:"true"` // 防火墙业务组,默认为Default @@ -565,15 +568,21 @@ func (c *UNetClient) DescribeBandwidthPackage(req *DescribeBandwidthPackageReque type DescribeBandwidthUsageRequest struct { request.CommonBase - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) // ProjectId *string `required:"false"` - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` + // 统计开始时间 + BeginTime *int `required:"false"` + // 弹性IP的资源Id. 如果为空, 则返回当前 Region中符合条件的所有EIP的带宽用量, n为自然数 EIPIds []string `required:"false"` + // 统计结束时间 + EndTime *int `required:"false"` + // 返回数据分页值, 取值范围为 [0,10000000] 之间的整数, 默认为20 Limit *int `required:"false"` @@ -824,6 +833,74 @@ func (c *UNetClient) DescribeFirewallResource(req *DescribeFirewallResourceReque return &res, nil } +// DescribePrivateIPRequest is request schema for DescribePrivateIP action +type DescribePrivateIPRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 获取信息数量 ,默认20;不允许为0 + Limit *int `required:"false"` + + // 虚拟网卡的资源ID; ObjectId为空时,则获取项目下所有的虚拟网卡主辅IP信息 + ObjectId *string `required:"false"` + + // 列表起始位置偏移量,默认为0 + Offset *int `required:"false"` + + // 子网的ID + SubnetId *string `required:"false"` + + // VPC的ID + VPCId *string `required:"false"` +} + +// DescribePrivateIPResponse is response schema for DescribePrivateIP action +type DescribePrivateIPResponse struct { + response.CommonBase + + // 辅助IP的详细信息 + DataSet []DescribeSecondaryIPDataSet + + // 返回资源数量 + TotalCount int +} + +// NewDescribePrivateIPRequest will create request of DescribePrivateIP action. +func (c *UNetClient) NewDescribePrivateIPRequest() *DescribePrivateIPRequest { + req := &DescribePrivateIPRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: DescribePrivateIP + +获取资源绑定的内网IP信息 +*/ +func (c *UNetClient) DescribePrivateIP(req *DescribePrivateIPRequest) (*DescribePrivateIPResponse, error) { + var err error + var res DescribePrivateIPResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribePrivateIP", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // DescribeShareBandwidthRequest is request schema for DescribeShareBandwidth action type DescribeShareBandwidthRequest struct { request.CommonBase @@ -1904,16 +1981,16 @@ func (c *UNetClient) UpdateEIPAttribute(req *UpdateEIPAttributeRequest) (*Update type UpdateFirewallRequest struct { request.CommonBase - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) // ProjectId *string `required:"false"` - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` // 防火墙资源ID FWId *string `required:"true"` - // 防火墙规则,例如:TCP|22|192.168.1.1/22|DROP|LOW|禁用22端口,第一个参数代表协议:第二个参数代表端口号,第三个参数为ip,第四个参数为ACCEPT(接受)和DROP(拒绝),第五个参数优先级:HIGH(高),MEDIUM(中),LOW(低),第六个参数为该条规则的自定义备注 + // 防火墙规则,例如:TCP|22|192.168.1.1/22|DROP|LOW|禁用22端口,第一个参数代表协议:第二个参数代表端口号,第三个参数为ip,第四个参数为ACCEPT(接受)和DROP(拒绝),第五个参数优先级:HIGH(高),MEDIUM(中),LOW(低),第六个参数为该条规则的自定义备注, 备注最大长度64 Rule []string `required:"true"` } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/models.go index b1d7f1187f..3dc3a9e447 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/models.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/models.go @@ -290,6 +290,36 @@ type ResourceSet struct { Zone int } +/* +DescribeSecondaryIPDataSet - 描述内网IP的具体信息 +*/ +type DescribeSecondaryIPDataSet struct { + + // 外网IP + EIP string + + // EIP资源ID + EIPId string + + // 内网IP + PrivateIP string + + // 内网IP类型;枚举值:PrimaryIP:主内网IP,SecondaryIP:辅助内网IP + PrivateIPType string + + // 资源ID + ResourceID string + + // 资源名称 + ResourceName string + + // 子网ID + SubnetID string + + // VPCID + VPCID string +} + /* EIPSetData - describeShareBandwidth */ diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go index 8785758688..a843c9299c 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go @@ -1,3 +1,3 @@ package version -const Version = "0.22.17" +const Version = "0.22.25" diff --git a/vendor/modules.txt b/vendor/modules.txt index 795fd0f53f..8c717cc1e8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -37,7 +37,7 @@ github.com/spf13/cobra/doc # github.com/spf13/pflag v1.0.3 => github.com/lixiaojun629/pflag v1.0.5 ## explicit; go 1.12 github.com/spf13/pflag -# github.com/ucloud/ucloud-sdk-go v0.22.17 +# github.com/ucloud/ucloud-sdk-go v0.22.25 ## explicit; go 1.13 github.com/ucloud/ucloud-sdk-go/private/protocol/http github.com/ucloud/ucloud-sdk-go/private/services/pathx