@@ -90,27 +90,27 @@ func NewCmdEIPList() *cobra.Command {
9090 eipList = resp .EIPSet
9191 }
9292
93+ list := make ([]EIPRow , 0 )
94+ for _ , eip := range eipList {
95+ row := EIPRow {}
96+ row .Name = eip .Name
97+ for _ , ip := range eip .EIPAddr {
98+ row .IP += ip .IP + " " + ip .OperatorName + " "
99+ }
100+ row .ResourceID = eip .EIPId
101+ row .Group = eip .Tag
102+ row .ChargeMode = eip .PayMode
103+ row .Bandwidth = strconv .Itoa (eip .Bandwidth ) + "Mb"
104+ if eip .Resource .ResourceId != "" {
105+ row .BindResource = fmt .Sprintf ("%s|%s(%s)" , eip .Resource .ResourceName , eip .Resource .ResourceId , eip .Resource .ResourceType )
106+ }
107+ row .Status = eip .Status
108+ row .ExpirationTime = time .Unix (int64 (eip .ExpireTime ), 0 ).Format ("2006-01-02" )
109+ list = append (list , row )
110+ }
93111 if global .json {
94- base .PrintJSON (eipList )
112+ base .PrintJSON (list )
95113 } else {
96- list := make ([]EIPRow , 0 )
97- for _ , eip := range eipList {
98- row := EIPRow {}
99- row .Name = eip .Name
100- for _ , ip := range eip .EIPAddr {
101- row .IP += ip .IP + " " + ip .OperatorName + " "
102- }
103- row .ResourceID = eip .EIPId
104- row .Group = eip .Tag
105- row .ChargeMode = eip .PayMode
106- row .Bandwidth = strconv .Itoa (eip .Bandwidth ) + "Mb"
107- if eip .Resource .ResourceId != "" {
108- row .BindResource = fmt .Sprintf ("%s|%s(%s)" , eip .Resource .ResourceName , eip .Resource .ResourceId , eip .Resource .ResourceType )
109- }
110- row .Status = eip .Status
111- row .ExpirationTime = time .Unix (int64 (eip .ExpireTime ), 0 ).Format ("2006-01-02" )
112- list = append (list , row )
113- }
114114 base .PrintTableS (list )
115115 }
116116 },
@@ -368,14 +368,15 @@ func NewCmdEIPRelease() *cobra.Command {
368368 return cmd
369369}
370370
371- //NewCmdEIPModifyBandwidth ucloud eip modify-bandwidth
371+ //NewCmdEIPModifyBandwidth ucloud eip modify-bw
372372func NewCmdEIPModifyBandwidth () * cobra.Command {
373373 ids := []string {}
374374 req := base .BizClient .NewModifyEIPBandwidthRequest ()
375375 cmd := & cobra.Command {
376- Use : "modify-bandwidth" ,
377- Short : "Modify bandwith of EIP instances" ,
378- Long : "Modify bandwith of EIP instances" ,
376+ Use : "modify-bw" ,
377+ Short : "Modify bandwith of EIP instances" ,
378+ Long : "Modify bandwith of EIP instances" ,
379+ Example : "ucloud eip modify-bw --eip-id eip-xxx --bandwidth-mb 20" ,
379380 Run : func (cmd * cobra.Command , args []string ) {
380381 for _ , id := range ids {
381382 id = base .PickResourceID (id )
@@ -407,9 +408,10 @@ func NewCmdEIPSetChargeMode() *cobra.Command {
407408 ids := []string {}
408409 req := base .BizClient .NewSetEIPPayModeRequest ()
409410 cmd := & cobra.Command {
410- Use : "modify-charge-mode" ,
411- Short : "Modify charge mode of EIP instances" ,
412- Long : "Modify charge mode of EIP instances" ,
411+ Use : "modify-charge-mode" ,
412+ Short : "Modify charge mode of EIP instances" ,
413+ Long : "Modify charge mode of EIP instances" ,
414+ Example : "ucloud eip modify-charge-mode --eip-id eip-xxx --charge-mode Traffic" ,
413415 Run : func (cmd * cobra.Command , args []string ) {
414416 for _ , id := range ids {
415417 id = base .PickResourceID (id )
@@ -424,7 +426,7 @@ func NewCmdEIPSetChargeMode() *cobra.Command {
424426 if err != nil {
425427 base .HandleError (err )
426428 } else {
427- base .Cxt .Printf ("eip[%s]'s charge mode modified to %s\n " , id , * req .PayMode )
429+ base .Cxt .Printf ("eip[%s]'s charge mode was modified to %s\n " , id , * req .PayMode )
428430 }
429431 }
430432 },
@@ -449,9 +451,10 @@ func NewCmdEIPJoinSharedBW() *cobra.Command {
449451 eipIDs := []string {}
450452 req := base .BizClient .NewAssociateEIPWithShareBandwidthRequest ()
451453 cmd := & cobra.Command {
452- Use : "join-shared-bw" ,
453- Short : "Join shared bandwidth" ,
454- Long : "Join shared bandwidth" ,
454+ Use : "join-shared-bw" ,
455+ Short : "Join shared bandwidth" ,
456+ Long : "Join shared bandwidth" ,
457+ Example : "ucloud eip join-shared-bw --eip-id eip-xxx --shared-bw-id bwshare-xxx" ,
455458 Run : func (c * cobra.Command , args []string ) {
456459 for _ , eip := range eipIDs {
457460 req .EIPIds = append (req .EIPIds , base .PickResourceID (eip ))
@@ -489,9 +492,10 @@ func NewCmdEIPLeaveSharedBW() *cobra.Command {
489492 eipIDs := []string {}
490493 req := base .BizClient .NewDisassociateEIPWithShareBandwidthRequest ()
491494 cmd := & cobra.Command {
492- Use : "leave-shared-bw" ,
493- Short : "Leave shared bandwidth" ,
494- Long : "Leave shared bandwidth" ,
495+ Use : "leave-shared-bw" ,
496+ Short : "Leave shared bandwidth" ,
497+ Long : "Leave shared bandwidth" ,
498+ Example : "ucloud eip leave-shared-bw --eip-id eip-b2gvu3" ,
495499 Run : func (c * cobra.Command , args []string ) {
496500 if * req .ShareBandwidthId == "" {
497501 for _ , eipID := range eipIDs {
0 commit comments