Skip to content

Commit

Permalink
fix network assignement in firewall ls
Browse files Browse the repository at this point in the history
  • Loading branch information
uzaxirr committed Jul 15, 2024
1 parent 1a36ffc commit 6b5887d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cmd/firewall/firewall_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import (
"os"
"strconv"

"github.com/spf13/cobra"

"github.com/civo/civogo"
"github.com/civo/cli/common"
"github.com/civo/cli/config"
"github.com/civo/cli/utility"
"github.com/spf13/cobra"
)

var firewallListCmd = &cobra.Command{
Expand Down Expand Up @@ -51,18 +49,18 @@ Example: civo firewall ls -o custom -f "ID: Name"`,
}

networkMap := make(map[string]string, 0)
var network civogo.Network
for _, network = range networks {
for _, network := range networks {
networkMap[network.ID] = network.Label
}

ow := utility.NewOutputWriter()
for _, firewall := range firewalls {

ow.StartLine()

ow.AppendDataWithLabel("id", firewall.ID, "ID")
ow.AppendDataWithLabel("name", firewall.Name, "Name")
ow.AppendDataWithLabel("network", networkMap[network.ID], "Network")
ow.AppendDataWithLabel("network", networkMap[firewall.NetworkID], "Network")
ow.AppendDataWithLabel("rules_count", strconv.Itoa(firewall.RulesCount), "Total rules")
ow.AppendDataWithLabel("instances_count", strconv.Itoa(firewall.InstanceCount), "Total Instances")
ow.AppendDataWithLabel("clusters_count", strconv.Itoa(firewall.ClusterCount), "Total Clusters")
Expand Down

0 comments on commit 6b5887d

Please sign in to comment.