File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,9 +98,33 @@ def linode(self):
9898
9999 if not hasattr (self , "_linode" ):
100100 self ._set ("_linode" , Instance (self ._client , self .linode_id ))
101+
101102 return self ._linode
102103
103- # TODO (Enhanced Interfaces): Add `interface` property method
104+ @property
105+ def interface (self ) -> Optional ["LinodeInterface" ]:
106+ """
107+ Returns the Linode Interface associated with this IP address.
108+
109+ NOTE: This function will only work with Linode-level interfaces.
110+
111+ :returns: The Linode Interface associated with this IP address.
112+ :rtype: LinodeInterface
113+ """
114+
115+ from .linode_interfaces import LinodeInterface # pylint: disable-all
116+
117+ if self .interface_id in (None , 0 ):
118+ self ._set ("_interface" , None )
119+ elif not hasattr (self , "_interface" ):
120+ self ._set (
121+ "_interface" ,
122+ LinodeInterface (
123+ self ._client , self .linode_id , self .interface_id
124+ ),
125+ )
126+
127+ return self ._interface
104128
105129 def to (self , linode ):
106130 """
You can’t perform that action at this time.
0 commit comments