From 5c25f8b28d3a9515af640ae89db51e9c9b3fa247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=BCller?= Date: Thu, 16 May 2019 16:42:06 +0200 Subject: [PATCH] Add Device.Managed --- Device.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Device.go b/Device.go index e74f86d..83a5ee3 100644 --- a/Device.go +++ b/Device.go @@ -13,6 +13,7 @@ const ( DevicePropertyInterface = DeviceInterface + ".Interface" DevicePropertyIpInterface = DeviceInterface + ".IpInterface" DevicePropertyState = DeviceInterface + ".State" + DevicePropertyManaged = DeviceInterface + ".Managed" DevicePropertyIP4Config = DeviceInterface + ".Ip4Config" DevicePropertyDeviceType = DeviceInterface + ".DeviceType" DevicePropertyAvailableConnections = DeviceInterface + ".AvailableConnections" @@ -77,6 +78,12 @@ type Device interface { // connection that is currently 'available' through this device. GetAvailableConnections() []Connection + // Whether or not this device is managed by NetworkManager. Setting this property + // has a similar effect to configuring the device as unmanaged via the + // keyfile.unmanaged-devices setting in NetworkManager.conf. Changes to this value + // are not persistent and lost after NetworkManager restart. + GetManaged() bool + MarshalJSON() ([]byte, error) } @@ -156,6 +163,10 @@ func (d *device) GetAvailableConnections() []Connection { return conns } +func (d *device) GetManaged() bool { + return d.getBoolProperty(DevicePropertyManaged) +} + func (d *device) marshalMap() map[string]interface{} { return map[string]interface{}{ "Interface": d.GetInterface(),