Skip to content

Commit

Permalink
Added CheckRegions field to LoadBalancerPool (#162)
Browse files Browse the repository at this point in the history
* Added CheckRegions field to LoadBalancerPool

* Fixed TestCreateLoadBalancerPool to wirk with check_regions

* Fixed TestDeleteLoadBalancerPool to wirk with check_regions

* Added documentation for the CheckRegions field in LoadBalancerPool
  • Loading branch information
FnuGk authored and elithrar committed Feb 16, 2018
1 parent 4155500 commit 07e73e2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
4 changes: 4 additions & 0 deletions load_balancing.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ type LoadBalancerPool struct {
Monitor string `json:"monitor,omitempty"`
Origins []LoadBalancerOrigin `json:"origins"`
NotificationEmail string `json:"notification_email,omitempty"`

// CheckRegions defines the geographic region(s) from where to run health-checks from - e.g. "WNAM", "WEU", "SAF", "SAM".
// Providing a null/empty value means "all regions", which may not be available to all plan types.
CheckRegions []string `json:"check_regions"`
}

type LoadBalancerOrigin struct {
Expand Down
32 changes: 28 additions & 4 deletions load_balancing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ func TestCreateLoadBalancerPool(t *testing.T) {
"enabled": true
}
],
"notification_email": "[email protected]"
"notification_email": "[email protected]",
"check_regions": [
"WEU"
]
}`, string(b))
}
fmt.Fprint(w, `{
Expand All @@ -54,7 +57,10 @@ func TestCreateLoadBalancerPool(t *testing.T) {
"enabled": true
}
],
"notification_email": "[email protected]"
"notification_email": "[email protected]",
"check_regions": [
"WEU"
]
}
}`)
}
Expand All @@ -78,6 +84,9 @@ func TestCreateLoadBalancerPool(t *testing.T) {
},
},
NotificationEmail: "[email protected]",
CheckRegions: []string{
"WEU",
},
}
request := LoadBalancerPool{
Description: "Primary data center - Provider XYZ",
Expand All @@ -92,6 +101,9 @@ func TestCreateLoadBalancerPool(t *testing.T) {
},
},
NotificationEmail: "[email protected]",
CheckRegions: []string{
"WEU",
},
}

actual, err := client.CreateLoadBalancerPool(request)
Expand Down Expand Up @@ -273,7 +285,10 @@ func TestModifyLoadBalancerPool(t *testing.T) {
"enabled": false
}
],
"notification_email": "[email protected]"
"notification_email": "[email protected]",
"check_regions": [
"WEU"
]
}`, string(b))
}
fmt.Fprint(w, `{
Expand All @@ -294,7 +309,10 @@ func TestModifyLoadBalancerPool(t *testing.T) {
"enabled": false
}
],
"notification_email": "[email protected]"
"notification_email": "[email protected]",
"check_regions": [
"WEU"
]
}
}`)
}
Expand All @@ -317,6 +335,9 @@ func TestModifyLoadBalancerPool(t *testing.T) {
},
},
NotificationEmail: "[email protected]",
CheckRegions: []string{
"WEU",
},
}
request := LoadBalancerPool{
ID: "17b5962d775c646f3f9725cbc7a53df4",
Expand All @@ -331,6 +352,9 @@ func TestModifyLoadBalancerPool(t *testing.T) {
},
},
NotificationEmail: "[email protected]",
CheckRegions: []string{
"WEU",
},
}

actual, err := client.ModifyLoadBalancerPool(request)
Expand Down

0 comments on commit 07e73e2

Please sign in to comment.