Merge pull request #14 from paulburlumi/add_getconnectionbyuuid
settings: add GetConnectionByUUID method
This commit is contained in:
commit
37696d341d
1 changed files with 15 additions and 1 deletions
16
Settings.go
16
Settings.go
|
@ -10,7 +10,7 @@ const (
|
|||
|
||||
/* Methods */
|
||||
SettingsListConnections = SettingsInterface + ".ListConnections"
|
||||
SettingsGetConnectionByUuid = SettingsInterface + ".GetConnectionByUuid"
|
||||
SettingsGetConnectionByUUID = SettingsInterface + ".GetConnectionByUuid"
|
||||
SettingsAddConnection = SettingsInterface + ".AddConnection"
|
||||
SettingsAddConnectionUnsaved = SettingsInterface + ".AddConnectionUnsaved"
|
||||
SettingsLoadConnections = SettingsInterface + ".LoadConnections"
|
||||
|
@ -27,6 +27,9 @@ type Settings interface {
|
|||
// ListConnections gets list the saved network connections known to NetworkManager
|
||||
ListConnections() ([]Connection, error)
|
||||
|
||||
// GetConnectionByUUID gets the connection, given that connection's UUID.
|
||||
GetConnectionByUUID(uuid string) (Connection, error)
|
||||
|
||||
// AddConnection adds new connection and save it to disk.
|
||||
AddConnection(settings ConnectionSettings) (Connection, error)
|
||||
|
||||
|
@ -72,6 +75,17 @@ func (s *settings) ListConnections() ([]Connection, error) {
|
|||
return connections, nil
|
||||
}
|
||||
|
||||
// GetConnectionByUUID gets the connection, given that connection's UUID.
|
||||
func (s *settings) GetConnectionByUUID(uuid string) (Connection, error) {
|
||||
var path dbus.ObjectPath
|
||||
err := s.callWithReturn(&path, SettingsGetConnectionByUUID, uuid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return NewConnection(path)
|
||||
}
|
||||
|
||||
func (s *settings) AddConnection(settings ConnectionSettings) (Connection, error) {
|
||||
var path dbus.ObjectPath
|
||||
err := s.callWithReturn(&path, SettingsAddConnection, settings)
|
||||
|
|
Reference in a new issue