File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 77 Base ,
88 Firewall ,
99 FirewallCreateDevicesOptions ,
10+ FirewallSettings ,
1011 Instance ,
1112 IPAddress ,
1213 IPv6Pool ,
@@ -111,6 +112,25 @@ def firewall_create(
111112 f = Firewall (self .client , result ["id" ], result )
112113 return f
113114
115+ def firewall_settings (self ) -> FirewallSettings :
116+ """
117+ Returns an object representing the Linode Firewall settings for the current user.
118+
119+ API Documentation: Not yet available.
120+
121+ :returns: An object representing the Linode Firewall settings for the current user.
122+ :rtype: FirewallSettings
123+ """
124+ result = self .client .get ("/networking/firewalls/settings" )
125+
126+ if "default_firewall_ids" not in result :
127+ raise UnexpectedResponseError (
128+ "Unexpected response when getting firewall settings!" ,
129+ json = result ,
130+ )
131+
132+ return FirewallSettings (self .client , None , result )
133+
114134 def ips (self , * filters ):
115135 """
116136 Returns a list of IP addresses on this account, excluding private addresses.
Original file line number Diff line number Diff line change @@ -186,6 +186,38 @@ class FirewallCreateDevicesOptions(JSONObject):
186186 interfaces : List [int ] = field (default_factory = list )
187187
188188
189+ class FirewallSettingsDefaultFirewallIDs (JSONObject ):
190+ """
191+ Contains the IDs of Linode Firewalls that should be used by default
192+ when creating various interface types.
193+ """
194+
195+ vpc_interface : int = 0
196+ public_interface : int = 0
197+ linode : int = 0
198+ nodebalancer : int = 0
199+
200+
201+ class FirewallSettings (Base ):
202+ """
203+ Represents the Firewall settings for the current user.
204+
205+ API Documentation: Not yet available.
206+ """
207+
208+ api_endpoint = "/networking/firewalls/settings"
209+
210+ # NOTE: This isn't used but is necessary when deriving from Base
211+ id_attributes = "default_firewall_ids"
212+
213+ properties = {
214+ "default_firewall_ids" : Property (
215+ json_object = FirewallSettingsDefaultFirewallIDs ,
216+ mutable = True ,
217+ ),
218+ }
219+
220+
189221class FirewallDevice (DerivedBase ):
190222 """
191223 An object representing the assignment between a Linode Firewall and another Linode resource.
You can’t perform that action at this time.
0 commit comments