@@ -62,13 +62,13 @@ type upathRow struct {
6262
6363//NewCmdUpathList ucloud pathx upath list
6464func NewCmdUpathList (out io.Writer ) * cobra.Command {
65- req := base .BizClient .NewDescribeUPathRequest ()
65+ req := base .BizClient .PrivatePathxClient . NewDescribeUPathRequest ()
6666 cmd := & cobra.Command {
6767 Use : "list" ,
6868 Short : "list upath instances" ,
6969 Long : "list upath instances" ,
7070 Run : func (c * cobra.Command , args []string ) {
71- resp , err := base .BizClient .DescribeUPath (req )
71+ resp , err := base .BizClient .PrivatePathxClient . DescribeUPath (req )
7272 if err != nil {
7373 base .HandleError (err )
7474 return
@@ -132,14 +132,14 @@ var protocols = []string{"tcp", "udp"}
132132
133133//NewCmdUGAList ucloud uga list
134134func NewCmdUGAList (out io.Writer ) * cobra.Command {
135- req := base .BizClient .NewDescribeUGAInstanceRequest ()
135+ req := base .BizClient .PrivatePathxClient . NewDescribeUGAInstanceRequest ()
136136 cmd := & cobra.Command {
137137 Use : "list" ,
138138 Short : "list uga instances" ,
139139 Long : "list uga instances" ,
140140 Run : func (c * cobra.Command , args []string ) {
141141 * req .UGAId = base .PickResourceID (* req .UGAId )
142- resp , err := base .BizClient .DescribeUGAInstance (req )
142+ resp , err := base .BizClient .PrivatePathxClient . DescribeUGAInstance (req )
143143 if err != nil {
144144 base .HandleError (err )
145145 return
@@ -195,14 +195,14 @@ func getPortStr(list []ppathx.UGAATask) string {
195195
196196//NewCmdUGADescribe ucloud uga describe
197197func NewCmdUGADescribe (out io.Writer ) * cobra.Command {
198- req := base .BizClient .NewDescribeUGAInstanceRequest ()
198+ req := base .BizClient .PrivatePathxClient . NewDescribeUGAInstanceRequest ()
199199 cmd := & cobra.Command {
200200 Use : "describe" ,
201201 Short : "Display detail informations about uga instances" ,
202202 Long : "Display detail informations about uga instances" ,
203203 Run : func (c * cobra.Command , args []string ) {
204204 * req .UGAId = base .PickResourceID (* req .UGAId )
205- resp , err := base .BizClient .DescribeUGAInstance (req )
205+ resp , err := base .BizClient .PrivatePathxClient . DescribeUGAInstance (req )
206206 if err != nil {
207207 base .HandleError (err )
208208 return
@@ -214,13 +214,13 @@ func NewCmdUGADescribe(out io.Writer) *cobra.Command {
214214
215215 ins := resp .UGAList [0 ]
216216 list := []base.DescribeTableRow {
217- base. DescribeTableRow {"ResourceID" , ins .UGAId },
218- base. DescribeTableRow {"UGAName" , ins .UGAName },
219- base. DescribeTableRow {"Origin" , fmt .Sprintf ("%s%s" , ins .Domain , strings .Join (ins .IPList , "," ))},
220- base. DescribeTableRow {"CName" , ins .CName },
221- base. DescribeTableRow {"AcceleratedPath" , getUpathStr (ins .UPathSet )},
222- base. DescribeTableRow {"OutIP" , getOutIPStr (ins .OutPublicIpList )},
223- base. DescribeTableRow {"Port" , getPortStr (ins .TaskSet )},
217+ {"ResourceID" , ins .UGAId },
218+ {"UGAName" , ins .UGAName },
219+ {"Origin" , fmt .Sprintf ("%s%s" , ins .Domain , strings .Join (ins .IPList , "," ))},
220+ {"CName" , ins .CName },
221+ {"AcceleratedPath" , getUpathStr (ins .UPathSet )},
222+ {"OutIP" , getOutIPStr (ins .OutPublicIpList )},
223+ {"Port" , getPortStr (ins .TaskSet )},
224224 }
225225 base .PrintList (list , out )
226226 },
@@ -271,7 +271,7 @@ func formatPortList(userPorts []string) ([]string, error) {
271271func NewCmdUGACreate (out io.Writer ) * cobra.Command {
272272 var protocol string
273273 var ports , lines []string
274- req := base .BizClient .NewCreateUGAInstanceRequest ()
274+ req := base .BizClient .PrivatePathxClient . NewCreateUGAInstanceRequest ()
275275 cmd := & cobra.Command {
276276 Use : "create" ,
277277 Short : "Create uga instance" ,
@@ -302,7 +302,7 @@ func NewCmdUGACreate(out io.Writer) *cobra.Command {
302302 fmt .Fprintf (out , "protocol should be one of %s, received:%s\n " , strings .Join (protocols , "," ), protocol )
303303 }
304304
305- resp , err := base .BizClient .CreateUGAInstance (req )
305+ resp , err := base .BizClient .PrivatePathxClient . CreateUGAInstance (req )
306306 if err != nil {
307307 if uErr , ok := err .(uerr.Error ); ok && uErr .Code () == 33756 {
308308 fmt .Fprintf (out , "The number of ports added exceeds the limit(50). We recommend that you could reduce the number of ports, then create an uga instance, \n and then add the remaining ports by executing 'ucloud pathx uga add-port --protocol %s --uga-id <uga-id> --port <PortList>'\n " , protocol )
@@ -314,11 +314,11 @@ func NewCmdUGACreate(out io.Writer) *cobra.Command {
314314
315315 for _ , path := range lines {
316316 p := base .PickResourceID (path )
317- bindReq := base .BizClient .NewUGABindUPathRequest ()
317+ bindReq := base .BizClient .PrivatePathxClient . NewUGABindUPathRequest ()
318318 bindReq .ProjectId = req .ProjectId
319319 bindReq .UGAId = sdk .String (resp .UGAId )
320320 bindReq .UPathId = & p
321- _ , err := base .BizClient .UGABindUPath (bindReq )
321+ _ , err := base .BizClient .PrivatePathxClient . UGABindUPath (bindReq )
322322 if err != nil {
323323 fmt .Fprintf (out , "bind uga[%s] and upath[%s] failed: %v\n " , resp .UGAId , p , err )
324324 } else {
@@ -358,7 +358,7 @@ func NewCmdUGACreate(out io.Writer) *cobra.Command {
358358//NewCmdUGADelete ucloud uga delete
359359func NewCmdUGADelete (out io.Writer ) * cobra.Command {
360360 idNames := []string {}
361- req := base .BizClient .NewDeleteUGAInstanceRequest ()
361+ req := base .BizClient .PrivatePathxClient . NewDeleteUGAInstanceRequest ()
362362 cmd := & cobra.Command {
363363 Use : "delete" ,
364364 Short : "Delete uga instances" ,
@@ -367,7 +367,7 @@ func NewCmdUGADelete(out io.Writer) *cobra.Command {
367367 for _ , idname := range idNames {
368368 id := base .PickResourceID (idname )
369369 req .UGAId = & id
370- _ , err := base .BizClient .DeleteUGAInstance (req )
370+ _ , err := base .BizClient .PrivatePathxClient . DeleteUGAInstance (req )
371371 if err != nil {
372372 base .HandleError (err )
373373 } else {
@@ -510,9 +510,9 @@ func NewCmdUGARemovePort(out io.Writer) *cobra.Command {
510510}
511511
512512func getUGAList (project string ) ([]ppathx.UGAAInfo , error ) {
513- req := base .BizClient .NewDescribeUGAInstanceRequest ()
513+ req := base .BizClient .PrivatePathxClient . NewDescribeUGAInstanceRequest ()
514514 req .ProjectId = & project
515- resp , err := base .BizClient .DescribeUGAInstance (req )
515+ resp , err := base .BizClient .PrivatePathxClient . DescribeUGAInstance (req )
516516 if err != nil {
517517 return nil , err
518518 }
@@ -533,9 +533,9 @@ func getUGAIDList(project string) []string {
533533}
534534
535535func getUpathList (project string ) ([]ppathx.UPathInfo , error ) {
536- req := base .BizClient .NewDescribeUPathRequest ()
536+ req := base .BizClient .PrivatePathxClient . NewDescribeUPathRequest ()
537537 req .ProjectId = & project
538- resp , err := base .BizClient .DescribeUPath (req )
538+ resp , err := base .BizClient .PrivatePathxClient . DescribeUPath (req )
539539 if err != nil {
540540 return nil , err
541541 }
0 commit comments