diff --git a/cmd/network/network.go b/cmd/network/network.go index d3ec590a..73657681 100644 --- a/cmd/network/network.go +++ b/cmd/network/network.go @@ -25,4 +25,7 @@ func init() { NetworkCmd.AddCommand(networkCreateCmd) NetworkCmd.AddCommand(networkUpdateCmd) NetworkCmd.AddCommand(networkRemoveCmd) + + networkCreateCmd.Flags().StringVarP(&cidrV4, "cidr-v4", "", "", "Custom IPv4 CIDR") + networkCreateCmd.Flags().StringSliceVarP(&nameserversV4, "nameservers-v4", "", nil, "Custom list of IPv4 nameservers (up to three, comma-separated)") } diff --git a/cmd/network/network_create.go b/cmd/network/network_create.go index 08384354..670838f2 100644 --- a/cmd/network/network_create.go +++ b/cmd/network/network_create.go @@ -2,6 +2,7 @@ package network import ( "fmt" + "github.com/civo/civogo" "os" "github.com/civo/cli/common" @@ -10,6 +11,11 @@ import ( "github.com/spf13/cobra" ) +var ( + cidrV4 string + nameserversV4 []string +) + var networkCreateCmd = &cobra.Command{ Use: "create", Aliases: []string{"new", "add"}, @@ -28,7 +34,13 @@ var networkCreateCmd = &cobra.Command{ os.Exit(1) } - network, err := client.NewNetwork(args[0]) + networkConfig := civogo.NetworkConfig{ + Label: args[0], + CIDRv4: cidrV4, + NameserversV4: nameserversV4, + } + + network, err := client.CreateNetwork(networkConfig) if err != nil { utility.Error("%s", err) os.Exit(1)