You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.
While working on #229, I noticed how many functions in ports.go are Device service helpers. These functions seem like good candidates for deprecation because they do not interact with the Ports API, they fetch devices and return properties of the device.
The code smell here is that these port service functions all include i.client.Device client calls and some of them mutate the supplied Device. Users that want these behaviors should use the API functions directly and not rely on these thin, misplaced, wrappers.
I will include the deprecation of these methods in this PR if others agree. The code in these functions could serve as Example tests for the functions they depend on.
Consider deprecating these functions which take a device id, fetch the device (with .Get) and return a property of device:
DevicePortServiceOp.GetAllEthPorts takes the supplied device, updates it via .Get, returns GetPhysicalPorts
DevicePortServiceOp.GetOddEthPorts same as GetAllEthPorts, except eth1 and eth3 only.
DevicePortServiceOp.DeviceToNetworkType takes the supplied device, updates it via .Get, returns DevicePortServiceOp.ConvertDevice using all supplied parameters
The text was updated successfully, but these errors were encountered:
While working on #229, I noticed how many functions in ports.go are Device service helpers. These functions seem like good candidates for deprecation because they do not interact with the Ports API, they fetch devices and return properties of the device.
The code smell here is that these port service functions all include
i.client.Device
client calls and some of them mutate the supplied Device. Users that want these behaviors should use the API functions directly and not rely on these thin, misplaced, wrappers.I will include the deprecation of these methods in this PR if others agree. The code in these functions could serve as Example tests for the functions they depend on.
Consider deprecating these functions which take a device id, fetch the device (with
.Get
) and return a property ofdevice
:DevicePortServiceOp.GetPortByName
returnsdevice.GetPortByName
DevicePortServiceOp.DeviceNetworkType
returnsdevice.GetNetworkType
DevicePortServiceOp.GetAllEthPorts
takes the supplied device, updates it via.Get
, returnsGetPhysicalPorts
DevicePortServiceOp.GetOddEthPorts
same asGetAllEthPorts
, except eth1 and eth3 only.DevicePortServiceOp.DeviceToNetworkType
takes the supplied device, updates it via.Get
, returnsDevicePortServiceOp.ConvertDevice
using all supplied parametersThe text was updated successfully, but these errors were encountered: