Skip to content

Commit

Permalink
add user_given_name param for loadbalancers
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandroargentieri committed Feb 28, 2024
1 parent 3bcf93a commit ac466a5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type LoadBalancerBackendConfig struct {
type LoadBalancer struct {
ID string `json:"id"`
Name string `json:"name"`
UserGivenName string `json:"user_given_name,omitempty"`
Algorithm string `json:"algorithm"`
Backends []LoadBalancerBackend `json:"backends"`
ExternalTrafficPolicy string `json:"external_traffic_policy,omitempty"`
Expand All @@ -51,6 +52,7 @@ type LoadBalancer struct {
type LoadBalancerConfig struct {
Region string `json:"region"`
Name string `json:"name"`
UserGivenName string `json:"user_given_name,omitempty"`
NetworkID string `json:"network_id,omitempty"`
Algorithm string `json:"algorithm,omitempty"`
Backends []LoadBalancerBackendConfig `json:"backends"`
Expand All @@ -75,6 +77,7 @@ type LoadBalancerOptions struct {
type LoadBalancerUpdateConfig struct {
Region string `json:"region"`
Name string `json:"name,omitempty"`
UserGivenName string `json:"user_given_name,omitempty"`
Algorithm string `json:"algorithm,omitempty"`
Backends []LoadBalancerBackendConfig `json:"backends,omitempty"`
ExternalTrafficPolicy string `json:"external_traffic_policy,omitempty"`
Expand Down
14 changes: 10 additions & 4 deletions loadbalancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ func TestCreateLoadBalancer(t *testing.T) {
client, server, _ := NewClientForTesting(map[string]string{
"/v2/loadbalancers": `{
"id": "56dca3ae-ea3f-480f-9b25-abf90b439729",
"name": "test-lb",
"name": "test-default-lb",
"user_given_name": "lb",
"network_id": "b064d568-5869-427c-827a-77d48cde6a2e",
"algorithm": "round_robin",
"backends": [
Expand Down Expand Up @@ -142,9 +143,10 @@ func TestCreateLoadBalancer(t *testing.T) {
}

expected := &LoadBalancer{
ID: "56dca3ae-ea3f-480f-9b25-abf90b439729",
Name: "test-lb",
Algorithm: "round_robin",
ID: "56dca3ae-ea3f-480f-9b25-abf90b439729",
Name: "test-default-lb",
UserGivenName: "lb",
Algorithm: "round_robin",
Backends: []LoadBalancerBackend{
{
IP: "192.168.1.3",
Expand Down Expand Up @@ -172,6 +174,7 @@ func TestUpdateLoadBalancer(t *testing.T) {
"/v2/loadbalancers/a1bd123c-b7e2-4d4f-9fda-7940c7e06b38": `{
"id": "a1bd123c-b7e2-4d4f-9fda-7940c7e06b38",
"name": "test-lb-updated",
"user_given_name": "updated",
"network_id": "b064d568-5869-427c-827a-77d48cde6a2e",
"algorithm": "round_robin",
"external_traffic_policy": "Cluster",
Expand Down Expand Up @@ -206,6 +209,7 @@ func TestUpdateLoadBalancer(t *testing.T) {
expected := &LoadBalancer{
ID: "a1bd123c-b7e2-4d4f-9fda-7940c7e06b38",
Name: "test-lb-updated",
UserGivenName: "updated",
Algorithm: "round_robin",
ExternalTrafficPolicy: "Cluster",
Backends: []LoadBalancerBackend{
Expand Down Expand Up @@ -235,6 +239,7 @@ func TestGetLoadBalancer(t *testing.T) {
"/v2/loadbalancers/a1bd123c-b7e2-4d4f-9fda-7940c7e06b38": `{
"id": "a1bd123c-b7e2-4d4f-9fda-7940c7e06b38",
"name": "test-lb-updated",
"user_given_name": "updated",
"network_id": "b064d568-5869-427c-827a-77d48cde6a2e",
"algorithm": "round_robin",
"external_traffic_policy": "Cluster",
Expand Down Expand Up @@ -266,6 +271,7 @@ func TestGetLoadBalancer(t *testing.T) {
expected := &LoadBalancer{
ID: "a1bd123c-b7e2-4d4f-9fda-7940c7e06b38",
Name: "test-lb-updated",
UserGivenName: "updated",
Algorithm: "round_robin",
ExternalTrafficPolicy: "Cluster",
Backends: []LoadBalancerBackend{
Expand Down

0 comments on commit ac466a5

Please sign in to comment.