@@ -33,6 +33,7 @@ type Firewall struct {
3333type DevicesCreationOptions struct {
3434 Linodes []int `json:"linodes,omitempty"`
3535 NodeBalancers []int `json:"nodebalancers,omitempty"`
36+ Interfaces []int `json:"interfaces,omitempty"`
3637}
3738
3839// FirewallCreateOptions fields are those accepted by CreateFirewall
@@ -50,6 +51,31 @@ type FirewallUpdateOptions struct {
5051 Tags * []string `json:"tags,omitempty"`
5152}
5253
54+ // FirewallSettings represents the default firewalls for Linodes,
55+ // Linode VPC and public interfaces, and NodeBalancers.
56+ type FirewallSettings struct {
57+ DefaultFirewallIDs DefaultFirewallIDs `json:"default_firewall_ids"`
58+ }
59+
60+ type DefaultFirewallIDs struct {
61+ Linode int `json:"linode"`
62+ NodeBalancer int `json:"nodebalancer"`
63+ PublicInterface int `json:"public_interface"`
64+ VPCInterface int `json:"vpc_interface"`
65+ }
66+
67+ // FirewallSettingsUpdateOptions is an options struct used when Updating FirewallSettings
68+ type FirewallSettingsUpdateOptions struct {
69+ DefaultFirewallIDs DefaultFirewallIDsOptions `json:"default_firewall_ids"`
70+ }
71+
72+ type DefaultFirewallIDsOptions struct {
73+ Linode * int `json:"linode,omitempty"`
74+ NodeBalancer * int `json:"nodebalancer,omitempty"`
75+ PublicInterface * int `json:"public_interface,omitempty"`
76+ VPCInterface * int `json:"vpc_interface,omitempty"`
77+ }
78+
5379// GetUpdateOptions converts a Firewall to FirewallUpdateOptions for use in Client.UpdateFirewall.
5480func (f * Firewall ) GetUpdateOptions () FirewallUpdateOptions {
5581 return FirewallUpdateOptions {
@@ -107,3 +133,13 @@ func (c *Client) DeleteFirewall(ctx context.Context, firewallID int) error {
107133 e := formatAPIPath ("networking/firewalls/%d" , firewallID )
108134 return doDELETERequest (ctx , c , e )
109135}
136+
137+ // GetFirewallSettings returns default firewalls for Linodes, Linode VPC and public interfaces, and NodeBalancers.
138+ func (c * Client ) GetFirewallSettings (ctx context.Context ) (* FirewallSettings , error ) {
139+ return doGETRequest [FirewallSettings ](ctx , c , "networking/firewalls/settings" )
140+ }
141+
142+ // UpdateFirewallSettings updates the default firewalls for Linodes, Linode VPC and public interfaces, and NodeBalancers.
143+ func (c * Client ) UpdateFirewallSettings (ctx context.Context , opts FirewallSettingsUpdateOptions ) (* FirewallSettings , error ) {
144+ return doPUTRequest [FirewallSettings ](ctx , c , "networking/firewalls/settings" , opts )
145+ }
0 commit comments