Skip to content

Commit

Permalink
chore(docs): add examples for firewall commands
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil cybulski committed Apr 20, 2021
1 parent a45cc12 commit c2878d1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
8 changes: 7 additions & 1 deletion internal/commands/serverfirewall/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package serverfirewall

import (
"fmt"

"github.com/UpCloudLtd/upcloud-cli/internal/commands"
"github.com/UpCloudLtd/upcloud-cli/internal/completion"
"github.com/UpCloudLtd/upcloud-cli/internal/output"
Expand Down Expand Up @@ -35,7 +36,12 @@ type createCommand struct {
// CreateCommand creates the "server filewall create" command
func CreateCommand() commands.Command {
return &createCommand{
BaseCommand: commands.New("create", "Create a new firewall rule", ""),
BaseCommand: commands.New(
"create",
"Create a new firewall rule",
"upctl server firewall create 00038afc-d526-4148-af0e-d2f1eeaded9b --direction in --action accept --family IPv4",
"upctl server firewall create 00038afc-d526-4148-af0e-d2f1eeaded9b --direction in --action drop --family IPv4 --src-ipaddress-block 10.11.0.88/24",
),
}
}

Expand Down
3 changes: 2 additions & 1 deletion internal/commands/serverfirewall/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package serverfirewall

import (
"fmt"

"github.com/UpCloudLtd/upcloud-cli/internal/commands"
"github.com/UpCloudLtd/upcloud-cli/internal/completion"
"github.com/UpCloudLtd/upcloud-cli/internal/output"
Expand All @@ -24,7 +25,7 @@ func DeleteCommand() commands.Command {
BaseCommand: commands.New(
"delete",
"Removes a firewall rule from a server. Firewall rules must be removed individually. The positions of remaining firewall rules will be adjusted after a rule is removed.",
"",
"upctl server firewall delete 00038afc-d526-4148-af0e-d2f1eeaded9b --position 1",
),
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/serverfirewall/server_firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func BaseServerFirewallCommand() commands.Command {
commands.New(
"firewall",
"Manage server firewall rules. Enabling or disabling the firewall is done in server modify.",
"")}
)}
}

type serverFirewallCommand struct {
Expand Down
15 changes: 11 additions & 4 deletions internal/commands/serverfirewall/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,31 @@ package serverfirewall

import (
"fmt"
"net"
"strings"
"sync"

"github.com/UpCloudLtd/upcloud-cli/internal/completion"
"github.com/UpCloudLtd/upcloud-cli/internal/output"
"github.com/UpCloudLtd/upcloud-cli/internal/resolver"
"github.com/UpCloudLtd/upcloud-cli/internal/ui"
"github.com/UpCloudLtd/upcloud-go-api/upcloud"
"github.com/UpCloudLtd/upcloud-go-api/upcloud/request"
"github.com/jedib0t/go-pretty/v6/text"
"net"
"strings"
"sync"

"github.com/UpCloudLtd/upcloud-cli/internal/commands"
)

// ShowCommand is the 'server firewall show' command, displaying firewall details
func ShowCommand() commands.Command {
return &showCommand{
BaseCommand: commands.New("show", "Show server firewall details.", ""),
BaseCommand: commands.New(
"show",
"Show server firewall details.",
"upctl server firewall show 00038afc-d526-4148-af0e-d2f1eeaded9b",
"upctl server firewall show 00038afc-d526-4148-af0e-d2f1eeaded9b 009d7f4e-99ce-4c78-88f1-e695d4c37743",
"upctl server firewall show my_server",
),
}
}

Expand Down

0 comments on commit c2878d1

Please sign in to comment.