diff --git a/args.go b/args.go index 0d50f2a60..fda546cc8 100644 --- a/args.go +++ b/args.go @@ -349,6 +349,8 @@ const ( ArgGlobalLoadBalancerCDNSettings = "glb-cdn-settings" // ArgTargetLoadBalancerIDs is a list of target load balancer IDs. ArgTargetLoadBalancerIDs = "target-lb-ids" + // ArgLoadBalancerNetwork is the type of network the load balancer is accessible from. + ArgLoadBalancerNetwork = "network" // ArgFirewallName is a name of the firewall. ArgFirewallName = "name" diff --git a/commands/load_balancers.go b/commands/load_balancers.go index 476bd3ba3..6e9374bd5 100644 --- a/commands/load_balancers.go +++ b/commands/load_balancers.go @@ -104,7 +104,10 @@ With the load-balancer command, you can list, create, or delete load balancers, AddStringSliceFlag(cmdLoadBalancerCreate, doctl.ArgTargetLoadBalancerIDs, "", []string{}, "A comma-separated list of Load Balancer IDs to add as target to the global load balancer "+ "(NOTE: this is a closed beta feature, contact DigitalOcean support to review its public availability.)") + AddStringFlag(cmdLoadBalancerCreate, doctl.ArgLoadBalancerNetwork, "", "", "The type of network the load balancer is accessible from, e.g.: `EXTERNAL` or `INTERNAL`"+ + "(NOTE: this is a closed beta feature, contact DigitalOcean support to review its public availability.)") cmdLoadBalancerCreate.Flags().MarkHidden(doctl.ArgLoadBalancerType) + cmdLoadBalancerCreate.Flags().MarkHidden(doctl.ArgLoadBalancerNetwork) cmdRecordUpdate := CmdBuilder(cmd, RunLoadBalancerUpdate, "update ", "Update a load balancer's configuration", `Use this command to update the configuration of a specified load balancer. Using all applicable flags, the command should contain a full representation of the load balancer including existing attributes, such as the load balancer's name, region, forwarding rules, and Droplet IDs. Any attribute that is not provided is reset to its default value.`, Writer, aliasOpt("u")) @@ -705,6 +708,12 @@ func buildRequestFromArgs(c *CmdConfig, r *godo.LoadBalancerRequest) error { } r.TargetLoadBalancerIDs = lbIDsList + network, err := c.Doit.GetString(c.NS, doctl.ArgLoadBalancerNetwork) + if err != nil { + return err + } + r.Network = strings.ToUpper(network) + return nil } diff --git a/commands/load_balancers_test.go b/commands/load_balancers_test.go index 3d0a1d63b..dd74405ac 100644 --- a/commands/load_balancers_test.go +++ b/commands/load_balancers_test.go @@ -116,6 +116,7 @@ func TestLoadBalancerCreate(t *testing.T) { Deny: []string{"cidr:1.2.0.0/16"}, Allow: []string{"ip:1.2.3.4", "ip:1.2.3.5"}, }, + Network: "EXTERNAL", } disableLetsEncryptDNSRecords := true r.DisableLetsEncryptDNSRecords = &disableLetsEncryptDNSRecords @@ -135,6 +136,7 @@ func TestLoadBalancerCreate(t *testing.T) { config.Doit.Set(config.NS, doctl.ArgHTTPIdleTimeoutSeconds, 120) config.Doit.Set(config.NS, doctl.ArgDenyList, []string{"cidr:1.2.0.0/16"}) config.Doit.Set(config.NS, doctl.ArgAllowList, []string{"ip:1.2.3.4", "ip:1.2.3.5"}) + config.Doit.Set(config.NS, doctl.ArgLoadBalancerNetwork, "EXTERNAL") err := RunLoadBalancerCreate(config) assert.NoError(t, err) @@ -182,6 +184,7 @@ func TestLoadBalancerCreateGLB(t *testing.T) { "019cb059-603f-4828-8be4-641a20f25006", "023da268-bc81-468f-aa4d-9abdc4f69935", }, + Network: "EXTERNAL", } disableLetsEncryptDNSRecords := true r.DisableLetsEncryptDNSRecords = &disableLetsEncryptDNSRecords @@ -203,6 +206,7 @@ func TestLoadBalancerCreateGLB(t *testing.T) { "019cb059-603f-4828-8be4-641a20f25006", "023da268-bc81-468f-aa4d-9abdc4f69935", }) + config.Doit.Set(config.NS, doctl.ArgLoadBalancerNetwork, "EXTERNAL") err := RunLoadBalancerCreate(config) assert.NoError(t, err) diff --git a/commands/vpc_peerings.go b/commands/vpc_peerings.go index f1e0f11cf..22a65b7e4 100644 --- a/commands/vpc_peerings.go +++ b/commands/vpc_peerings.go @@ -7,11 +7,12 @@ import ( "strings" "time" + "github.com/digitalocean/godo" + "github.com/spf13/cobra" + "github.com/digitalocean/doctl" "github.com/digitalocean/doctl/commands/displayers" "github.com/digitalocean/doctl/do" - "github.com/digitalocean/godo" - "github.com/spf13/cobra" ) // VPCPeerings creates the vpc peerings command. @@ -222,12 +223,15 @@ func RunVPCPeeringDelete(c *CmdConfig) error { if err != nil { return fmt.Errorf("VPC Peering couldn't be deleted : %v", err) } + notice("VPC Peering is successfully deleted") + } else { + notice("VPC Peering deletion request accepted") } } else { return fmt.Errorf("operation aborted") } - notice("VPC Peering is successfully deleted") + return nil }