pub struct Settings {
pub connections: Property<Vec<ConnectionSettings>>,
pub hostname: Property<String>,
pub can_modify: Property<bool>,
pub version_id: Property<u64>,
/* private fields */
}Expand description
Connection Settings Profile Manager.
The Settings interface allows clients to view and administrate the connections stored and used by NetworkManager.
Fields§
§connections: Property<Vec<ConnectionSettings>>List of object paths of available network connection profiles.
hostname: Property<String>The machine hostname stored in persistent configuration.
can_modify: Property<bool>If true, adding and modifying connections is supported.
version_id: Property<u64>The version of the settings. This is incremented whenever the profile changes and can be used to detect concurrent modifications. Since: 1.44
Implementations§
Source§impl Settings
impl Settings
Sourcepub async fn list_connections(&self) -> Result<Vec<OwnedObjectPath>, Error>
pub async fn list_connections(&self) -> Result<Vec<OwnedObjectPath>, Error>
Sourcepub async fn get_connection_by_uuid(
&self,
uuid: &str,
) -> Result<OwnedObjectPath, Error>
pub async fn get_connection_by_uuid( &self, uuid: &str, ) -> Result<OwnedObjectPath, Error>
Sourcepub async fn add_connection(
&self,
connection: HashMap<String, HashMap<String, OwnedValue>>,
) -> Result<OwnedObjectPath, Error>
pub async fn add_connection( &self, connection: HashMap<String, HashMap<String, OwnedValue>>, ) -> Result<OwnedObjectPath, Error>
Add new connection and save it to disk.
This operation does not start the network connection unless (1) device is idle and able to connect to the network described by the new connection AND (2) the connection is allowed to be started automatically.
§Arguments
connection- Connection settings and properties.
§Returns
Object path of the new connection that was just added.
§Errors
Returns NetworkError::DbusError if the DBus operation fails.
Sourcepub async fn add_connection_unsaved(
&self,
connection: HashMap<String, HashMap<String, OwnedValue>>,
) -> Result<OwnedObjectPath, Error>
pub async fn add_connection_unsaved( &self, connection: HashMap<String, HashMap<String, OwnedValue>>, ) -> Result<OwnedObjectPath, Error>
Add new connection but do not save it to disk immediately.
This operation does not start the network connection unless (1) device is idle and able to connect to the network described by the new connection, and (2) the connection is allowed to be started automatically. Use the ‘Save’ method on the connection to save these changes to disk.
§Arguments
connection- Connection settings and properties.
§Returns
Object path of the new connection that was just added.
§Errors
Returns NetworkError::DbusError if the DBus operation fails.
Sourcepub async fn add_connection2(
&self,
settings: HashMap<String, HashMap<String, OwnedValue>>,
flags: NMSettingsAddConnection2Flags,
args: HashMap<String, OwnedValue>,
) -> Result<(OwnedObjectPath, HashMap<String, OwnedValue>), Error>
pub async fn add_connection2( &self, settings: HashMap<String, HashMap<String, OwnedValue>>, flags: NMSettingsAddConnection2Flags, args: HashMap<String, OwnedValue>, ) -> Result<(OwnedObjectPath, HashMap<String, OwnedValue>), Error>
Add a new connection profile.
AddConnection2 is an alternative to AddConnection and AddConnectionUnsaved. The new variant can do everything that the older variants could, and more. Its behavior is extensible via extra flags and args arguments.
§Arguments
settings- Connection configuration as nested hashmaps. The outer map keys are setting names like “connection”, “802-3-ethernet”, “ipv4”, etc. The inner maps contain the properties for each setting.flags- Control how the connection is stored:TO_DISK: Persist the connection to diskIN_MEMORY: Keep the connection in memory onlyBLOCK_AUTOCONNECT: Prevent automatic connection until manually activated
args- Additional arguments:"plugin": Specify storage backend like “keyfile” or “ifcfg-rh” (Since 1.38)
§Returns
Returns a tuple containing:
- The DBus object path of the newly created connection
- A result dictionary (currently empty but reserved for future use)
§Errors
Returns NetworkError::DbusError if the DBus operation fails.
Sourcepub async fn load_connections(
&self,
filenames: Vec<String>,
) -> Result<(bool, Vec<String>), Error>
pub async fn load_connections( &self, filenames: Vec<String>, ) -> Result<(bool, Vec<String>), Error>
Loads or reloads the indicated connections from disk.
You should call this after making changes directly to an on-disk connection file to make sure that NetworkManager sees the changes. As with AddConnection(), this operation does not necessarily start the network connection.
§Arguments
filenames- Array of paths to on-disk connection profiles in directories monitored by NetworkManager
§Returns
Returns a tuple containing:
status: Success or failure of the operation as a whole. True if NetworkManager at least tried to load the indicated connections, even if it did not succeed. False if an error occurred before trying to load the connections (eg, permission denied).failures: Paths of connection files that could not be loaded
§Errors
Returns NetworkError::DbusError if the DBus operation fails.
Sourcepub async fn reload_connections(&self) -> Result<bool, Error>
pub async fn reload_connections(&self) -> Result<bool, Error>
Sourcepub fn connections_for_ssid(&self, ssid: &Ssid) -> Vec<ConnectionSettings>
pub fn connections_for_ssid(&self, ssid: &Ssid) -> Vec<ConnectionSettings>
Saved connection profiles matching the given SSID.
A single SSID may have multiple profiles with different configurations.
Sourcepub async fn delete_connections_for_ssid(&self, ssid: &Ssid)
pub async fn delete_connections_for_ssid(&self, ssid: &Ssid)
Deletes all saved connection profiles for the given SSID.
Individual profile deletion errors are logged but do not stop remaining deletions.
Sourcepub fn connections_for_ssid_monitored(
&self,
ssid: Ssid,
) -> impl Stream<Item = Vec<ConnectionSettings>> + '_
pub fn connections_for_ssid_monitored( &self, ssid: Ssid, ) -> impl Stream<Item = Vec<ConnectionSettings>> + '_
Reactive stream of saved connections for the given SSID.
Emits whenever connections are added, removed, or modified for the specified SSID.
Sourcepub async fn new_connection_signal(
&self,
) -> Result<impl Stream<Item = OwnedObjectPath>, Error>
pub async fn new_connection_signal( &self, ) -> Result<impl Stream<Item = OwnedObjectPath>, Error>
Sourcepub async fn connection_removed_signal(
&self,
) -> Result<impl Stream<Item = OwnedObjectPath>, Error>
pub async fn connection_removed_signal( &self, ) -> Result<impl Stream<Item = OwnedObjectPath>, Error>
Emitted when a connection is no longer available.
§Errors
Returns error if D-Bus proxy creation fails.