Class: NetworkManager::DBus::SettingsConnection
- Inherits:
-
Object
- Object
- NetworkManager::DBus::SettingsConnection
show all
- Includes:
- DBusInterface::Object
- Defined in:
- lib/network_manager/dbus/settings_connection.rb
Defined Under Namespace
Classes: SecretsCacheInvalidError
Constant Summary
collapse
- HW_TYPE_ETHERNET =
'802-3-ethernet'
- HW_TYPE_WIRELESS =
'802-11-wireless'
- HW_TYPE_BLUETOOTH =
'bluetooth'
- SW_TYPE_VPN =
'vpn'
- SW_TYPE_BRIDGE =
'bridge'
- IPV4_METHOD_AUTO =
'auto'
- IPV4_METHOD_MANUAL =
'manual'
Instance Method Summary
collapse
#[], #call, included, #initialize, #object_path, #object_path=, #properties, #to_s
Instance Method Details
#delete ⇒ Object
18
19
20
|
# File 'lib/network_manager/dbus/settings_connection.rb', line 18
def delete
call('Delete')
end
|
#ip4=(ip4) ⇒ Object
58
59
60
61
62
|
# File 'lib/network_manager/dbus/settings_connection.rb', line 58
def ip4=(ip4)
hash = settings
hash['ipv4'] = ip4
update(hash)
end
|
#ip4_auto! ⇒ Object
64
65
66
|
# File 'lib/network_manager/dbus/settings_connection.rb', line 64
def ip4_auto!
self.ip4 = {'method' => IPV4_METHOD_AUTO}
end
|
#ip4_manual=(addresses) ⇒ Object
68
69
70
71
72
73
74
75
76
|
# File 'lib/network_manager/dbus/settings_connection.rb', line 68
def ip4_manual=(addresses)
addresses = [addresses] unless addresses.is_a? Array
self.ip4 = {
'method' => IPV4_METHOD_MANUAL,
'addresses' => ['aau', addresses.map{|a| a.to_nm_au}]
}
end
|
#name ⇒ Object
28
29
30
|
# File 'lib/network_manager/dbus/settings_connection.rb', line 28
def name
settings['connection']['id']
end
|
#name=(new_id) ⇒ Object
48
49
50
51
52
53
|
# File 'lib/network_manager/dbus/settings_connection.rb', line 48
def name=(new_id)
hash = settings
hash['connection']['id'] = new_id
hash.delete 'ipv4'
update(hash)
end
|
#secrets(name = '') ⇒ Object
22
23
24
25
26
|
# File 'lib/network_manager/dbus/settings_connection.rb', line 22
def secrets(name = '')
call('GetSecrets', name)
rescue DBus::Error => e
raise SecretsCacheInvalidError.new("Secrets cache invalid (#{e})")
end
|
#settings ⇒ Object
14
15
16
|
# File 'lib/network_manager/dbus/settings_connection.rb', line 14
def settings
call('GetSettings').first
end
|
#type ⇒ Object
36
37
38
|
# File 'lib/network_manager/dbus/settings_connection.rb', line 36
def type
settings['connection']['type']
end
|
#update(hash) ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/network_manager/dbus/settings_connection.rb', line 40
def update(hash)
new_settings = hash.dup
unless new_settings.has_key? 'connection'
new_settings.merge!(settings)
end
call('Update', new_settings)
end
|
#uuid ⇒ Object
32
33
34
|
# File 'lib/network_manager/dbus/settings_connection.rb', line 32
def uuid
settings['connection']['uuid']
end
|