Skip to content

Commit 9e9e422

Browse files
committed
add support for the type field when creating nodebalancers
1 parent 2d64121 commit 9e9e422

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
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 plane 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"`
@@ -52,6 +54,7 @@ type NodeBalancerCreateOptions struct {
5254
Configs []*NodeBalancerConfigCreateOptions `json:"configs,omitempty"`
5355
Tags []string `json:"tags"`
5456
FirewallID int `json:"firewall_id,omitempty"`
57+
Type NodeBalancerPlanType `json:"type,omitempty"`
5558
}
5659

5760
// NodeBalancerUpdateOptions are the options permitted for UpdateNodeBalancer
@@ -61,6 +64,15 @@ type NodeBalancerUpdateOptions struct {
6164
Tags *[]string `json:"tags,omitempty"`
6265
}
6366

67+
// NodeBalancerPlanType constants start with NBType and include Linode API Nodebalancer plan types
68+
type NodeBalancerPlanType string
69+
70+
// NodeBalancerPlanType constants reflect the plan type used by a NodeBalancer Config
71+
const (
72+
NBTypePremium NodeBalancerPlanType = "premium"
73+
NBTypeCommon NodeBalancerPlanType = "common"
74+
)
75+
6476
// UnmarshalJSON implements the json.Unmarshaler interface
6577
func (i *NodeBalancer) UnmarshalJSON(b []byte) error {
6678
type Mask NodeBalancer
@@ -89,6 +101,7 @@ func (i NodeBalancer) GetCreateOptions() NodeBalancerCreateOptions {
89101
Label: i.Label,
90102
Region: i.Region,
91103
ClientConnThrottle: &i.ClientConnThrottle,
104+
Type: i.Type,
92105
Tags: i.Tags,
93106
}
94107
}

0 commit comments

Comments
 (0)