Skip to content

Commit 41a199a

Browse files
authored
add support for the type field when creating nodebalancers (#669)
1 parent 4a29499 commit 41a199a

File tree

6 files changed

+529
-8
lines changed

6 files changed

+529
-8
lines changed

nodebalancer.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ type NodeBalancer struct {
2626
ClientConnThrottle int `json:"client_conn_throttle"`
2727
// Information about the amount of transfer this NodeBalancer has had so far this month.
2828
Transfer NodeBalancerTransfer `json:"transfer"`
29+
// This NodeBalancer's plan Type
30+
Type NodeBalancerPlanType `json:"type"`
2931

3032
// An array of tags applied to this object. Tags are for organizational purposes only.
3133
Tags []string `json:"tags"`
@@ -58,6 +60,7 @@ type NodeBalancerCreateOptions struct {
5860
Configs []*NodeBalancerConfigCreateOptions `json:"configs,omitempty"`
5961
Tags []string `json:"tags"`
6062
FirewallID int `json:"firewall_id,omitempty"`
63+
Type NodeBalancerPlanType `json:"type,omitempty"`
6164
VPCs []NodeBalancerVPCOptions `json:"vpcs,omitempty"`
6265
}
6366

@@ -68,6 +71,15 @@ type NodeBalancerUpdateOptions struct {
6871
Tags *[]string `json:"tags,omitempty"`
6972
}
7073

74+
// NodeBalancerPlanType constants start with NBType and include Linode API NodeBalancer's plan types
75+
type NodeBalancerPlanType string
76+
77+
// NodeBalancerPlanType constants reflect the plan type used by a NodeBalancer Config
78+
const (
79+
NBTypePremium NodeBalancerPlanType = "premium"
80+
NBTypeCommon NodeBalancerPlanType = "common"
81+
)
82+
7183
// UnmarshalJSON implements the json.Unmarshaler interface
7284
func (i *NodeBalancer) UnmarshalJSON(b []byte) error {
7385
type Mask NodeBalancer
@@ -96,6 +108,7 @@ func (i NodeBalancer) GetCreateOptions() NodeBalancerCreateOptions {
96108
Label: i.Label,
97109
Region: i.Region,
98110
ClientConnThrottle: &i.ClientConnThrottle,
111+
Type: i.Type,
99112
Tags: i.Tags,
100113
}
101114
}

0 commit comments

Comments
 (0)