From 211c2ebec21e4aa51a3c64a667058c05dccd3cda Mon Sep 17 00:00:00 2001 From: "renzheng.wang" Date: Wed, 8 May 2024 00:29:57 +0800 Subject: [PATCH] support repeating generic api call --- base/client.go | 7 + base/util.go | 20 +- cmd/api.go | 166 +++- cmd/disk.go | 15 +- cmd/mysql.go | 14 +- cmd/uhost.go | 11 +- cmd/ulhost.go | 26 + cmd/umem.go | 14 +- go.mod | 18 +- go.sum | 6 +- ux/document.go | 15 + vendor/github.com/fatih/color/go.mod | 8 - vendor/github.com/fatih/color/go.sum | 9 - .../go-windows-terminal-sequences/go.mod | 1 - vendor/github.com/mattn/go-colorable/go.mod | 8 - vendor/github.com/mattn/go-colorable/go.sum | 5 - vendor/github.com/mattn/go-isatty/go.mod | 5 - vendor/github.com/mattn/go-isatty/go.sum | 2 - vendor/github.com/russross/blackfriday/go.mod | 1 - vendor/github.com/sirupsen/logrus/go.mod | 11 - vendor/github.com/sirupsen/logrus/go.sum | 15 - vendor/github.com/spf13/cobra/go.mod | 18 - vendor/github.com/spf13/cobra/go.sum | 60 -- vendor/github.com/spf13/pflag/go.mod | 5 - vendor/github.com/spf13/pflag/go.sum | 2 - .../ucloud-sdk-go/services/ucompshare/apis.go | 781 ++++++++++++++++++ .../services/ucompshare/client.go | 22 + .../ucloud-sdk-go/services/ucompshare/doc.go | 13 + .../services/ucompshare/models.go | 165 ++++ .../ucloud/ucloud-sdk-go/services/udb/apis.go | 218 ++++- .../ucloud-sdk-go/services/udb/models.go | 58 +- .../ucloud-sdk-go/services/uhost/apis.go | 58 +- .../ucloud-sdk-go/services/uhost/models.go | 146 ++-- .../ucloud/ucloud-sdk-go/services/ulb/apis.go | 362 +++++++- .../ucloud-sdk-go/services/ulb/models.go | 449 ++++++++-- .../ucloud-sdk-go/ucloud/version/version.go | 2 +- vendor/gopkg.in/yaml.v2/go.mod | 5 - vendor/modules.txt | 23 +- 38 files changed, 2401 insertions(+), 363 deletions(-) create mode 100644 cmd/ulhost.go delete mode 100644 vendor/github.com/fatih/color/go.mod delete mode 100644 vendor/github.com/fatih/color/go.sum delete mode 100644 vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod delete mode 100644 vendor/github.com/mattn/go-colorable/go.mod delete mode 100644 vendor/github.com/mattn/go-colorable/go.sum delete mode 100644 vendor/github.com/mattn/go-isatty/go.mod delete mode 100644 vendor/github.com/mattn/go-isatty/go.sum delete mode 100644 vendor/github.com/russross/blackfriday/go.mod delete mode 100644 vendor/github.com/sirupsen/logrus/go.mod delete mode 100644 vendor/github.com/sirupsen/logrus/go.sum delete mode 100644 vendor/github.com/spf13/cobra/go.mod delete mode 100644 vendor/github.com/spf13/cobra/go.sum delete mode 100644 vendor/github.com/spf13/pflag/go.mod delete mode 100644 vendor/github.com/spf13/pflag/go.sum create mode 100644 vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/apis.go create mode 100644 vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/client.go create mode 100644 vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/doc.go create mode 100644 vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/models.go delete mode 100644 vendor/gopkg.in/yaml.v2/go.mod diff --git a/base/client.go b/base/client.go index 307e857790..d6d0745931 100644 --- a/base/client.go +++ b/base/client.go @@ -8,6 +8,7 @@ import ( pumem "github.com/ucloud/ucloud-sdk-go/private/services/umem" "github.com/ucloud/ucloud-sdk-go/services/pathx" "github.com/ucloud/ucloud-sdk-go/services/uaccount" + "github.com/ucloud/ucloud-sdk-go/services/ucompshare" "github.com/ucloud/ucloud-sdk-go/services/udb" "github.com/ucloud/ucloud-sdk-go/services/udisk" "github.com/ucloud/ucloud-sdk-go/services/udpn" @@ -51,6 +52,7 @@ type Client struct { PrivateUDBClient PrivateUMemClient PrivateUMemClient PrivatePathxClient + ucompshare.UCompShareClient } // NewClient will return a aggregate client @@ -90,6 +92,7 @@ func NewClient(config *sdk.Config, credConfig *CredentialConfig) *Client { pudbClient = *pudb.NewClient(config, credential) pumemClient = *pumem.NewClient(config, credential) ppathxClient = *ppathx.NewClient(config, credential) + ulhostClient = *ucompshare.NewClient(config, credential) ) uaccountClient.Client.AddRequestHandler(handler) @@ -137,6 +140,9 @@ func NewClient(config *sdk.Config, credConfig *CredentialConfig) *Client { ppathxClient.Client.AddRequestHandler(handler) ppathxClient.Client.AddHttpRequestHandler(injectCredHeader) + ulhostClient.Client.AddRequestHandler(handler) + ulhostClient.Client.AddHttpRequestHandler(injectCredHeader) + return &Client{ uaccountClient, uhostClient, @@ -153,5 +159,6 @@ func NewClient(config *sdk.Config, credConfig *CredentialConfig) *Client { pudbClient, pumemClient, ppathxClient, + ulhostClient, } } diff --git a/base/util.go b/base/util.go index d9033d8119..a49f75878b 100644 --- a/base/util.go +++ b/base/util.go @@ -19,6 +19,7 @@ import ( uerr "github.com/ucloud/ucloud-sdk-go/ucloud/error" "github.com/ucloud/ucloud-sdk-go/ucloud/helpers/waiter" "github.com/ucloud/ucloud-sdk-go/ucloud/log" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" "github.com/ucloud/ucloud-sdk-go/ucloud/response" "github.com/ucloud/ucloud-cli/model" @@ -335,11 +336,12 @@ var RegionLabel = map[string]string{ // Poller 轮询器 type Poller struct { - stateFields []string - DescribeFunc func(string, string, string, string) (interface{}, error) - Out io.Writer - Timeout time.Duration - SdescribeFunc func(string) (interface{}, error) + stateFields []string + DescribeFunc func(string, string, string, string) (interface{}, error) + Out io.Writer + Timeout time.Duration + SdescribeFunc func(string, *request.CommonBase) (interface{}, error) + SdescribeWithCommonConfigFunc func(string) (interface{}, error) } type pollResult struct { @@ -349,12 +351,12 @@ type pollResult struct { } // Sspoll 简化版, 支持并发 -func (p *Poller) Sspoll(resourceID, pollText string, targetStates []string, block *ux.Block) *pollResult { +func (p *Poller) Sspoll(resourceID, pollText string, targetStates []string, block *ux.Block, commonBase *request.CommonBase) *pollResult { w := waiter.StateWaiter{ Pending: []string{"pending"}, Target: []string{"avaliable"}, Refresh: func() (interface{}, string, error) { - inst, err := p.SdescribeFunc(resourceID) + inst, err := p.SdescribeFunc(resourceID, commonBase) if err != nil { return nil, "", err } @@ -423,7 +425,7 @@ func (p *Poller) Spoll(resourceID, pollText string, targetStates []string) { Pending: []string{"pending"}, Target: []string{"avaliable"}, Refresh: func() (interface{}, string, error) { - inst, err := p.SdescribeFunc(resourceID) + inst, err := p.SdescribeFunc(resourceID, nil) if err != nil { return nil, "", err } @@ -543,7 +545,7 @@ func (p *Poller) Poll(resourceID, projectID, region, zone, pollText string, targ } // NewSpoller simple -func NewSpoller(describeFunc func(string) (interface{}, error), out io.Writer) *Poller { +func NewSpoller(describeFunc func(string, *request.CommonBase) (interface{}, error), out io.Writer) *Poller { return &Poller{ SdescribeFunc: describeFunc, Out: out, diff --git a/cmd/api.go b/cmd/api.go index 523cff7522..6386ff51c5 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -6,13 +6,43 @@ import ( "fmt" "io" "io/ioutil" + "slices" + "strconv" "strings" + "sync" + "sync/atomic" + "time" "github.com/spf13/cobra" + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" "github.com/ucloud/ucloud-cli/base" + "github.com/ucloud/ucloud-cli/model/status" + "github.com/ucloud/ucloud-cli/ux" ) +type RepeatsConfig struct { + Poller *base.Poller + IDInResp string +} + +var RepeatsSupportedAPI = map[string]RepeatsConfig{ + "CreateULHostInstance": {Poller: ulhostSpoller, IDInResp: "ULHostId"}, +} + +const ActionField = "Action" +const RepeatsField = "repeats" +const ConcurrentField = "concurrent" +const DefaultConcurrent = 20 +const HelpField = "help" +const HelpInfo = `Usage: ucloud api [options] --Action actionName --param1 value1 --param2 value2 ... +Options: + --local-file string the path of the local file which contains the api parameters + --repeats string the number of repeats + --concurrent string the number of concurrent + --help show help` + // NewCmdAPI ucloud api --xkey xvalue func NewCmdAPI(out io.Writer) *cobra.Command { return &cobra.Command{ @@ -20,6 +50,10 @@ func NewCmdAPI(out io.Writer) *cobra.Command { Short: "Call API", Long: "Call API", Run: func(c *cobra.Command, args []string) { + if slices.Contains(args, "--help") { + fmt.Fprintln(out, HelpInfo) + return + } params, err := parseParamsFromCmdLine(args) if err != nil { fmt.Fprintln(out, err) @@ -37,7 +71,36 @@ func NewCmdAPI(out io.Writer) *cobra.Command { return } } - + if action, actionOK := params[ActionField].(string); actionOK { + if repeatsConfig, repeatsSupported := RepeatsSupportedAPI[action]; repeatsSupported { + if repeats, repeatsOK := params[RepeatsField].(string); repeatsOK { + var repeatsNum int + var concurrentNum int + repeatsNum, err = strconv.Atoi(repeats) + if err != nil { + fmt.Fprintf(out, "error: %v\n", err) + return + } + if concurrent, concurrentOK := params[ConcurrentField].(string); concurrentOK { + concurrentNum, err = strconv.Atoi(concurrent) + if err != nil { + fmt.Fprintf(out, "error: %v\n", err) + return + } + } else { + concurrentNum = DefaultConcurrent + } + delete(params, RepeatsField) + delete(params, ConcurrentField) + err = genericInvokeRepeatWrapper(&repeatsConfig, params, action, repeatsNum, concurrentNum) + if err != nil { + fmt.Fprintf(out, "error: %v\n", err) + return + } + return + } + } + } req := base.BizClient.UAccountClient.NewGenericRequest() err = req.SetPayload(params) if err != nil { @@ -87,3 +150,104 @@ func parseParamsFromCmdLine(args []string) (map[string]interface{}, error) { } return params, nil } + +func genericInvokeRepeatWrapper(repeatsConfig *RepeatsConfig, params map[string]interface{}, action string, repeats int, concurrent int) error { + if repeatsConfig == nil { + return fmt.Errorf("error: repeatsConfig is nil") + } + if repeats <= 0 { + return fmt.Errorf("error: repeats should be a positive integer") + } + if concurrent <= 0 { + return fmt.Errorf("error: concurrent should be a positive integer") + } + wg := &sync.WaitGroup{} + tokens := make(chan struct{}, concurrent) + retCh := make(chan bool, repeats) + + wg.Add(repeats) + //ux.Doc.Disable() + refresh := ux.NewRefresh() + + req := base.BizClient.UAccountClient.NewGenericRequest() + err := req.SetPayload(params) + if err != nil { + return fmt.Errorf("fail to set payload: %w", err) + } + + go func(req request.GenericRequest) { + for i := 0; i < repeats; i++ { + go func(req request.GenericRequest, idx int) { + tokens <- struct{}{} + defer func() { + <-tokens + //设置延时,使报错能渲染出来 + time.Sleep(time.Second / 5) + wg.Done() + }() + success := true + resp, err := base.BizClient.UAccountClient.GenericInvoke(req) + block := ux.NewBlock() + ux.Doc.Append(block) + logs := []string{"=================================================="} + logs = append(logs, fmt.Sprintf("api:%v, request:%v", action, base.ToQueryMap(req))) + if err != nil { + logs = append(logs, fmt.Sprintf("err:%v", err)) + block.Append(base.ParseError(err)) + success = false + } else { + logs = append(logs, fmt.Sprintf("resp:%#v", resp)) + resourceId, ok := resp.GetPayload()[repeatsConfig.IDInResp].(string) + if !ok { + block.Append(fmt.Sprintf("expect %v in response, but not found", repeatsConfig.IDInResp)) + success = false + } else { + text := fmt.Sprintf("the resource[%s] is initializing", resourceId) + result := repeatsConfig.Poller.Sspoll(resourceId, text, []string{status.HOST_RUNNING, status.HOST_FAIL}, block, &request.CommonBase{ + Region: ucloud.String(req.GetRegion()), + Zone: ucloud.String(req.GetZone()), + ProjectId: ucloud.String(req.GetProjectId()), + }) + if result.Err != nil { + success = false + block.Append(result.Err.Error()) + } + } + retCh <- success + logs = append(logs, fmt.Sprintf("index:%d, result:%t", idx, success)) + base.LogInfo(logs...) + } + }(req, i) + } + }(req) + + var success, fail atomic.Int32 + go func() { + block := ux.NewBlock() + ux.Doc.Append(block) + block.Append(fmt.Sprintf("creating, total:%d, success:%d, fail:%d", repeats, success.Load(), fail.Load())) + blockCount := ux.Doc.GetBlockCount() + for ret := range retCh { + if ret { + success.Add(1) + } else { + fail.Add(1) + } + text := fmt.Sprintf("creating, total:%d, success:%d, fail:%d", repeats, success.Load(), fail.Load()) + if blockCount != ux.Doc.GetBlockCount() { + block = ux.NewBlock() + ux.Doc.Append(block) + block.Append(text) + blockCount = ux.Doc.GetBlockCount() + } else { + block.Update(text, 0) + } + if repeats == int(success.Load())+int(fail.Load()) && fail.Load() > 0 { + fmt.Printf("Check logs in %s\n", base.GetLogFilePath()) + } + } + }() + wg.Wait() + refresh.Do(fmt.Sprintf("finally, total:%d, success:%d, fail:%d", repeats, success.Load(), repeats-int(success.Load()))) + return nil +} diff --git a/cmd/disk.go b/cmd/disk.go index 2a68a75f6c..4f901616f3 100644 --- a/cmd/disk.go +++ b/cmd/disk.go @@ -20,6 +20,7 @@ import ( "strings" "github.com/spf13/cobra" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" "github.com/ucloud/ucloud-sdk-go/private/services/uhost" "github.com/ucloud/ucloud-sdk-go/services/udisk" @@ -340,7 +341,7 @@ func NewCmdDiskDetach(out io.Writer) *cobra.Command { } func detachUdisk(async bool, udiskID string, out io.Writer) error { - any, err := describeUdiskByID(udiskID) + any, err := describeUdiskByID(udiskID, nil) if err != nil { return err } @@ -579,7 +580,7 @@ func NewCmdDiskRestore(out io.Writer) *cobra.Command { Run: func(cmd *cobra.Command, args []string) { for _, snapshotID := range *snapshotIDs { snapshotID = base.PickResourceID(snapshotID) - any, err := describeSnapshotByID(snapshotID) + any, err := describeSnapshotByID(snapshotID, nil) if err != nil { base.HandleError(err) continue @@ -739,8 +740,11 @@ func getDiskList(states []string, project, region, zone string) []string { return list } -func describeUdiskByID(udiskID string) (interface{}, error) { +func describeUdiskByID(udiskID string, commonBase *request.CommonBase) (interface{}, error) { req := base.BizClient.NewDescribeUDiskRequest() + if commonBase != nil { + req.CommonBase = *commonBase + } req.UDiskId = sdk.String(udiskID) req.Limit = sdk.Int(50) resp, err := base.BizClient.DescribeUDisk(req) @@ -774,8 +778,11 @@ func getSnapshotList(states []string, project, region, zone string) []string { return list } -func describeSnapshotByID(snapshotID string) (interface{}, error) { +func describeSnapshotByID(snapshotID string, commonBase *request.CommonBase) (interface{}, error) { req := base.BizClient.NewDescribeSnapshotRequest() + if commonBase != nil { + req.CommonBase = *commonBase + } req.SnapshotIds = append(req.SnapshotIds, snapshotID) req.Limit = sdk.Int(50) resp, err := base.BizClient.DescribeSnapshot(req) diff --git a/cmd/mysql.go b/cmd/mysql.go index 7dff0a8707..e6de66a868 100644 --- a/cmd/mysql.go +++ b/cmd/mysql.go @@ -22,6 +22,7 @@ import ( "time" "github.com/spf13/cobra" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" "github.com/ucloud/ucloud-sdk-go/services/udb" sdk "github.com/ucloud/ucloud-sdk-go/ucloud" @@ -283,7 +284,7 @@ func NewCmdUDBDelete(out io.Writer) *cobra.Command { } for _, idname := range idNames { id := base.PickResourceID(idname) - any, err := describeUdbByID(id) + any, err := describeUdbByID(id, nil) if err != nil { base.HandleError(err) continue @@ -484,7 +485,7 @@ func NewCmdUDBResize(out io.Writer) *cobra.Command { for _, idname := range idNames { id := base.PickResourceID(idname) req.DBId = &id - any, err := describeUdbByID(id) + any, err := describeUdbByID(id, nil) if err != nil { base.HandleError(err) continue @@ -616,7 +617,7 @@ func NewCmdUDBRestore(out io.Writer) *cobra.Command { req.RecoveryTime = sdk.Int(int(t.Unix())) req.SrcDBId = sdk.String(base.PickResourceID(*req.SrcDBId)) if diskType == "" { - any, err := describeUdbByID(*req.SrcDBId) + any, err := describeUdbByID(*req.SrcDBId, nil) if err != nil { base.HandleError(err) return @@ -777,7 +778,7 @@ func NewCmdUDBPromoteToHA(out io.Writer) *cobra.Command { continue } poller.Spoll(id, fmt.Sprintf("udb[%s] is synchronizing data", id), []string{status.UDB_TOBE_SWITCH, status.UDB_FAIL}) - any, err := describeUdbByID(id) + any, err := describeUdbByID(id, nil) if err != nil { fmt.Fprintf(out, "udb[%s] promoted failed, please contact technical support; %v\n", idname, err) continue @@ -882,8 +883,11 @@ func getUDBList(states []string, dbType, project, region, zone string) ([]udb.UD return list, nil } -func describeUdbByID(udbID string) (interface{}, error) { +func describeUdbByID(udbID string, commonBase *request.CommonBase) (interface{}, error) { req := base.BizClient.NewDescribeUDBInstanceRequest() + if commonBase != nil { + req.CommonBase = *commonBase + } req.DBId = sdk.String(udbID) resp, err := base.BizClient.DescribeUDBInstance(req) if err != nil { diff --git a/cmd/uhost.go b/cmd/uhost.go index 42f5935875..8cde298cfc 100644 --- a/cmd/uhost.go +++ b/cmd/uhost.go @@ -579,7 +579,7 @@ func createUhost(req *uhost.CreateUHostInstanceRequest, updateEIPReq *unet.Updat if async { block.Append(text) } else { - uhostSpoller.Sspoll(resp.UHostIds[0], text, []string{status.HOST_RUNNING, status.HOST_FAIL}, block) + uhostSpoller.Sspoll(resp.UHostIds[0], text, []string{status.HOST_RUNNING, status.HOST_FAIL}, block, &req.CommonBase) } if bindEipID != "" { @@ -720,7 +720,7 @@ func deleteUHost(creq request.Common) (bool, []string) { block := ux.NewBlock() ux.Doc.Append(block) logs := []string{} - hostIns, err := sdescribeUHostByID(*req.UHostId) + hostIns, err := sdescribeUHostByID(*req.UHostId, nil) if err != nil { logs = append(logs, fmt.Sprintf("describe uhost[%s] failed: %s", *req.UHostId, base.ParseError(err))) return false, logs @@ -828,7 +828,7 @@ func stopUhostInsV2(req *uhost.StopUHostInstanceRequest, async bool, block *ux.B if async { block.Append(text) } else { - uhostSpoller.Sspoll(resp.UHostId, text, []string{status.HOST_STOPPED, status.HOST_FAIL}, block) + uhostSpoller.Sspoll(resp.UHostId, text, []string{status.HOST_STOPPED, status.HOST_FAIL}, block, nil) } } @@ -1163,8 +1163,11 @@ func describeUHostByID(uhostID, projectID, region, zone string) (interface{}, er return &resp.UHostSet[0], nil } -func sdescribeUHostByID(uhostID string) (interface{}, error) { +func sdescribeUHostByID(uhostID string, commonBase *request.CommonBase) (interface{}, error) { req := base.BizClient.NewDescribeUHostInstanceRequest() + if commonBase != nil { + req.CommonBase = *commonBase + } req.UHostIds = []string{uhostID} resp, err := base.BizClient.DescribeUHostInstance(req) diff --git a/cmd/ulhost.go b/cmd/ulhost.go new file mode 100644 index 0000000000..9344e944d5 --- /dev/null +++ b/cmd/ulhost.go @@ -0,0 +1,26 @@ +package cmd + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + + "github.com/ucloud/ucloud-cli/base" +) + +var ulhostSpoller = base.NewSpoller(sdescribeULHostByID, base.Cxt.GetWriter()) + +func sdescribeULHostByID(ulhostID string, common *request.CommonBase) (interface{}, error) { + req := base.BizClient.UCompShareClient.NewDescribeULHostInstanceRequest() + req.ULHostIds = []string{ulhostID} + if common != nil { + req.CommonBase = *common + } + resp, err := base.BizClient.UCompShareClient.DescribeULHostInstance(req) + if err != nil { + return nil, err + } + if len(resp.ULHostInstanceSets) < 1 { + return nil, nil + } + + return &resp.ULHostInstanceSets[0], nil +} diff --git a/cmd/umem.go b/cmd/umem.go index 54054cdacd..3964e9af8a 100644 --- a/cmd/umem.go +++ b/cmd/umem.go @@ -339,7 +339,7 @@ func restartRedis(creq request.Common) (bool, []string) { } poller := base.NewSpoller(describeRedisByID, base.Cxt.GetWriter()) text := fmt.Sprintf("redis[%s] is restarting", *req.GroupId) - ret := poller.Sspoll(*req.GroupId, text, []string{status.UMEM_RUNNING, status.UMEM_FAIL}, block) + ret := poller.Sspoll(*req.GroupId, text, []string{status.UMEM_RUNNING, status.UMEM_FAIL}, block, nil) if ret.Err != nil { block.Append(base.ParseError(err)) logs = append(logs, ret.Err.Error()) @@ -568,7 +568,7 @@ func restartMemcache(creq request.Common) (bool, []string) { } poller := base.NewSpoller(describeMemcacheByID, base.Cxt.GetWriter()) text := fmt.Sprintf("memcache[%s] is restarting", *req.GroupId) - ret := poller.Sspoll(*req.GroupId, text, []string{status.UMEM_RUNNING, status.UMEM_FAIL}, block) + ret := poller.Sspoll(*req.GroupId, text, []string{status.UMEM_RUNNING, status.UMEM_FAIL}, block, nil) if ret.Err != nil { block.Append(base.ParseError(err)) logs = append(logs, ret.Err.Error()) @@ -579,8 +579,11 @@ func restartMemcache(creq request.Common) (bool, []string) { return ret.Done, logs } -func describeMemcacheByID(memcacheID string) (interface{}, error) { +func describeMemcacheByID(memcacheID string, commonBase *request.CommonBase) (interface{}, error) { req := base.BizClient.NewDescribeUMemRequest() + if commonBase != nil { + req.CommonBase = *commonBase + } req.Protocol = sdk.String("memcache") req.ResourceId = &memcacheID @@ -593,8 +596,11 @@ func describeMemcacheByID(memcacheID string) (interface{}, error) { } return &resp.DataSet[0], nil } -func describeRedisByID(redisID string) (interface{}, error) { +func describeRedisByID(redisID string, commonBase *request.CommonBase) (interface{}, error) { req := base.BizClient.NewDescribeUMemRequest() + if commonBase != nil { + req.CommonBase = *commonBase + } req.Protocol = sdk.String("redis") req.ResourceId = &redisID diff --git a/go.mod b/go.mod index 5eac9d8650..e08e13f1dc 100644 --- a/go.mod +++ b/go.mod @@ -1,17 +1,29 @@ module github.com/ucloud/ucloud-cli -go 1.12 +go 1.21 require ( github.com/fatih/color v1.13.0 - github.com/kr/pretty v0.1.0 // indirect github.com/satori/go.uuid v1.2.0 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.10 + github.com/ucloud/ucloud-sdk-go v0.22.17 golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 +) + +require ( + github.com/cpuguy83/go-md2man v1.0.10 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect + github.com/kr/pretty v0.1.0 // indirect + github.com/mattn/go-colorable v0.1.9 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/pkg/errors v0.8.0 // indirect + github.com/russross/blackfriday v1.5.2 // indirect + golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 // indirect gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect + gopkg.in/yaml.v2 v2.2.2 // indirect ) replace ( diff --git a/go.sum b/go.sum index 78cd33ffd8..7ba140b464 100644 --- a/go.sum +++ b/go.sum @@ -49,10 +49,8 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/ucloud/ucloud-sdk-go v0.21.42 h1:WGFpTRrnAL6yEZVJsZxNH5kSMNQNCYBsB8pq159QRG4= -github.com/ucloud/ucloud-sdk-go v0.21.42/go.mod h1:dyLmFHmUfgb4RZKYQP9IArlvQ2pxzFthfhwxRzOEPIw= -github.com/ucloud/ucloud-sdk-go v0.22.10 h1:jelK2qhOY7XDjUywdMbfBhNATIW8RIbsqgEfBFm3RNk= -github.com/ucloud/ucloud-sdk-go v0.22.10/go.mod h1:dyLmFHmUfgb4RZKYQP9IArlvQ2pxzFthfhwxRzOEPIw= +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/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/ux/document.go b/ux/document.go index 3d1a659989..fcb59301ed 100644 --- a/ux/document.go +++ b/ux/document.go @@ -89,6 +89,21 @@ func (d *document) Append(b *Block) { d.blocks = append(d.blocks, b) } +func (d *document) GetLastBlock() *Block { + d.mux.Lock() + defer d.mux.Unlock() + if len(d.blocks) == 0 { + return nil + } + return d.blocks[len(d.blocks)-1] +} + +func (d *document) GetBlockCount() int { + d.mux.Lock() + defer d.mux.Unlock() + return len(d.blocks) +} + func newDocument(out io.Writer) *document { doc := &document{ out: out, diff --git a/vendor/github.com/fatih/color/go.mod b/vendor/github.com/fatih/color/go.mod deleted file mode 100644 index c9b3cd59a2..0000000000 --- a/vendor/github.com/fatih/color/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/fatih/color - -go 1.13 - -require ( - github.com/mattn/go-colorable v0.1.9 - github.com/mattn/go-isatty v0.0.14 -) diff --git a/vendor/github.com/fatih/color/go.sum b/vendor/github.com/fatih/color/go.sum deleted file mode 100644 index cbbcfb6446..0000000000 --- a/vendor/github.com/fatih/color/go.sum +++ /dev/null @@ -1,9 +0,0 @@ -github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod b/vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod deleted file mode 100644 index 716c613125..0000000000 --- a/vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/konsorten/go-windows-terminal-sequences diff --git a/vendor/github.com/mattn/go-colorable/go.mod b/vendor/github.com/mattn/go-colorable/go.mod deleted file mode 100644 index 1e590b8199..0000000000 --- a/vendor/github.com/mattn/go-colorable/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/mattn/go-colorable - -require ( - github.com/mattn/go-isatty v0.0.12 - golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae // indirect -) - -go 1.13 diff --git a/vendor/github.com/mattn/go-colorable/go.sum b/vendor/github.com/mattn/go-colorable/go.sum deleted file mode 100644 index cf5b95d97c..0000000000 --- a/vendor/github.com/mattn/go-colorable/go.sum +++ /dev/null @@ -1,5 +0,0 @@ -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/mattn/go-isatty/go.mod b/vendor/github.com/mattn/go-isatty/go.mod deleted file mode 100644 index c9a20b7f3f..0000000000 --- a/vendor/github.com/mattn/go-isatty/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/mattn/go-isatty - -go 1.12 - -require golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c diff --git a/vendor/github.com/mattn/go-isatty/go.sum b/vendor/github.com/mattn/go-isatty/go.sum deleted file mode 100644 index 912e29cbc1..0000000000 --- a/vendor/github.com/mattn/go-isatty/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/russross/blackfriday/go.mod b/vendor/github.com/russross/blackfriday/go.mod deleted file mode 100644 index b05561a066..0000000000 --- a/vendor/github.com/russross/blackfriday/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/russross/blackfriday diff --git a/vendor/github.com/sirupsen/logrus/go.mod b/vendor/github.com/sirupsen/logrus/go.mod deleted file mode 100644 index 94574cc635..0000000000 --- a/vendor/github.com/sirupsen/logrus/go.mod +++ /dev/null @@ -1,11 +0,0 @@ -module github.com/sirupsen/logrus - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/konsorten/go-windows-terminal-sequences v1.0.1 - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/objx v0.1.1 // indirect - github.com/stretchr/testify v1.2.2 - golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 - golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 -) diff --git a/vendor/github.com/sirupsen/logrus/go.sum b/vendor/github.com/sirupsen/logrus/go.sum deleted file mode 100644 index 133d34ae11..0000000000 --- a/vendor/github.com/sirupsen/logrus/go.sum +++ /dev/null @@ -1,15 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe h1:CHRGQ8V7OlCYtwaKPJi3iA7J+YdNKdo8j7nG5IgDhjs= -github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/spf13/cobra/go.mod b/vendor/github.com/spf13/cobra/go.mod deleted file mode 100644 index 79dd78d290..0000000000 --- a/vendor/github.com/spf13/cobra/go.mod +++ /dev/null @@ -1,18 +0,0 @@ -module github.com/lixiaojun629/cobra - -go 1.12 - -require ( - github.com/cpuguy83/go-md2man v1.0.10 - github.com/inconshreveable/mousetrap v1.0.0 - github.com/mitchellh/go-homedir v1.1.0 - github.com/spf13/cobra v0.0.3 - github.com/spf13/pflag v1.0.3 - github.com/spf13/viper v1.3.2 - gopkg.in/yaml.v2 v2.2.2 -) - -replace ( - github.com/spf13/cobra v0.0.3 => github.com/lixiaojun629/cobra v0.0.5 - github.com/spf13/pflag v1.0.3 => github.com/lixiaojun629/pflag v1.0.5 -) diff --git a/vendor/github.com/spf13/cobra/go.sum b/vendor/github.com/spf13/cobra/go.sum deleted file mode 100644 index 181e864d5e..0000000000 --- a/vendor/github.com/spf13/cobra/go.sum +++ /dev/null @@ -1,60 +0,0 @@ -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cpuguy83/go-md2man v1.0.8 h1:DwoNytLphI8hzS2Af4D0dfaEaiSq2bN05mEm4R6vf8M= -github.com/cpuguy83/go-md2man v1.0.8/go.mod h1:N6JayAiVKtlHSnuTCeuLSQVs75hb8q+dYQLjr7cDsKY= -github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/lixiaojun629/cobra v0.0.5 h1:zGL+RRJEFBUrwy3Ehni/1uVe1K7KtbbCEtz1vD5o7zs= -github.com/lixiaojun629/cobra v0.0.5/go.mod h1:/UrNgAugHQZNoelw+TjY7C7OUQZT6O+B5EzpqMiSUkA= -github.com/lixiaojun629/pflag v1.0.5 h1:plFJ2SBJd2S2Fc7ZwwFZ3682IvxBiUkhRuJS40OvEMs= -github.com/lixiaojun629/pflag v1.0.5/go.mod h1:uchrjsiFxJj1XOBpO4YJCZwpqXHsCHovxY91tyFoUrg= -github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday v2.0.0+incompatible h1:cBXrhZNUf9C+La9/YpS+UHpUT8YD6Td9ZMSU9APFcsk= -github.com/russross/blackfriday v2.0.0+incompatible/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/viper v1.3.1 h1:5+8j8FTpnFV4nEImW/ofkzEt8VoOiLXxdYIDsB73T38= -github.com/spf13/viper v1.3.1/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -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-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a h1:1n5lsVfiQW3yfsRGu98756EH1YthsFqr/5mxHduZW2A= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/spf13/pflag/go.mod b/vendor/github.com/spf13/pflag/go.mod deleted file mode 100644 index 460309f8a2..0000000000 --- a/vendor/github.com/spf13/pflag/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/lixiaojun629/pflag - -go 1.12 - -require github.com/spf13/pflag v1.0.3 diff --git a/vendor/github.com/spf13/pflag/go.sum b/vendor/github.com/spf13/pflag/go.sum deleted file mode 100644 index edd0bcf708..0000000000 --- a/vendor/github.com/spf13/pflag/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/apis.go new file mode 100644 index 0000000000..ab853ff8c5 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/apis.go @@ -0,0 +1,781 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ucompshare + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UCompShare API Schema + +// CreateULHostInstanceRequest is request schema for CreateULHostInstance action +type CreateULHostInstanceRequest 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"` + + // 套餐ID。如:"ulh.c1m1s40b30t800" + BundleId *string `required:"true"` + + // 计费模式。枚举值: \\ > Year,按年付费; \\ > Month,按月付费;默认:Month + ChargeType *string `required:"false"` + + // 主机代金券ID。请通过DescribeCoupon接口查询,或登录用户中心查看 + CouponId *string `required:"false"` + + // 镜像ID。 请通过 [DescribeImage](describe_image.html)获取 + ImageId *string `required:"true"` + + // 轻量应用主机名称。默认:套餐ID。请遵照[[api:uhost-api:specification|字段规范]]设定实例名称。 + Name *string `required:"false"` + + // ULHost密码。请遵照[[api:uhost-api:specification|字段规范]]设定密码。密码需使用base64进行编码,举例如下:# echo -n Password1 | base64 + Password *string `required:"true"` + + // 购买时长。默认:1。不支持购买到月末 + Quantity *int `required:"false"` + + // 防火墙ID,默认:Web推荐防火墙。如何查询SecurityGroupId请参见 [DescribeFirewall](api/unet-api/describe_firewall.html)。 + SecurityGroupId *string `required:"false"` + + // 子网 ID。默认为当前地域的默认子网。 + SubnetId *string `required:"false"` + + // VPC ID。默认为当前地域的默认VPC。 + VPCId *string `required:"false"` +} + +// CreateULHostInstanceResponse is response schema for CreateULHostInstance action +type CreateULHostInstanceResponse struct { + response.CommonBase + + // 错误信息 + Message string + + // 实例ID + ULHostId string +} + +// NewCreateULHostInstanceRequest will create request of CreateULHostInstance action. +func (c *UCompShareClient) NewCreateULHostInstanceRequest() *CreateULHostInstanceRequest { + req := &CreateULHostInstanceRequest{} + + // 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: CreateULHostInstance + +创建轻量应用云主机 +*/ +func (c *UCompShareClient) CreateULHostInstance(req *CreateULHostInstanceRequest) (*CreateULHostInstanceResponse, error) { + var err error + var res CreateULHostInstanceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("CreateULHostInstance", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// DescribeULHostBundlesRequest is request schema for DescribeULHostBundles action +type DescribeULHostBundlesRequest 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"` + +} + +// DescribeULHostBundlesResponse is response schema for DescribeULHostBundles action +type DescribeULHostBundlesResponse struct { + response.CommonBase + + // 套餐列表 + Bundles []Bundle + + // 错误信息 + Message string +} + +// NewDescribeULHostBundlesRequest will create request of DescribeULHostBundles action. +func (c *UCompShareClient) NewDescribeULHostBundlesRequest() *DescribeULHostBundlesRequest { + req := &DescribeULHostBundlesRequest{} + + // 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: DescribeULHostBundles + +获取轻量应用云主机套餐列表 +*/ +func (c *UCompShareClient) DescribeULHostBundles(req *DescribeULHostBundlesRequest) (*DescribeULHostBundlesResponse, error) { + var err error + var res DescribeULHostBundlesResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeULHostBundles", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// DescribeULHostInstanceRequest is request schema for DescribeULHostInstance action +type DescribeULHostInstanceRequest 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"` + + // 返回数据长度,默认为20,最大100 + Limit *int `required:"false"` + + // 列表起始位置偏移量,默认为0 + Offset *int `required:"false"` + + // 【数组】轻量应用云主机ID。 + ULHostIds []string `required:"false"` +} + +// DescribeULHostInstanceResponse is response schema for DescribeULHostInstance action +type DescribeULHostInstanceResponse struct { + response.CommonBase + + // 错误信息 + Message string + + // 实例列表 + ULHostInstanceSets []ULHostInstanceSet +} + +// NewDescribeULHostInstanceRequest will create request of DescribeULHostInstance action. +func (c *UCompShareClient) NewDescribeULHostInstanceRequest() *DescribeULHostInstanceRequest { + req := &DescribeULHostInstanceRequest{} + + // 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: DescribeULHostInstance + +获取轻量应用云主机列表 +*/ +func (c *UCompShareClient) DescribeULHostInstance(req *DescribeULHostInstanceRequest) (*DescribeULHostInstanceResponse, error) { + var err error + var res DescribeULHostInstanceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeULHostInstance", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// GetULHostInstancePriceRequest is request schema for GetULHostInstancePrice action +type GetULHostInstancePriceRequest 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"` + + // 套餐ID + BundleId *string `required:"true"` + + // 获取指定计费模式的价格。枚举值:\\ > Year,按年付费; \\ > Month。未指定时,返回所有计费模式价格 + ChargeType *string `required:"false"` + + // 购买台数,范围[1,5]。默认:1 + Count *int `required:"false"` + + // 购买时长。默认: 1。不支持购买到月末 + Quantity *int `required:"false"` +} + +// GetULHostInstancePriceResponse is response schema for GetULHostInstancePrice action +type GetULHostInstancePriceResponse struct { + response.CommonBase + + // 错误信息 + Message string + + // + PriceSet []ULHostPriceSet +} + +// NewGetULHostInstancePriceRequest will create request of GetULHostInstancePrice action. +func (c *UCompShareClient) NewGetULHostInstancePriceRequest() *GetULHostInstancePriceRequest { + req := &GetULHostInstancePriceRequest{} + + // 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: GetULHostInstancePrice + +获取轻量应用云主机套餐价格 +*/ +func (c *UCompShareClient) GetULHostInstancePrice(req *GetULHostInstancePriceRequest) (*GetULHostInstancePriceResponse, error) { + var err error + var res GetULHostInstancePriceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("GetULHostInstancePrice", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// GetULHostRenewPriceRequest is request schema for GetULHostRenewPrice action +type GetULHostRenewPriceRequest 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"` + + // 计费类型。支持:Year/Month;默认:Month + ChargeType *string `required:"false"` + + // ULHost实例ID + ULHostId *string `required:"true"` +} + +// GetULHostRenewPriceResponse is response schema for GetULHostRenewPrice action +type GetULHostRenewPriceResponse struct { + response.CommonBase + + // + PriceSet []ULHostPriceSet +} + +// NewGetULHostRenewPriceRequest will create request of GetULHostRenewPrice action. +func (c *UCompShareClient) NewGetULHostRenewPriceRequest() *GetULHostRenewPriceRequest { + req := &GetULHostRenewPriceRequest{} + + // 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: GetULHostRenewPrice + +获取主机续费价格 +*/ +func (c *UCompShareClient) GetULHostRenewPrice(req *GetULHostRenewPriceRequest) (*GetULHostRenewPriceResponse, error) { + var err error + var res GetULHostRenewPriceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("GetULHostRenewPrice", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// ModifyULHostAttributeRequest is request schema for ModifyULHostAttribute action +type ModifyULHostAttributeRequest 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"` + + // 名称。和Remark至少选择一个进行修改 + Name *string `required:"false"` + + // 备注。和Name至少选择一个进行修改 + Remark *string `required:"false"` + + // ULHost实例Id + ULHostId *string `required:"true"` +} + +// ModifyULHostAttributeResponse is response schema for ModifyULHostAttribute action +type ModifyULHostAttributeResponse struct { + response.CommonBase + + // 错误信息 + Message string + + // ULHost实例Id + ULHostId string +} + +// NewModifyULHostAttributeRequest will create request of ModifyULHostAttribute action. +func (c *UCompShareClient) NewModifyULHostAttributeRequest() *ModifyULHostAttributeRequest { + req := &ModifyULHostAttributeRequest{} + + // 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: ModifyULHostAttribute + +修改指定ULHost实例属性信息,包含名称和备注 +*/ +func (c *UCompShareClient) ModifyULHostAttribute(req *ModifyULHostAttributeRequest) (*ModifyULHostAttributeResponse, error) { + var err error + var res ModifyULHostAttributeResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ModifyULHostAttribute", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// PoweroffULHostInstanceRequest is request schema for PoweroffULHostInstance action +type PoweroffULHostInstanceRequest 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"` + + // ULHost实例ID + ULHostId *string `required:"true"` +} + +// PoweroffULHostInstanceResponse is response schema for PoweroffULHostInstance action +type PoweroffULHostInstanceResponse struct { + response.CommonBase + + // ULHost实例ID + ULHostId string +} + +// NewPoweroffULHostInstanceRequest will create request of PoweroffULHostInstance action. +func (c *UCompShareClient) NewPoweroffULHostInstanceRequest() *PoweroffULHostInstanceRequest { + req := &PoweroffULHostInstanceRequest{} + + // 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: PoweroffULHostInstance + +直接关闭UHost实例电源,无需等待实例正常关闭。 +*/ +func (c *UCompShareClient) PoweroffULHostInstance(req *PoweroffULHostInstanceRequest) (*PoweroffULHostInstanceResponse, error) { + var err error + var res PoweroffULHostInstanceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("PoweroffULHostInstance", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// RebootULHostInstanceRequest is request schema for RebootULHostInstance action +type RebootULHostInstanceRequest 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"` + + // ULHost实例ID + ULHostId *string `required:"true"` +} + +// RebootULHostInstanceResponse is response schema for RebootULHostInstance action +type RebootULHostInstanceResponse struct { + response.CommonBase + + // ULHost实例ID + ULHostId string +} + +// NewRebootULHostInstanceRequest will create request of RebootULHostInstance action. +func (c *UCompShareClient) NewRebootULHostInstanceRequest() *RebootULHostInstanceRequest { + req := &RebootULHostInstanceRequest{} + + // 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: RebootULHostInstance + +重新启动UHost实例。 +*/ +func (c *UCompShareClient) RebootULHostInstance(req *RebootULHostInstanceRequest) (*RebootULHostInstanceResponse, error) { + var err error + var res RebootULHostInstanceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("RebootULHostInstance", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// ReinstallULHostInstanceRequest is request schema for ReinstallULHostInstance action +type ReinstallULHostInstanceRequest 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"` + + // 镜像Id。暂不支持使用自定义镜像重装 + ImageId *string `required:"true"` + + // 登陆密码 + Password *string `required:"true"` + + // 实例Id + ULHostId *string `required:"true"` +} + +// ReinstallULHostInstanceResponse is response schema for ReinstallULHostInstance action +type ReinstallULHostInstanceResponse struct { + response.CommonBase + + // 错误信息 + Message string + + // 实例Id + ULHostId string +} + +// NewReinstallULHostInstanceRequest will create request of ReinstallULHostInstance action. +func (c *UCompShareClient) NewReinstallULHostInstanceRequest() *ReinstallULHostInstanceRequest { + req := &ReinstallULHostInstanceRequest{} + + // 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: ReinstallULHostInstance + +重装轻量应用云主机 +*/ +func (c *UCompShareClient) ReinstallULHostInstance(req *ReinstallULHostInstanceRequest) (*ReinstallULHostInstanceResponse, error) { + var err error + var res ReinstallULHostInstanceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ReinstallULHostInstance", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// ResetULHostInstancePasswordRequest is request schema for ResetULHostInstancePassword action +type ResetULHostInstancePasswordRequest 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"` + + // ULHost新密码(密码格式使用BASE64编码) + Password *string `required:"true"` + + // ULHost实例ID + ULHostId *string `required:"true"` +} + +// ResetULHostInstancePasswordResponse is response schema for ResetULHostInstancePassword action +type ResetULHostInstancePasswordResponse struct { + response.CommonBase + + // ULHost实例ID + ULHostId string +} + +// NewResetULHostInstancePasswordRequest will create request of ResetULHostInstancePassword action. +func (c *UCompShareClient) NewResetULHostInstancePasswordRequest() *ResetULHostInstancePasswordRequest { + req := &ResetULHostInstancePasswordRequest{} + + // 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: ResetULHostInstancePassword + +重置轻量应用云主机管理员密码。 +*/ +func (c *UCompShareClient) ResetULHostInstancePassword(req *ResetULHostInstancePasswordRequest) (*ResetULHostInstancePasswordResponse, error) { + var err error + var res ResetULHostInstancePasswordResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ResetULHostInstancePassword", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// StartULHostInstanceRequest is request schema for StartULHostInstance action +type StartULHostInstanceRequest 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"` + + // ULHost实例ID + ULHostId *string `required:"true"` +} + +// StartULHostInstanceResponse is response schema for StartULHostInstance action +type StartULHostInstanceResponse struct { + response.CommonBase + + // ULHost实例ID + ULHostId string +} + +// NewStartULHostInstanceRequest will create request of StartULHostInstance action. +func (c *UCompShareClient) NewStartULHostInstanceRequest() *StartULHostInstanceRequest { + req := &StartULHostInstanceRequest{} + + // 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: StartULHostInstance + +启动处于关闭状态的UHost实例。 +*/ +func (c *UCompShareClient) StartULHostInstance(req *StartULHostInstanceRequest) (*StartULHostInstanceResponse, error) { + var err error + var res StartULHostInstanceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("StartULHostInstance", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// StopULHostInstanceRequest is request schema for StopULHostInstance action +type StopULHostInstanceRequest 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"` + + // ULHost实例ID。 + ULHostId *string `required:"true"` +} + +// StopULHostInstanceResponse is response schema for StopULHostInstance action +type StopULHostInstanceResponse struct { + response.CommonBase + + // ULHost实例ID + ULHostId string +} + +// NewStopULHostInstanceRequest will create request of StopULHostInstance action. +func (c *UCompShareClient) NewStopULHostInstanceRequest() *StopULHostInstanceRequest { + req := &StopULHostInstanceRequest{} + + // 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: StopULHostInstance + +指停止处于运行状态的ULHost实例 +*/ +func (c *UCompShareClient) StopULHostInstance(req *StopULHostInstanceRequest) (*StopULHostInstanceResponse, error) { + var err error + var res StopULHostInstanceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("StopULHostInstance", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// TerminateULHostInstanceRequest is request schema for TerminateULHostInstance action +type TerminateULHostInstanceRequest 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"` + + // 删除主机时是否同时删除挂载的数据盘。默认为false。 + ReleaseUDisk *bool `required:"false"` + + // ULHost资源Id + ULHostId *string `required:"true"` +} + +// TerminateULHostInstanceResponse is response schema for TerminateULHostInstance action +type TerminateULHostInstanceResponse struct { + response.CommonBase + + // 用于判断主机删除时是否进入回收站。放入回收站:"Yes", 彻底删除:“No”。 + InRecycle string + + // ULHost 实例 Id + ULHostId string +} + +// NewTerminateULHostInstanceRequest will create request of TerminateULHostInstance action. +func (c *UCompShareClient) NewTerminateULHostInstanceRequest() *TerminateULHostInstanceRequest { + req := &TerminateULHostInstanceRequest{} + + // 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: TerminateULHostInstance + +删除指定数据中心的ULHost实例。 +*/ +func (c *UCompShareClient) TerminateULHostInstance(req *TerminateULHostInstanceRequest) (*TerminateULHostInstanceResponse, error) { + var err error + var res TerminateULHostInstanceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("TerminateULHostInstance", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/client.go new file mode 100644 index 0000000000..2ba5b85768 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/client.go @@ -0,0 +1,22 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ucompshare + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/auth" +) + +// UCompShareClient is the client of UCompShare +type UCompShareClient struct { + *ucloud.Client +} + +// NewClient will return a instance of UCompShareClient +func NewClient(config *ucloud.Config, credential *auth.Credential) *UCompShareClient { + meta := ucloud.ClientMeta{Product: "UCompShare"} + client := ucloud.NewClientWithMeta(config, credential, meta) + return &UCompShareClient{ + client, + } +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/doc.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/doc.go new file mode 100644 index 0000000000..4efbd6df22 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/doc.go @@ -0,0 +1,13 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +/* +Package ucompshare include resources of ucloud ucompshare product + +See also + + - API: https://docs.ucloud.cn/api/ucompshare-api/index + - Product: https://www.ucloud.cn/site/product/ucompshare.html + +for detail. +*/ +package ucompshare diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/models.go new file mode 100644 index 0000000000..460d25b0ee --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ucompshare/models.go @@ -0,0 +1,165 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ucompshare + +/* +Bundle - 轻量应用云主机套餐 +*/ +type Bundle struct { + + // 外网带宽。单位:Mbps。 + Bandwidth int + + // 套餐ID。 + BundleId string + + // CPU核数。 + CPU int + + // 内存大小。单位:MB。 + Memory int + + // 系统盘大小。单位:GB。 + SysDiskSpace int + + // 流量包大小。单位:GB。 + TrafficPacket int +} + +/* +ULHostDiskSet - 轻量应用主机的磁盘信息 +*/ +type ULHostDiskSet struct { + + // 磁盘Id + DiskId string + + // 磁盘类型。如:"CLOUD_RSSD"、"CLOUD_SSD" + DiskType string + + // 磁盘盘符。系统盘:"vda" + Drive string + + // 是否为系统盘。是:"True";否:"False" + IsBoot string + + // 磁盘大小。单位:GB + Size int + + // 磁盘类型。系统盘:"Boot";数据盘:"Data" + Type string +} + +/* +UHostIPSet - +*/ +type UHostIPSet struct { + + // IP对应的带宽, 单位: Mb (内网IP不显示带宽信息) + Bandwidth int + + // 内网 Private 类型下,表示是否为默认网卡。true: 是默认网卡;其他值:不是。 + Default string + + // IP地址 + IP string + + // 外网IP资源ID 。(内网IP无对应的资源ID) + IPId string + + // IPv4/IPv6; + IPMode string + + // 内网 Private 类型下,当前网卡的Mac。 + Mac string + + // 弹性网卡为默认网卡时,返回对应的 ID 值 + NetworkInterfaceId string + + // IP地址对应的子网 ID。(北京一不支持,字段返回为空) + SubnetId string + + // 国际: Internation,BGP: Bgp,内网: Private + Type string + + // IP地址对应的VPC ID。(北京一不支持,字段返回为空) + VPCId string + + // 当前EIP的权重。权重最大的为当前的出口IP。 + Weight int +} + +/* +ULHostInstanceSet - 轻量应用云主机详情 +*/ +type ULHostInstanceSet struct { + + // 【数组】镜像包含的应用列表。 + Apps []string + + // 是否自动续费。枚举值:Yes/No + AutoRenew string + + // CPU核数。 + CPU int + + // 计费模式。枚举值:Month/Year + ChargeType string + + // 创建时间。Unix时间戳 + CreateTime int + + // 磁盘信息 + DiskSet []ULHostDiskSet + + // 过期时间。Unix时间戳 + ExpireTime int + + // IP信息 + IPSet []UHostIPSet + + // 镜像Id。 + ImageId string + + // 镜像名称。 + ImageName string + + // 是否过期。枚举值:Yes/No + IsExpire string + + // 内存。单位:MB + Memory int + + // 实例名称。默认套餐Id + Name string + + // 备注。 + Remark string + + // 实例状态。枚举值:\\ >初始化: Initializing; \\ >启动中: Starting; \\> 运行中: Running; \\> 关机中: Stopping; \\ >关机: Stopped \\ >安装失败: Install Fail; \\ >重启中: Rebooting; \\ > 未知(空字符串,获取状态超时或出错):"" + State string + + // 业务组。 + Tag string + + // 实例Id。 + ULHostId string + + // 可用区。 + Zone string +} + +/* +ULHostPriceSet - 轻量应用主机价格详情 +*/ +type ULHostPriceSet struct { + + // 计费模式 + ChargeType string + + // 原价 + OriginalPrice float64 + + // 价格 + Price float64 +} 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 e7bf441641..719de416f7 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 @@ -643,17 +643,17 @@ type CreateUDBInstanceRequest struct { // 磁盘空间(GB), 暂时支持20G - 32T DiskSpace *int `required:"true"` - // 是否创建使用ipv6 资源, 默认为false, 或者不填, 创建ipv6为true - EnableIpV6 *bool `required:"false"` - // UDB实例模式类型, 可选值如下: "Normal": 普通版UDB实例 "HA": 高可用版UDB实例 默认是"Normal" InstanceMode *string `required:"false"` // 【该字段已废弃,请谨慎使用】 InstanceType *string `required:"false" deprecated:"true"` + // 规格类型ID,当SpecificationType为1时有效 + MachineType *string `required:"false"` + // 内存限制(MB),目前支持以下几档 2000M/4000M/ 6000M/8000M/12000M/16000M/ 24000M/32000M/48000M/ 64000M/96000M/128000M/192000M/256000M/320000M - MemoryLimit *int `required:"true"` + MemoryLimit *int `required:"false"` // 实例名称,至少6位 Name *string `required:"true"` @@ -670,6 +670,9 @@ type CreateUDBInstanceRequest struct { // SSD类型,可选值为"SATA"、“NVMe”,默认为“SATA” SSDType *string `required:"false"` + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType *string `required:"false"` + // 子网ID SubnetId *string `required:"false"` @@ -750,6 +753,9 @@ type CreateUDBInstanceByRecoveryRequest struct { // 是否创建使用ipv6 资源, 默认为false, 或者不填, 创建ipv6为true EnableIpV6 *bool `required:"false"` + // 规格类型ID,当SpecificationType为1时有效 + MachineType *string `required:"false"` + // 实例名称,至少6位 Name *string `required:"true"` @@ -759,6 +765,9 @@ type CreateUDBInstanceByRecoveryRequest struct { // 恢复到某个时间点的时间戳(UTC时间格式,默认单位秒) RecoveryTime *int `required:"true"` + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType *int `required:"false"` + // 源实例的Id SrcDBId *string `required:"true"` @@ -1088,6 +1097,9 @@ type CreateUDBSlaveRequest struct { // 是否锁主库,默认为true IsLock *bool `required:"false"` + // 规格类型ID,当SpecificationType为1时有效 + MachineType *string `required:"false"` + // 内存限制(MB),目前支持以下几档 2000M/4000M/ 6000M/8000M/12000M/16000M/ 24000M/32000M/48000M/ 64000M/96000M/128000M/192000M/256000M/320000M MemoryLimit *int `required:"false"` @@ -1106,6 +1118,9 @@ type CreateUDBSlaveRequest struct { // 仅对主为SSD型实例有效。 可选值"SATA","NVMe" SSDType *string `required:"false"` + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType *int `required:"false"` + // master实例的DBId,该值可以通过DescribeUDBInstance获取 SrcId *string `required:"true"` @@ -1999,6 +2014,12 @@ type DescribeUDBInstancePriceRequest struct { // 实例的部署类型。可选值为:Normal: 普通单点实例,Slave: 从库实例,HA: 高可用部署实例,默认是Normal InstanceMode *string `required:"false"` + // 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"` + // 内存限制(MB),单位为MB.目前支持:2000-96000 MemoryLimit *int `required:"true"` @@ -2008,6 +2029,9 @@ type DescribeUDBInstancePriceRequest struct { // SSD类型,可选值为"SATA"、“NVMe”. 默认为“SATA” SSDType *string `required:"false"` + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType *int `required:"false"` + // 【该字段已废弃,请谨慎使用】 UseSSD *bool `required:"false" deprecated:"true"` } @@ -2120,6 +2144,9 @@ type DescribeUDBInstanceUpgradePriceRequest struct { // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"false"` + // CPU核数 快杰SQLServer升降级必传 + CPU *int `required:"false"` + // 实例的Id DBId *string `required:"true"` @@ -2129,6 +2156,9 @@ type DescribeUDBInstanceUpgradePriceRequest struct { // "SATA_SSD", "NVMe_SSD" InstanceType *string `required:"false"` + // 规格类型ID,当SpecificationType为1时有效 + MachineType *string `required:"false"` + // 内存限制(MB) MemoryLimit *int `required:"true"` @@ -2138,6 +2168,9 @@ type DescribeUDBInstanceUpgradePriceRequest struct { // "SATA", "NVMe" SSDType *string `required:"false"` + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType *int `required:"false"` + // 【该字段已废弃,请谨慎使用】 UseSSD *bool `required:"false" deprecated:"true"` } @@ -2872,6 +2905,118 @@ func (c *UDBClient) GetUDBClientConnNum(req *GetUDBClientConnNumRequest) (*GetUD return &res, nil } +// GetUDBInstanceSSLCertURLRequest is request schema for GetUDBInstanceSSLCertURL action +type GetUDBInstanceSSLCertURLRequest 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 + DBId *string `required:"true"` + + // URL的过期时间,该值最小默认1小时,最大7天。(单位/秒) + ExpireTime *int `required:"false"` +} + +// GetUDBInstanceSSLCertURLResponse is response schema for GetUDBInstanceSSLCertURL action +type GetUDBInstanceSSLCertURLResponse struct { + response.CommonBase + + // 内网链接 + InnerUrl string + + // 外网链接 + InternetUrl string +} + +// NewGetUDBInstanceSSLCertURLRequest will create request of GetUDBInstanceSSLCertURL action. +func (c *UDBClient) NewGetUDBInstanceSSLCertURLRequest() *GetUDBInstanceSSLCertURLRequest { + req := &GetUDBInstanceSSLCertURLRequest{} + + // 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: GetUDBInstanceSSLCertURL + +获取SSL证书下载地址 +*/ +func (c *UDBClient) GetUDBInstanceSSLCertURL(req *GetUDBInstanceSSLCertURLRequest) (*GetUDBInstanceSSLCertURLResponse, error) { + var err error + var res GetUDBInstanceSSLCertURLResponse + + reqCopier := *req + + err = c.Client.InvokeAction("GetUDBInstanceSSLCertURL", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// ListUDBUserTablesRequest is request schema for ListUDBUserTables action +type ListUDBUserTablesRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // udb实例的ID + DBId *string `required:"true"` +} + +// ListUDBUserTablesResponse is response schema for ListUDBUserTables action +type ListUDBUserTablesResponse struct { + response.CommonBase + + // 用户库表的集合 + Tables []UDBDatabaseData +} + +// NewListUDBUserTablesRequest will create request of ListUDBUserTables action. +func (c *UDBClient) NewListUDBUserTablesRequest() *ListUDBUserTablesRequest { + req := &ListUDBUserTablesRequest{} + + // 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: ListUDBUserTables + +查看udb实例所有的用户表集合 (只包括引擎为innodb和myisam的表) +*/ +func (c *UDBClient) ListUDBUserTables(req *ListUDBUserTablesRequest) (*ListUDBUserTablesResponse, error) { + var err error + var res ListUDBUserTablesResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ListUDBUserTables", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // ModifyUDBInstanceNameRequest is request schema for ModifyUDBInstanceName action type ModifyUDBInstanceNameRequest struct { request.CommonBase @@ -3043,6 +3188,65 @@ func (c *UDBClient) ModifyUDBInstanceRemarkName(req *ModifyUDBInstanceRemarkName return &res, nil } +// ModifyUDBInstanceSSLRequest is request schema for ModifyUDBInstanceSSL action +type ModifyUDBInstanceSSLRequest 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 + DBId *string `required:"true"` + + // 是否开启SSL 1->关闭 2->开启 + EnableSSL *int `required:"true"` + + // SSL证书有效时间,1-5年,默认为1年 + ValidTime *int `required:"false"` +} + +// ModifyUDBInstanceSSLResponse is response schema for ModifyUDBInstanceSSL action +type ModifyUDBInstanceSSLResponse struct { + response.CommonBase +} + +// NewModifyUDBInstanceSSLRequest will create request of ModifyUDBInstanceSSL action. +func (c *UDBClient) NewModifyUDBInstanceSSLRequest() *ModifyUDBInstanceSSLRequest { + req := &ModifyUDBInstanceSSLRequest{} + + // 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: ModifyUDBInstanceSSL + +调整SSL的信息 +*/ +func (c *UDBClient) ModifyUDBInstanceSSL(req *ModifyUDBInstanceSSLRequest) (*ModifyUDBInstanceSSLResponse, error) { + var err error + var res ModifyUDBInstanceSSLResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ModifyUDBInstanceSSL", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // PromoteUDBInstanceToHARequest is request schema for PromoteUDBInstanceToHA action type PromoteUDBInstanceToHARequest struct { request.CommonBase @@ -3180,12 +3384,18 @@ type ResizeUDBInstanceRequest struct { // UDB数据库机型: "Normal": "标准机型" , "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"` + // 内存限制(MB),目前支持以下几档 2000M/4000M/ 6000M/8000M/ 12000M/16000M/ 24000M/32000M/ 48000M/64000M/96000M/128000M/192000M/256000M/320000M。 MemoryLimit *int `required:"true"` // SSD类型,可选值为"SATA"、“NVMe” SSDType *string `required:"false"` + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType *string `required:"false"` + // DB关闭状态下升降级,升降级后是否启动DB,默认为false StartAfterUpgrade *bool `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 b7afa7a006..edb8c587a2 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 @@ -100,9 +100,6 @@ type UDBSlaveInstanceSet struct { // DB实例过期时间,采用UTC计时时间戳 ExpiredTime int - // 获取该实例的IPv6地址 - IPv6Address string - // UDB实例模式类型, 可选值如下: "Normal": 普通版UDB实例;"HA": 高可用版UDB实例 InstanceMode string @@ -115,6 +112,9 @@ type UDBSlaveInstanceSet struct { // DB实例日志文件大小,单位GB LogFileSize float64 + // 规格类型ID,当SpecificationType为1时有效 + MachineType string + // 内存限制(MB),默认根据配置机型 MemoryLimit int @@ -139,10 +139,13 @@ type UDBSlaveInstanceSet struct { // SSD类型,SATA/PCI-E SSDType string + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType string + // 对mysql的slave而言是master的DBId,对master则为空, 对mongodb则是副本集id SrcDBId string - // DB状态标记 Init:初始化中,Fail:安装失败,Starting:启动中,Running:运行,Shutdown:关闭中,Shutoff:已关闭,Delete:已删除,Upgrading:升级中,Promoting:提升为独库进行中,Recovering:恢复中,Recover fail:恢复失败,Remakeing:重做中,RemakeFail:重做失败 + // DB状态标记 Init:初始化中,Fail:安装失败,Starting:启动中,Running:运行,Shutdown:关闭中,Shutoff:已关闭,Delete:已删除,Upgrading:升级中,Promoting:提升为独库进行中,Recovering:恢复中,Recover fail:恢复失败,Remakeing:重做中,RemakeFail:重做失败, MajorVersionUpgrading:小版本升级中,MajorVersionUpgradeWaitForSwitch:高可用等待切换,MajorVersionUpgradeFail State string // 子网ID @@ -205,9 +208,15 @@ type UDBInstanceSet struct { // 备份策略,一天内备份时间间隔,单位小时,默认24小时 BackupDuration int + // 默认的备份方式,nobackup表示不备份, snapshot 表示使用快照备份,logic 表示使用逻辑备份,xtrabackup表示使用物理备份。 + BackupMethod string + // 跨可用区高可用备库所在可用区 BackupZone string + // CPU核数 + CPU int + // 0区分大小写, 1不分区 CaseSensitivityParam int @@ -244,6 +253,9 @@ type UDBInstanceSet struct { // DB实例磁盘已使用空间,单位GB DiskUsedSize float64 + // mysql是否开启了SSL;1->未开启 2->开启 + EnableSSL int + // DB实例过期时间,采用UTC计时时间戳 ExpiredTime int @@ -262,6 +274,9 @@ type UDBInstanceSet struct { // DB实例日志文件大小,单位GB LogFileSize float64 + // 数据库机型规格 + MachineType string + // 内存限制(MB),默认根据配置机型 MemoryLimit int @@ -283,10 +298,16 @@ type UDBInstanceSet struct { // SSD类型,SATA/PCI-E/NVMe SSDType string + // SSL到期时间 + SSLExpirationTime int + + // 是否使用可选cpu类型规格 + SpecificationType int + // 对mysql的slave而言是master的DBId,对master则为空, 对mongodb则是副本集id SrcDBId string - // DB状态标记 Init:初始化中,Fail:安装失败,Starting:启动中,Running:运行,Shutdown:关闭中,Shutoff:已关闭,Delete:已删除,Upgrading:升级中,Promoting:提升为独库进行中,Recovering:恢复中,Recover fail:恢复失败, Remakeing:重做中,RemakeFail:重做失败,VersionUpgrading:小版本升级中,VersionUpgradeWaitForSwitch:高可用等待切换,VersionUpgradeFail:小版本升级失败 + // DB状态标记 Init:初始化中,Fail:安装失败,Starting:启动中,Running:运行,Shutdown:关闭中,Shutoff:已关闭,Delete:已删除,Upgrading:升级中,Promoting:提升为独库进行中,Recovering:恢复中,Recover fail:恢复失败, Remakeing:重做中,RemakeFail:重做失败,VersionUpgrading:小版本升级中,VersionUpgradeWaitForSwitch:高可用等待切换,VersionUpgradeFail:小版本升级失败,UpdatingSSL:修改SSL中,UpdateSSLFail:修改SSL失败,MajorVersionUpgrading:小版本升级中,MajorVersionUpgradeWaitForSwitch:高可用等待切换,MajorVersionUpgradeFail State string // 子网ID @@ -487,3 +508,30 @@ type ConnNumMap struct { // 该Ip连接数 Num int } + +/* +TableData - 用户表详情 +*/ +type TableData struct { + + // 表所属的库名称 + DBName string + + // 表的引擎(innodb, myisam) + Engine string + + // 表名称 + TableName string +} + +/* +UDBDatabaseData - 某个库的详细信息 +*/ +type UDBDatabaseData struct { + + // 数据库名称 + DBName string + + // 该库所有的表集合 + TableDataSet []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 6998ae8acd..f0c0857955 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 @@ -231,30 +231,12 @@ type CreateUHostInstanceParamNetworkInterfaceEIP struct { ShareBandwidthId *string `required:"false"` } -/* -CreateUHostInstanceParamSecGroupId is request schema for complex param -*/ -type CreateUHostInstanceParamSecGroupId struct { -} - -/* -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,无备份 \\ > DATAARK,数据方舟【已下线,不再支持】 \\ > SNAPSHOT,快照 \\当前磁盘支持的备份模式参考 [[api:uhost-api:disk_type|磁盘类型]],默认值:NONE BackupType *string `required:"false"` // 云盘代金券id。不适用于系统盘/本地盘。请通过DescribeCoupon接口查询,或登录用户中心查看 @@ -291,6 +273,18 @@ type CreateUHostInstanceParamNetworkInterface struct { EIP *CreateUHostInstanceParamNetworkInterfaceEIP `required:"false"` } +/* +CreateUHostInstanceParamSecGroupId is request schema for complex param +*/ +type CreateUHostInstanceParamSecGroupId struct { + + // 安全组 ID。至多可以同时绑定5个安全组。 + Id *string `required:"false"` + + // 安全组优先级。取值范围[1, 5] + Priority *int `required:"false"` +} + /* CreateUHostInstanceParamFeatures is request schema for complex param */ @@ -300,6 +294,18 @@ type CreateUHostInstanceParamFeatures struct { 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 @@ -379,7 +385,7 @@ type CreateUHostInstanceRequest struct { // 云主机机型(V2.0),在本字段和字段UHostType中,仅需要其中1个字段即可。枚举值["N", "C", "G", "O", "OS", "OM", "OPRO", "OMAX", "O.BM", "O.EPC"]。参考[[api:uhost-api:uhost_type|云主机机型说明]]。 MachineType *string `required:"false"` - // 本次最大创建主机数量,取值范围是[1,100],默认值为1。 + // 本次最大创建主机数量,取值范围是[1,100],默认值为1。- 库存数量不足时,按库存数量创建。- 配额不足时,返回错误。- 使用隔离组时,以隔离组可用数量为准。 MaxCount *int `required:"false"` // 内存大小。单位:MB。范围 :[1024, 262144],取值为1024的倍数(可选范围参考控制台)。默认值:8192 @@ -418,9 +424,15 @@ type CreateUHostInstanceRequest struct { // 【该字段已废弃,请谨慎使用】 RestrictMode *string `required:"false" deprecated:"true"` + // + SecGroupId []CreateUHostInstanceParamSecGroupId `required:"false"` + // 防火墙ID,默认:Web推荐防火墙。如何查询SecurityGroupId请参见 [DescribeFirewall](api/unet-api/describe_firewall.html)。 SecurityGroupId *string `required:"false"` + // 主机安全模式。Firewall:防火墙;SecGroup:安全组;默认值:Firewall。 + SecurityMode *string `required:"false"` + // 【该字段已废弃,请谨慎使用】 StorageType *string `required:"false" deprecated:"true"` @@ -1480,6 +1492,9 @@ type GetUHostUpgradePriceRequest struct { // 【该字段已废弃,请谨慎使用】 DiskSpace *int `required:"false" deprecated:"true"` + // GPU卡核心数。仅GPU机型支持此字段(可选范围与MachineType+GpuType相关) + GPU *int `required:"false"` + // 【该字段已废弃,请谨慎使用】 HostType *string `required:"false" deprecated:"true"` @@ -2350,6 +2365,9 @@ type ResizeUHostInstanceRequest struct { // 【该字段已废弃,请谨慎使用】 DiskSpace *int `required:"false" deprecated:"true"` + // GPU卡核心数。仅GPU机型支持此字段(可选范围与MachineType+GpuType相关) + GPU *int `required:"false"` + // 内存大小。单位:MB。范围 :[1024, 1966080],取值为1024的倍数(可选范围与UHostType相关)。默认值为当前实例的内存大小。 Memory *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 95f52e8001..0642928c5f 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,21 +26,6 @@ type KeyPair struct { ProjectId string } -/* -Collection - CPU和内存可支持的规格 -*/ -type Collection struct { - - // CPU规格 - Cpu int - - // 内存规格 - Memory []int - - // CPU和内存规格只能在列出来的CPU平台支持 - MinimalCpuPlatform []string -} - /* FeatureModes - 可以支持的模式类别 */ @@ -93,42 +78,18 @@ type BootDiskInfo struct { } /* -MachineSizes - GPU、CPU和内存信息 -*/ -type MachineSizes struct { - - // CPU和内存可支持的规格 - Collection []Collection - - // Gpu为GPU可支持的规格即GPU颗数,非GPU机型,Gpu为0 - Gpu int -} - -/* -CpuPlatforms - CPU平台信息 +Collection - CPU和内存可支持的规格 */ -type CpuPlatforms struct { - - // 返回AMD的CPU平台信息,例如:AMD: ['Amd/Epyc2'] - Amd []string - - // 返回Arm的CPU平台信息,例如:Ampere: ['Ampere/Altra'] - Ampere []string - - // 返回Intel的CPU平台信息,例如:Intel: ['Intel/CascadeLake','Intel/CascadelakeR','Intel/IceLake'] - Intel []string -} +type Collection struct { -/* -Performance - GPU的性能指标 -*/ -type Performance struct { + // CPU规格 + Cpu int - // 交互展示参数,可忽略 - Rate int + // 内存规格 + Memory []int - // 值,单位是TFlops - Value float64 + // CPU和内存规格只能在列出来的CPU平台支持 + MinimalCpuPlatform []string } /* @@ -170,6 +131,45 @@ type Disks struct { Name string } +/* +CpuPlatforms - CPU平台信息 +*/ +type CpuPlatforms struct { + + // 返回AMD的CPU平台信息,例如:AMD: ['Amd/Epyc2'] + Amd []string + + // 返回Arm的CPU平台信息,例如:Ampere: ['Ampere/Altra'] + Ampere []string + + // 返回Intel的CPU平台信息,例如:Intel: ['Intel/CascadeLake','Intel/CascadelakeR','Intel/IceLake'] + 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,7 +214,7 @@ type UHostImageSet struct { // 创建时间,格式为Unix时间戳 CreateTime int - // 特殊状态标识, 目前包含NetEnhnced(网络增强1.0), NetEnhanced_Ultra(网络增强2.0), HotPlug(热升级), GPU(GPU镜像),CloudInit, IPv6(支持IPv6网络),RssdAttachable(支持RSSD云盘),Vgpu_AMD(支持AMD的vgpu),Vgpu_NVIDIA(支持NVIDIA的vgpu),Aarch64_Type(支持arm64架构) + // 特殊状态标识,目前包含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 // 行业镜像类型(仅行业镜像将返回这个值) @@ -300,15 +300,27 @@ type IsolationGroup struct { } /* -UHostKeyPair - 主机密钥信息 +SpotAttribute - 竞价实例属性 */ -type UHostKeyPair struct { +type SpotAttribute struct { - // 密钥对ID - KeyPairId string + // 回收时间 + RecycleTime int +} - // 主机密钥对状态,Normal 正常,Deleted 删除 - KeyPairState string +/* +UDSetUDHostAttribute - 私有专区对应的宿主机属性 +*/ +type UDSetUDHostAttribute struct { + + // 是否绑定私有专区宿主机 + HostBinding bool + + // 私有专区宿主机 + UDHostId string + + // 私有专区 + UDSetId string } /* @@ -345,12 +357,15 @@ type UHostDiskSet struct { } /* -SpotAttribute - 竞价实例属性 +UHostKeyPair - 主机密钥信息 */ -type SpotAttribute struct { +type UHostKeyPair struct { - // 回收时间 - RecycleTime int + // 密钥对ID + KeyPairId string + + // 主机密钥对状态,Normal 正常,Deleted 删除 + KeyPairState string } /* @@ -392,21 +407,6 @@ type UHostIPSet struct { Weight int } -/* -UDSetUDHostAttribute - 私有专区对应的宿主机属性 -*/ -type UDSetUDHostAttribute struct { - - // 是否绑定私有专区宿主机 - HostBinding bool - - // 私有专区宿主机 - UDHostId string - - // 私有专区 - UDSetId string -} - /* UHostInstanceSet - DescribeUHostInstance */ diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/apis.go index 0fe83a6408..90f8bd3715 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/apis.go @@ -623,6 +623,140 @@ func (c *ULBClient) CreatePolicyGroup(req *CreatePolicyGroupRequest) (*CreatePol return &res, nil } +/* +CreateRuleParamRuleActionsForwardConfigTargets is request schema for complex param +*/ +type CreateRuleParamRuleActionsForwardConfigTargets struct { + + // 转发的后端服务节点的标识ID。限定在监听器的服务节点池里;数组长度可以是0;转发服务节点配置的数组长度不为0时,Id必填 + Id *string `required:"false"` + + // 转发的后端服务节点的权重。仅监听器负载均衡算法是加权轮询是有效 + Weight *int `required:"false"` +} + +/* +CreateRuleParamRuleActionsForwardConfig is request schema for complex param +*/ +type CreateRuleParamRuleActionsForwardConfig struct { + + // + Targets []CreateRuleParamRuleActionsForwardConfigTargets `required:"false"` +} + +/* +CreateRuleParamRuleConditionsPathConfig is request schema for complex param +*/ +type CreateRuleParamRuleConditionsPathConfig struct { + + // 取值。暂时只支持数组长度为1;取值需符合相关条件;路径匹配时必填 + Values []string `required:"false"` +} + +/* +CreateRuleParamRuleConditionsHostConfig is request schema for complex param +*/ +type CreateRuleParamRuleConditionsHostConfig struct { + + // 匹配方式。限定枚举值:"Regular"/"Wildcard",默认值:"Regular" + MatchMode *string `required:"false"` + + // 取值。暂时只支持数组长度为1;取值需符合相关匹配方式的条件;域名匹配时必填 + Values []string `required:"false"` +} + +/* +CreateRuleParamRuleActions is request schema for complex param +*/ +type CreateRuleParamRuleActions struct { + + // + ForwardConfig *CreateRuleParamRuleActionsForwardConfig `required:"false"` + + // 动作类型。限定枚举值:"Forward";RuleActions暂支持长度为1 + Type *string `required:"true"` +} + +/* +CreateRuleParamRuleConditions is request schema for complex param +*/ +type CreateRuleParamRuleConditions struct { + + // + HostConfig *CreateRuleParamRuleConditionsHostConfig `required:"false"` + + // + PathConfig *CreateRuleParamRuleConditionsPathConfig `required:"false"` + + // 匹配条件类型。限定枚举值:"Host"/"Path" + Type *string `required:"true"` +} + +// CreateRuleRequest is request schema for CreateRule action +type CreateRuleRequest 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"` + + // 监听器的ID + ListenerId *string `required:"true"` + + // 负载均衡实例的ID + LoadBalancerId *string `required:"true"` + + // 当转发的服务节点为空时,规则是否忽略。默认值true + Pass *bool `required:"false"` + + // + RuleActions []CreateRuleParamRuleActions `required:"false"` + + // + RuleConditions []CreateRuleParamRuleConditions `required:"false"` +} + +// CreateRuleResponse is response schema for CreateRule action +type CreateRuleResponse struct { + response.CommonBase + + // 转发规则的ID + RuleId string +} + +// NewCreateRuleRequest will create request of CreateRule action. +func (c *ULBClient) NewCreateRuleRequest() *CreateRuleRequest { + req := &CreateRuleRequest{} + + // 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: CreateRule + +给应用型负载均衡监听器创建一条转发规则 +*/ +func (c *ULBClient) CreateRule(req *CreateRuleRequest) (*CreateRuleResponse, error) { + var err error + var res CreateRuleResponse + + reqCopier := *req + + err = c.Client.InvokeAction("CreateRule", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // CreateSSLRequest is request schema for CreateSSL action type CreateSSLRequest struct { request.CommonBase @@ -1417,6 +1551,145 @@ func (c *ULBClient) DeleteVServer(req *DeleteVServerRequest) (*DeleteVServerResp return &res, nil } +// DescribeListenersRequest is request schema for DescribeListeners action +type DescribeListenersRequest 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"` + + // 数据分页值,默认为100 + Limit *int `required:"false"` + + // 应用型负载均衡监听器的ID。若指定ListenerId,则忽略LoadBalancerId。ListenId和LoadBalancerId必选其一 + ListenerId *string `required:"false"` + + // 应用型负载均衡实例的ID。未指定ListenId,则描述指定的LoadBalancerId下的所有监听器。 + LoadBalancerId *string `required:"false"` + + // 数据偏移量,默认为0 + Offset *int `required:"false"` +} + +// DescribeListenersResponse is response schema for DescribeListeners action +type DescribeListenersResponse struct { + response.CommonBase + + // 负载均衡监听器信息 + Listeners []Listener + + // 满足条件的负载均衡监听器总数 + TotalCount int +} + +// NewDescribeListenersRequest will create request of DescribeListeners action. +func (c *ULBClient) NewDescribeListenersRequest() *DescribeListenersRequest { + req := &DescribeListenersRequest{} + + // 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: DescribeListeners + +描述一个指定的监听器或者一个应用型负载均衡实例下的所有监听器 +*/ +func (c *ULBClient) DescribeListeners(req *DescribeListenersRequest) (*DescribeListenersResponse, error) { + var err error + var res DescribeListenersResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeListeners", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// DescribeLoadBalancersRequest is request schema for DescribeLoadBalancers action +type DescribeLoadBalancersRequest 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"` + + // 数据分页值,默认为100 + Limit *string `required:"false"` + + // 负载均衡实例的ID。必须是同一类型的实例,若指定了实例ID,将忽略除Type外的其他过滤条件 + LoadBalancerIds []string `required:"false"` + + // 数据偏移量,默认为0 + Offset *string `required:"false"` + + // 是否获取监听器和后端服务节点的详细信息。默认值:false + ShowDetail *bool `required:"false"` + + // 限定所在的子网 + SubnetId *string `required:"false"` + + // 负载均衡实例的类型。限定枚举值:"Application" / "Network",默认值:"Application" + Type *string `required:"false"` + + // 限定所在的VPC + VPCId *string `required:"false"` +} + +// DescribeLoadBalancersResponse is response schema for DescribeLoadBalancers action +type DescribeLoadBalancersResponse struct { + response.CommonBase + + // 负载均衡实例信息 + LoadBalancers []LoadBalancer + + // 满足条件的负载均衡实例总数 + TotalCount int +} + +// NewDescribeLoadBalancersRequest will create request of DescribeLoadBalancers action. +func (c *ULBClient) NewDescribeLoadBalancersRequest() *DescribeLoadBalancersRequest { + req := &DescribeLoadBalancersRequest{} + + // 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: DescribeLoadBalancers + +描述特定条件下的应用型负载均衡实例或者全部的应用型负载均衡实例 +*/ +func (c *ULBClient) DescribeLoadBalancers(req *DescribeLoadBalancersRequest) (*DescribeLoadBalancersResponse, error) { + var err error + var res DescribeLoadBalancersResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeLoadBalancers", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // DescribePolicyGroupRequest is request schema for DescribePolicyGroup action type DescribePolicyGroupRequest struct { request.CommonBase @@ -1473,6 +1746,65 @@ func (c *ULBClient) DescribePolicyGroup(req *DescribePolicyGroupRequest) (*Descr return &res, nil } +// DescribeRulesRequest is request schema for DescribeRules action +type DescribeRulesRequest 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"` + + // 监听器的ID + ListenerId *string `required:"true"` + + // 应用型负载均衡实例的ID + LoadBalancerId *string `required:"true"` + + // 应用型负载均衡转发规则的ID。指定RuleId,则只描述该规则 + RuleId *string `required:"false"` +} + +// DescribeRulesResponse is response schema for DescribeRules action +type DescribeRulesResponse struct { + response.CommonBase + + // 转发规则信息 + Rules []Rule +} + +// NewDescribeRulesRequest will create request of DescribeRules action. +func (c *ULBClient) NewDescribeRulesRequest() *DescribeRulesRequest { + req := &DescribeRulesRequest{} + + // 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: DescribeRules + +描述一条指定的转发规则或者一个应用型负载均衡监听器下的所有转发规则 +*/ +func (c *ULBClient) DescribeRules(req *DescribeRulesRequest) (*DescribeRulesResponse, error) { + var err error + var res DescribeRulesResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeRules", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // DescribeSSLRequest is request schema for DescribeSSL action type DescribeSSLRequest struct { request.CommonBase @@ -2671,15 +3003,6 @@ type UpdateRuleAttributeParamRuleActionsForwardConfigTargets struct { Weight *int `required:"false"` } -/* -UpdateRuleAttributeParamRuleActionsForwardConfig is request schema for complex param -*/ -type UpdateRuleAttributeParamRuleActionsForwardConfig struct { - - // - Targets []UpdateRuleAttributeParamRuleActionsForwardConfigTargets `required:"false"` -} - /* UpdateRuleAttributeParamRuleConditionsPathConfig is request schema for complex param */ @@ -2702,15 +3025,12 @@ type UpdateRuleAttributeParamRuleConditionsHostConfig struct { } /* -UpdateRuleAttributeParamRuleActions is request schema for complex param +UpdateRuleAttributeParamRuleActionsForwardConfig is request schema for complex param */ -type UpdateRuleAttributeParamRuleActions struct { +type UpdateRuleAttributeParamRuleActionsForwardConfig struct { // - ForwardConfig *UpdateRuleAttributeParamRuleActionsForwardConfig `required:"false"` - - // 动作类型。限定枚举值:"Forward";RuleActions数组长度不为0时必填 - Type *string `required:"false"` + Targets []UpdateRuleAttributeParamRuleActionsForwardConfigTargets `required:"false"` } /* @@ -2728,6 +3048,18 @@ type UpdateRuleAttributeParamRuleConditions struct { Type *string `required:"false"` } +/* +UpdateRuleAttributeParamRuleActions is request schema for complex param +*/ +type UpdateRuleAttributeParamRuleActions struct { + + // + ForwardConfig *UpdateRuleAttributeParamRuleActionsForwardConfig `required:"false"` + + // 动作类型。限定枚举值:"Forward";RuleActions数组长度不为0时必填 + Type *string `required:"false"` +} + // UpdateRuleAttributeRequest is request schema for UpdateRuleAttribute action type UpdateRuleAttributeRequest struct { request.CommonBase diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/models.go index 9fa47efc51..a936bea4fd 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/models.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/models.go @@ -53,6 +53,357 @@ type BackendSet struct { ResourceId string } +/* +ForwardTargetSet - 转发的后端服务节点 +*/ +type ForwardTargetSet struct { + + // 服务节点的标识ID + Id string + + // 权重。仅监听器负载均衡算法是加权轮询是有效;取值范围[1-100],默认值为1 + Weight int +} + +/* +PathConfigSet - 路径相关配置 +*/ +type PathConfigSet struct { + + // 取值。暂时只支持数组长度为1; 取值需符合相关匹配方式的条件 + Values []string +} + +/* +HostConfigSet - 域名相关配置 +*/ +type HostConfigSet struct { + + // 匹配方式。限定枚举值:Regular-正则,Wildcard-泛域名; 默认值:Regular + MatchMode string + + // 取值。暂时只支持数组长度为1; 取值需符合相关匹配方式的条件 + Values []string +} + +/* +ForwardConfigSet - 转发服务节点相关配置 +*/ +type ForwardConfigSet struct { + + // 转发的后端服务节点。限定在监听器的服务节点池里;数组长度可以为0。具体结构详见 ForwardTargetSet + Targets []ForwardTargetSet +} + +/* +RuleCondition - 转发规则匹配条件 +*/ +type RuleCondition struct { + + // 域名相关配置。Type为Host时必填。具体结构详见 HostConfigSet + HostConfig HostConfigSet + + // 路径相关配置。Type为Path时必填。具体结构详见 PathConfigSet + PathConfig PathConfigSet + + // 匹配条件类型。限定枚举值:Host,Path + Type string +} + +/* +RuleAction - 转发动作 +*/ +type RuleAction struct { + + // 转发服务节点相关配置。 具体结构详见 ForwardConfigSet + ForwardConfig ForwardConfigSet + + // 动作类型。限定枚举值:Forward + Type string +} + +/* +StickinessConfigSet - 会话保持相关配置 +*/ +type StickinessConfigSet struct { + + // (应用型专用)自定义Cookie。当StickinessType取值"UserDefined"时有效 + CookieName string + + // 是否开启会话保持功能。应用型负载均衡实例基于Cookie实现 + Enabled bool + + // (应用型专用)Cookie处理方式。限定枚举值: ServerInsert -> 自动生成KEY;UserDefined -> 用户自定义KEY + Type string +} + +/* +HealthCheckConfigSet - 健康检查相关配置 +*/ +type HealthCheckConfigSet struct { + + // (应用型专用)HTTP检查域名。 当Type为HTTP时,此字段有意义,代表HTTP检查域名 + Domain string + + // 是否开启健康检查功能。暂时不支持关闭。 默认值为:true + Enabled bool + + // (应用型专用)HTTP检查路径。当Type为HTTP时,此字段有意义,代表HTTP检查路径 + Path string + + // 健康检查方式。应用型限定取值: Port -> 端口检查;HTTP -> HTTP检查; 默认值:Port + Type string +} + +/* +Rule - (应用型专用)转发规则信息 +*/ +type Rule struct { + + // 是否为默认转发规则 + IsDefault bool + + // 当转发的服务节点为空时,规则是否忽略 + Pass bool + + // 转发动作。具体规则详见RuleAction + RuleActions []RuleAction + + // 转发规则匹配条件。具体结构详见 RuleCondition + RuleConditions []RuleCondition + + // 转发规则的ID + RuleId string +} + +/* +Certificate - (应用型专用)服务器证书信息 +*/ +type Certificate struct { + + // 是否为默认证书 + IsDefault bool + + // 证书ID + SSLId string +} + +/* +Target - 服务节点信息 +*/ +type Target struct { + + // 服务节点是否启用 + Enabled bool + + // 服务节点的标识ID。为ALB/NLB中使用,与资源自身ID无关,可用于UpdateTargetsAttribute/RemoveTargets + Id string + + // 服务节点是否为备节点 + IsBackup bool + + // 服务节点的端口 + Port int + + // 服务节点的IP + ResourceIP string + + // 服务节点的资源ID + ResourceId string + + // 服务节点的资源名称 + ResourceName string + + // 服务节点的类型。限定枚举值:UHost -> 云主机,UNI -> 虚拟网卡,UPM -> 物理云主机,IP -> IP类型; 默认值:"UHost"; 非IP类型,如果该资源有多个IP,将只能添加主IP; 非IP类型,展示时,会显示相关资源信息,IP类型只展示IP信息。 在相关资源被删除时,非IP类型会把相关资源从lb中剔除,IP类型不保证这个逻辑 + ResourceType string + + // 服务节点的健康检查状态。限定枚举值:Healthy -> 健康,Unhealthy -> 不健康 + State string + + // 服务节点的子网资源ID + SubnetId string + + // 服务节点的VPC资源ID + VPCId string + + // 服务节点的权重。仅在加权轮询算法时有效 + Weight int +} + +/* +Listener - 负载均衡监听器信息 +*/ +type Listener struct { + + // (应用型专用)服务器默认证书ID。仅HTTPS监听支持。具体接口详见 Certificate + Certificates []Certificate + + // (应用型专用)是否开启数据压缩功能。目前只支持使用gzip对特定文件类型进行压缩 + CompressionEnabled bool + + // (应用型专用)是否开启HTTP/2特性。仅HTTPS监听支持开启 + HTTP2Enabled bool + + // 健康检查相关配置。具体结构详见 HealthCheckConfigSet + HealthCheckConfig HealthCheckConfigSet + + // 连接空闲超时时间。单位:秒 + IdleTimeout int + + // 监听器的ID + ListenerId string + + // 监听器的监听端口 + ListenerPort int + + // 监听协议。应用型限定取值: HTTP、HTTPS + ListenerProtocol string + + // 监听器的名称 + Name string + + // (应用型专用)是否开启HTTP重定向到HTTPS。仅HTTP监听支持开启 + RedirectEnabled bool + + // (应用型专用)重定向端口 + RedirectPort int + + // 监听器的备注信息 + Remark string + + // (应用型专用)转发规则信息 + Rules []Rule + + // 负载均衡算法。应用型限定取值:Roundrobin -> 轮询;Source -> 源地址; WeightRoundrobin -> 加权轮询; Leastconn -> 最小连接数;Backup ->主备模式 + Scheduler string + + // (应用型专用)安全策略组ID。仅HTTPS监听支持绑定;Default -> 原生策略 + SecurityPolicyId string + + // listener健康状态。限定枚举值:Healthy -> 健康,Unhealthy -> 不健康,PartialHealth -> 部分健康,None -> 无节点状态 + State string + + // 会话保持相关配置。具体结构详见 StickinessConfigSet + StickinessConfig StickinessConfigSet + + // 添加的服务节点信息。具体结构详见 Target + Targets []Target +} + +/* +IPInfo - 绑定的IP信息 +*/ +type IPInfo struct { + + // 网络模式。 限定枚举值:Internet -> 互联网,Intranet -> 内联网 + AddressType string + + // 带宽值。单位M + Bandwidth int + + // 带宽类型。限定枚举值:1 -> 共享带宽,0 -> 普通带宽类型 + BandwidthType int + + // IP地址 + IP string + + // IP协议版本 + IPVersion string + + // 唯一标识ID + Id string + + // 外网IP的运营商信息。枚举值为:Telecom -> 电信,Unicom -> 联通,International -> 国际IP,Bgp -> BGP,Duplet -> 双线(电信+联通双线路),BGPPro -> 精品BGP,China-mobile -> 中国移动,Anycast -> AnycastEIP + OperatorName string +} + +/* +AccessLogConfigSet - (应用型专用)访问日志相关配置 +*/ +type AccessLogConfigSet struct { + + // (应用型专用)是否开启访问日志记录功能 + Enabled bool + + // (应用型专用)用于存储访问日志的bucket + US3BucketName string + + // (应用型专用)上传访问日志到bucket所需的token + US3TokenId string +} + +/* +FirewallSet - ulb防火墙信息 +*/ +type FirewallSet struct { + + // 防火墙ID + FirewallId string + + // 防火墙名称 + FirewallName string +} + +/* +LoadBalancer - 负载均衡实例信息 +*/ +type LoadBalancer struct { + + // (应用型专用)访问日志相关配置 + AccessLogConfig AccessLogConfigSet + + // 是否开启自动续费 + AutoRenewEnabled bool + + // 付费模式 + ChargeType string + + // 负载均衡实例创建时间。格式为Unix Timestamp + CreateTime int + + // 防火墙信息 + Firewall FirewallSet + + // 绑定的IP信息。具体结构详见 IPInfo + IPInfos []IPInfo + + // 负载均衡实例支持的IP协议版本 + IPVersion string + + // 监听器信息。当ShowDetail为false时,为空 + Listeners []Listener + + // 负载均衡实例的ID + LoadBalancerId string + + // 负载均衡实例的名称 + Name string + + // 有效期(计费)。格式为Unix Timestamp + PurchaseValue int + + // 负载均衡实例的备注信息 + Remark string + + // 应用型实例的代理IP或网络型FULLNAT模式下snat所用的IP + SnatIPs []string + + // lb状态:Normal-正常;Arrears-欠费停服 + Status string + + // 负载均衡实例所属的子网资源ID。负载均衡实例的内网VIP和SNAT场景的源IP限定在该子网内;指定子网不影响添加后端服务节点时的范围,依旧是整个VPC下支持的资源 + SubnetId string + + // 负载均衡实例所属的业务组ID + Tag string + + // 负载均衡实例的类型。限定枚举值:Application -> 应用型,Network -> 网络型 + Type string + + // 负载均衡实例所属的VPC资源ID + VPCId string +} + /* UlbPolicyBackendSet - DescribePolicyGroup */ @@ -356,27 +707,6 @@ type PolicyBackendSet struct { SubResourceType string } -/* -BindSecurityPolicy - VServer绑定的安全策略组信息 -*/ -type BindSecurityPolicy struct { - - // 加密套件 - SSLCiphers []string - - // 安全策略组ID - SecurityPolicyId string - - // 安全策略组名称 - SecurityPolicyName string - - // 安全策略类型 0:预定义 1:自定义 - SecurityPolicyType int - - // TLS最低版本 - TLSVersion string -} - /* ULBPolicySet - 内容转发详细列表 */ @@ -410,6 +740,27 @@ type ULBPolicySet struct { VServerId string } +/* +BindSecurityPolicy - VServer绑定的安全策略组信息 +*/ +type BindSecurityPolicy struct { + + // 加密套件 + SSLCiphers []string + + // 安全策略组ID + SecurityPolicyId string + + // 安全策略组名称 + SecurityPolicyName string + + // 安全策略类型 0:预定义 1:自定义 + SecurityPolicyType int + + // TLS最低版本 + TLSVersion string +} + /* ULBBackendSet - DescribeULB */ @@ -462,18 +813,24 @@ type ULBBackendSet struct { } /* -LoggerSet - ulb日志信息 +ULBIPSet - DescribeULB */ -type LoggerSet struct { +type ULBIPSet struct { - // ulb日志上传的bucket - BucketName string + // 弹性IP的带宽值(暂未对外开放) + Bandwidth int - // 上传到bucket使用的token的tokenid - TokenID string + // 弹性IP的带宽类型,枚举值:1 表示是共享带宽,0 普通带宽类型(暂未对外开放) + BandwidthType int - // bucket的token名称 - TokenName string + // 弹性IP地址 + EIP string + + // 弹性IP的ID + EIPId string + + // 弹性IP的运营商信息,枚举值为: Bgp:BGP IP International:国际IP + OperatorName string } /* @@ -552,36 +909,18 @@ type ULBVServerSet struct { } /* -ULBIPSet - DescribeULB +LoggerSet - ulb日志信息 */ -type ULBIPSet struct { - - // 弹性IP的带宽值(暂未对外开放) - Bandwidth int - - // 弹性IP的带宽类型,枚举值:1 表示是共享带宽,0 普通带宽类型(暂未对外开放) - BandwidthType int - - // 弹性IP地址 - EIP string - - // 弹性IP的ID - EIPId string - - // 弹性IP的运营商信息,枚举值为: Bgp:BGP IP International:国际IP - OperatorName string -} +type LoggerSet struct { -/* -FirewallSet - ulb防火墙信息 -*/ -type FirewallSet struct { + // ulb日志上传的bucket + BucketName string - // 防火墙ID - FirewallId string + // 上传到bucket使用的token的tokenid + TokenID string - // 防火墙名称 - FirewallName string + // bucket的token名称 + TokenName string } /* 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 db1f4efff9..8785758688 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.10" +const Version = "0.22.17" diff --git a/vendor/gopkg.in/yaml.v2/go.mod b/vendor/gopkg.in/yaml.v2/go.mod deleted file mode 100644 index 1934e87694..0000000000 --- a/vendor/gopkg.in/yaml.v2/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module "gopkg.in/yaml.v2" - -require ( - "gopkg.in/check.v1" v0.0.0-20161208181325-20d25e280405 -) diff --git a/vendor/modules.txt b/vendor/modules.txt index 6356fcd6b6..795fd0f53f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,29 +1,44 @@ # github.com/cpuguy83/go-md2man v1.0.10 +## explicit; go 1.12 github.com/cpuguy83/go-md2man/md2man # github.com/fatih/color v1.13.0 +## explicit; go 1.13 github.com/fatih/color # github.com/inconshreveable/mousetrap v1.0.0 +## explicit github.com/inconshreveable/mousetrap # github.com/konsorten/go-windows-terminal-sequences v1.0.1 +## explicit github.com/konsorten/go-windows-terminal-sequences +# github.com/kr/pretty v0.1.0 +## explicit # github.com/mattn/go-colorable v0.1.9 +## explicit; go 1.13 github.com/mattn/go-colorable # github.com/mattn/go-isatty v0.0.14 +## explicit; go 1.12 github.com/mattn/go-isatty # github.com/pkg/errors v0.8.0 +## explicit github.com/pkg/errors # github.com/russross/blackfriday v1.5.2 +## explicit github.com/russross/blackfriday # github.com/satori/go.uuid v1.2.0 +## explicit github.com/satori/go.uuid # github.com/sirupsen/logrus v1.3.0 +## explicit github.com/sirupsen/logrus # github.com/spf13/cobra v0.0.3 => github.com/lixiaojun629/cobra v0.0.10 +## explicit; go 1.12 github.com/spf13/cobra 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.10 +# github.com/ucloud/ucloud-sdk-go v0.22.17 +## explicit; go 1.13 github.com/ucloud/ucloud-sdk-go/private/protocol/http github.com/ucloud/ucloud-sdk-go/private/services/pathx github.com/ucloud/ucloud-sdk-go/private/services/udb @@ -32,6 +47,7 @@ github.com/ucloud/ucloud-sdk-go/private/services/umem github.com/ucloud/ucloud-sdk-go/private/utils github.com/ucloud/ucloud-sdk-go/services/pathx github.com/ucloud/ucloud-sdk-go/services/uaccount +github.com/ucloud/ucloud-sdk-go/services/ucompshare github.com/ucloud/ucloud-sdk-go/services/udb github.com/ucloud/ucloud-sdk-go/services/udisk github.com/ucloud/ucloud-sdk-go/services/udpn @@ -51,10 +67,15 @@ github.com/ucloud/ucloud-sdk-go/ucloud/request github.com/ucloud/ucloud-sdk-go/ucloud/response github.com/ucloud/ucloud-sdk-go/ucloud/version # golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 +## explicit golang.org/x/crypto/ssh/terminal # golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 +## explicit; go 1.17 golang.org/x/sys/internal/unsafeheader golang.org/x/sys/unix golang.org/x/sys/windows +# gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 +## explicit # gopkg.in/yaml.v2 v2.2.2 +## explicit gopkg.in/yaml.v2