From 2f22669f05b334d02f319a293a4806145a8b0ba7 Mon Sep 17 00:00:00 2001 From: ErwinsExpertise Date: Mon, 10 Jul 2023 08:49:58 -0400 Subject: [PATCH] added vlb nodes --- load_balancer.go | 4 +++- load_balancer_test.go | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/load_balancer.go b/load_balancer.go index 105ebad..16b2c2a 100644 --- a/load_balancer.go +++ b/load_balancer.go @@ -41,6 +41,7 @@ type LoadBalancer struct { IPV4 string `json:"ipv4,omitempty"` IPV6 string `json:"ipv6,omitempty"` Instances []string `json:"instances,omitempty"` + Nodes int `json:"nodes,omitempty"` HealthCheck *HealthCheck `json:"health_check,omitempty"` GenericInfo *GenericInfo `json:"generic_info,omitempty"` SSLInfo *bool `json:"has_ssl,omitempty"` @@ -52,7 +53,8 @@ type LoadBalancer struct { type LoadBalancerReq struct { Region string `json:"region,omitempty"` Label string `json:"label,omitempty"` - Instances []string `json:"instances"` + Instances []string `json:"instances,omitempty"` + Nodes int `json:"nodes,omitempty"` HealthCheck *HealthCheck `json:"health_check,omitempty"` StickySessions *StickySessions `json:"sticky_session,omitempty"` ForwardingRules []ForwardingRule `json:"forwarding_rules,omitempty"` diff --git a/load_balancer_test.go b/load_balancer_test.go index e754946..47f2e70 100644 --- a/load_balancer_test.go +++ b/load_balancer_test.go @@ -60,6 +60,7 @@ func TestLoadBalancerHandler_List(t *testing.T) { "ip_type": "v4" } ], + "nodes": 3, "instances": [ "12345" ] @@ -122,6 +123,7 @@ func TestLoadBalancerHandler_List(t *testing.T) { HealthyThreshold: 5, }, Instances: []string{"12345"}, + Nodes: 3, FirewallRules: []LBFirewallRule{ { RuleID: "abcd12345", @@ -215,6 +217,7 @@ func TestLoadBalancerHandler_Get(t *testing.T) { "ip_type": "v4" } ], + "nodes": 3, "instances": [ "12345" ] @@ -268,6 +271,7 @@ func TestLoadBalancerHandler_Get(t *testing.T) { HealthyThreshold: 5, }, Instances: []string{"12345"}, + Nodes: 3, FirewallRules: []LBFirewallRule{ { RuleID: "abcd12345", @@ -453,6 +457,7 @@ func TestLoadBalancerHandler_Create(t *testing.T) { "ip_type": "v4" } ], + "nodes": 3, "instances": [ "1234" ] @@ -477,6 +482,7 @@ func TestLoadBalancerHandler_Create(t *testing.T) { BalancingAlgorithm: "roundrobin", SSLRedirect: BoolToBoolPtr(false), ProxyProtocol: BoolToBoolPtr(false), + Nodes: 3, PrivateNetwork: StringToStringPtr("8d5bdbdb-3324-4d0c-b303-03e1315e1c02"), VPC: StringToStringPtr("8d5bdbdb-3324-4d0c-b303-03e1315e1c02"), HealthCheck: &HealthCheck{ @@ -533,6 +539,7 @@ func TestLoadBalancerHandler_Create(t *testing.T) { HealthyThreshold: 5, }, Instances: []string{"1234"}, + Nodes: 3, FirewallRules: []LBFirewallRule{ { RuleID: "abcd12345", @@ -573,6 +580,7 @@ func TestLoadBalancerHandler_Update(t *testing.T) { ProxyProtocol: BoolToBoolPtr(false), PrivateNetwork: StringToStringPtr("8d5bdbdb-3324-4d0c-b303-03e1315e1c02"), VPC: StringToStringPtr("8d5bdbdb-3324-4d0c-b303-03e1315e1c02"), + Nodes: 5, HealthCheck: &HealthCheck{ Protocol: "http", Port: 80,