Skip to content

Commit

Permalink
add support for the type field when creating nodebalancers
Browse files Browse the repository at this point in the history
  • Loading branch information
eljohnson92 committed Feb 4, 2025
1 parent 2d64121 commit 7626a27
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions nodebalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ type NodeBalancer struct {
ClientConnThrottle int `json:"client_conn_throttle"`
// Information about the amount of transfer this NodeBalancer has had so far this month.
Transfer NodeBalancerTransfer `json:"transfer"`
// This NodeBalancer's plane Type
Type NodeBalancerPlanType `json:"type"`

// An array of tags applied to this object. Tags are for organizational purposes only.
Tags []string `json:"tags"`
Expand All @@ -52,6 +54,7 @@ type NodeBalancerCreateOptions struct {
Configs []*NodeBalancerConfigCreateOptions `json:"configs,omitempty"`
Tags []string `json:"tags"`
FirewallID int `json:"firewall_id,omitempty"`
Type NodeBalancerPlanType `json:"type,omitempty"`
}

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

// NodeBalancerPlanType constants start with NBType and include Linode API NodeBalancer's plan types
type NodeBalancerPlanType string

// NodeBalancerPlanType constants reflect the plan type used by a NodeBalancer Config
const (
NBTypePremium NodeBalancerPlanType = "premium"
NBTypeCommon NodeBalancerPlanType = "common"
)

// UnmarshalJSON implements the json.Unmarshaler interface
func (i *NodeBalancer) UnmarshalJSON(b []byte) error {
type Mask NodeBalancer
Expand Down Expand Up @@ -89,6 +101,7 @@ func (i NodeBalancer) GetCreateOptions() NodeBalancerCreateOptions {
Label: i.Label,
Region: i.Region,
ClientConnThrottle: &i.ClientConnThrottle,
Type: i.Type,
Tags: i.Tags,
}
}
Expand Down

0 comments on commit 7626a27

Please sign in to comment.