|
2 | 2 | from typing import List, Optional
|
3 | 3 |
|
4 | 4 | from linode_api4.objects.base import Base, Property
|
| 5 | +from linode_api4.objects.networking import Firewall |
5 | 6 | from linode_api4.objects.serializable import JSONObject
|
6 | 7 |
|
7 | 8 |
|
@@ -169,13 +170,39 @@ class LinodeInterface(Base):
|
169 | 170 | parent_id_name = "linode_id"
|
170 | 171 |
|
171 | 172 | properties = {
|
| 173 | + "linode_id": Property(identifier=True), |
172 | 174 | "id": Property(identifier=True),
|
173 | 175 | "mac_address": Property(),
|
174 | 176 | "created": Property(is_datetime=True),
|
175 | 177 | "updated": Property(is_datetime=True),
|
176 | 178 | "version": Property(),
|
177 |
| - "default_route": Property(json_object=LinodeInterfaceDefaultRoute), |
178 |
| - "public": Property(json_object=LinodeInterfacePublic), |
179 |
| - "vlan": Property(json_object=LinodeInterfaceVLAN), |
180 |
| - "vpc": Property(json_object=LinodeInterfaceVPC), |
| 179 | + "default_route": Property( |
| 180 | + mutable=True, json_object=LinodeInterfaceDefaultRoute |
| 181 | + ), |
| 182 | + "public": Property(mutable=True, json_object=LinodeInterfacePublic), |
| 183 | + "vlan": Property(mutable=True, json_object=LinodeInterfaceVLAN), |
| 184 | + "vpc": Property(mutable=True, json_object=LinodeInterfaceVPC), |
181 | 185 | }
|
| 186 | + |
| 187 | + def firewalls(self, *filters) -> List[Firewall]: |
| 188 | + """ |
| 189 | + Retrieves a list of Firewalls for this Linode Interface. |
| 190 | +
|
| 191 | + :param filters: Any number of filters to apply to this query. |
| 192 | + See :doc:`Filtering Collections</linode_api4/objects/filtering>` |
| 193 | + for more details on filtering. |
| 194 | +
|
| 195 | + :returns: A List of Firewalls for this Linode Interface. |
| 196 | + :rtype: List[Firewall] |
| 197 | +
|
| 198 | + NOTE: Caching is disabled on this method and each call will make |
| 199 | + an additional Linode API request. |
| 200 | + """ |
| 201 | + |
| 202 | + return self._client._get_and_filter( |
| 203 | + Firewall, |
| 204 | + *filters, |
| 205 | + endpoint="{}/firewalls".format(LinodeInterface.api_endpoint).format( |
| 206 | + **vars(self) |
| 207 | + ), |
| 208 | + ) |
0 commit comments