Skip to content

Commit 0a0c46f

Browse files
authored
Merge pull request #58 from ucloud/feature/globalssh
upgrade globalssh
2 parents 1e33cdc + 3410910 commit 0a0c46f

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

cmd/globalssh.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ type GSSHRow struct {
5151
AcceleratingDomain string
5252
SSHServerLocation string
5353
SSHPort int
54+
GlobalSSHPort int
5455
Remark string
56+
InstanceType string
5557
}
5658

5759
//NewCmdGsshList ucloud gssh list
@@ -84,7 +86,9 @@ func NewCmdGsshList(out io.Writer) *cobra.Command {
8486
row.SSHServerIP = gssh.TargetIP
8587
row.AcceleratingDomain = gssh.AcceleratingDomain
8688
row.SSHPort = gssh.Port
89+
row.GlobalSSHPort = gssh.GlobalSSHPort
8790
row.Remark = gssh.Remark
91+
row.InstanceType = gssh.InstanceType
8892
if val, ok := areaMap[gssh.Area]; ok {
8993
row.SSHServerLocation = val
9094
} else {
@@ -168,8 +172,8 @@ func NewCmdGsshCreate() *cobra.Command {
168172
*req.AreaCode = code
169173
}
170174
}
171-
if port < 1 || port > 65535 || port == 80 || port == 443 {
172-
base.Cxt.Println("The port number should be between 1 and 65535, and cannot be 80 or 443")
175+
if port < 1 || port > 65535 || port == 80 || port == 443 || port == 65123 {
176+
base.Cxt.Println("The port number should be between 1 and 65535, and cannot be 80, 443 or 65123")
173177
return
174178
}
175179
req.TargetIP = sdk.String(targetIP.String())
@@ -187,15 +191,20 @@ func NewCmdGsshCreate() *cobra.Command {
187191
req.AreaCode = cmd.Flags().String("location", "", "Required. Location of the source server. See 'ucloud gssh location'")
188192
targetIP = cmd.Flags().IP("target-ip", nil, "Required. IP of the source server. Required")
189193
bindProjectID(req, flags)
190-
req.Port = cmd.Flags().Int("port", 22, "Optional. Port of The SSH service between 1 and 65535. Do not use ports such as 80,443.")
194+
req.Port = cmd.Flags().Int("port", 22, "Optional. Port of The SSH service between 1 and 65535. Do not use ports such as 80, 443 or 65123.")
191195
req.Remark = cmd.Flags().String("remark", "", "Optional. Remark of your GlobalSSH.")
192196
req.ChargeType = cmd.Flags().String("charge-type", "Month", "Optional.'Year',pay yearly;'Month',pay monthly;'Dynamic', pay hourly(requires access)")
193197
req.Quantity = cmd.Flags().Int("quantity", 1, "Optional. The duration of the instance. N years/months.")
194-
198+
req.InstanceType = cmd.Flags().String("instance-type", "", "Optional. Possible values: 'Ultimate','Enterprise', 'Basic', 'Free'(Default value)")
199+
req.ForwardRegion = cmd.Flags().String("forward-region", "", "Optional. You can select one of 'cn-bj2','cn-sh2','cn-gd' When instance-type is 'Basic'")
200+
req.BandwidthPackage = cmd.Flags().Int("bandwidth-package", 0, "Optional. You can set one of 0, 20, 40 When instance-type is 'Ultimate'")
195201
cmd.MarkFlagRequired("location")
196202
cmd.MarkFlagRequired("target-ip")
197203
cmd.Flags().SetFlagValues("location", "LosAngeles", "Singapore", "Lagos", "HongKong", "Tokyo", "Washington", "Frankfurt")
198204
cmd.Flags().SetFlagValues("charge-type", "Month", "Year", "Dynamic", "Trial")
205+
cmd.Flags().SetFlagValues("bandwidth-package", "0", "20", "40")
206+
cmd.Flags().SetFlagValues("forward-region", "cn-bj2", "cn-sh2", "cn-gd")
207+
cmd.Flags().SetFlagValues("instance-type", "Free", "Basic", "Enterprise", "Ultimate")
199208
cmd.Flags().SetFlagValuesFunc("target-ip", func() []string {
200209
eips := getAllEip(*req.ProjectId, base.ConfigIns.Region, nil, nil)
201210
for idx, eip := range eips {
@@ -258,8 +267,8 @@ func NewCmdGsshModify() *cobra.Command {
258267
}
259268
if *gsshModifyPortReq.Port != 0 {
260269
port := *gsshModifyPortReq.Port
261-
if port <= 1 || port >= 65535 || port == 80 || port == 443 {
262-
base.Cxt.Println("The port number should be between 1 and 65535, and cannot be equal to 80 or 443")
270+
if port <= 1 || port >= 65535 || port == 80 || port == 443 || port == 65123 {
271+
base.Cxt.Println("The port number should be between 1 and 65535, and cannot be equal to 80, 443 or 65123")
263272
return
264273
}
265274
for _, idname := range gsshIDs {

0 commit comments

Comments
 (0)