pub struct ConnectionSettings {
pub object_path: OwnedObjectPath,
pub id: Property<String>,
pub uuid: Property<String>,
pub connection_type: Property<ConnectionType>,
pub wifi_ssid: Property<Option<Ssid>>,
pub unsaved: Property<bool>,
pub flags: Property<NMConnectionSettingsFlags>,
pub filename: Property<String>,
/* private fields */
}Expand description
Connection Settings Profile.
Represents a single network connection configuration.
Fields§
§object_path: OwnedObjectPathD-Bus object path for this settings connection.
id: Property<String>Human-readable connection name (e.g. “Home WiFi”, “Wired connection 1”).
uuid: Property<String>Stable unique identifier for this connection profile.
connection_type: Property<ConnectionType>Network connection type.
wifi_ssid: Property<Option<Ssid>>WiFi SSID, if this is a wireless connection.
unsaved: Property<bool>Whether the in-memory state differs from the on-disk state.
flags: Property<NMConnectionSettingsFlags>Additional flags of the connection profile.
filename: Property<String>File that stores the connection in case the connection is file-backed.
Implementations§
Source§impl ConnectionSettings
impl ConnectionSettings
Sourcepub async fn update(
&self,
properties: HashMap<String, HashMap<String, OwnedValue>>,
) -> Result<(), Error>
pub async fn update( &self, properties: HashMap<String, HashMap<String, OwnedValue>>, ) -> Result<(), Error>
Update the connection with new settings and properties (replacing all previous settings and properties) and save the connection to disk. Secrets may be part of the update request, and will be either stored in persistent storage or sent to a Secret Agent for storage, depending on the flags associated with each secret.
§Errors
Returns NetworkError::OperationFailed if the update operation fails.
Sourcepub async fn update_unsaved(
&self,
properties: HashMap<String, HashMap<String, OwnedValue>>,
) -> Result<(), Error>
pub async fn update_unsaved( &self, properties: HashMap<String, HashMap<String, OwnedValue>>, ) -> Result<(), Error>
Update the connection without immediately saving to disk.
Update the connection with new settings and properties (replacing all previous settings and properties) but do not immediately save the connection to disk. Secrets may be part of the update request and may be sent to a Secret Agent for storage, depending on the flags associated with each secret. Use the ‘Save’ method to save these changes to disk. Note that unsaved changes will be lost if the connection is reloaded from disk (either automatically on file change or due to an explicit ReloadConnections call).
§Errors
Returns NetworkError::OperationFailed if the update operation fails.
Sourcepub async fn get_settings(
&self,
) -> Result<HashMap<String, HashMap<String, OwnedValue>>, Error>
pub async fn get_settings( &self, ) -> Result<HashMap<String, HashMap<String, OwnedValue>>, Error>
Get the settings maps describing this network configuration.
This will never include any secrets required for connection to the network, as those are often protected. Secrets must be requested separately using the GetSecrets() call.
§Errors
Returns NetworkError::OperationFailed if retrieving settings fails.
Sourcepub async fn get_secrets(
&self,
setting_name: &str,
) -> Result<HashMap<String, HashMap<String, OwnedValue>>, Error>
pub async fn get_secrets( &self, setting_name: &str, ) -> Result<HashMap<String, HashMap<String, OwnedValue>>, Error>
Get the secrets belonging to this network configuration.
Only secrets from persistent storage or a Secret Agent running in the requestor’s session will be returned. The user will never be prompted for secrets as a result of this request.
§Arguments
setting_name- Name of the setting to return secrets for. If empty, all secrets will be returned.
§Errors
Returns NetworkError::OperationFailed if retrieving secrets fails.
Sourcepub async fn clear_secrets(&self) -> Result<(), Error>
pub async fn clear_secrets(&self) -> Result<(), Error>
Clear the secrets belonging to this network connection profile.
§Errors
Returns NetworkError::OperationFailed if clearing secrets fails.
Sourcepub async fn save(&self) -> Result<(), Error>
pub async fn save(&self) -> Result<(), Error>
Saves a “dirty” connection to persistent storage.
Saves a connection (that had previously been updated with UpdateUnsaved) to persistent storage.
§Errors
Returns NetworkError::OperationFailed if saving fails.
Sourcepub async fn update2(
&self,
settings: HashMap<String, HashMap<String, OwnedValue>>,
flags: u32,
args: HashMap<String, OwnedValue>,
) -> Result<HashMap<String, OwnedValue>, Error>
pub async fn update2( &self, settings: HashMap<String, HashMap<String, OwnedValue>>, flags: u32, args: HashMap<String, OwnedValue>, ) -> Result<HashMap<String, OwnedValue>, Error>
Update the connection with new settings and properties.
Update2 is an alternative to Update, UpdateUnsaved and Save extensible with extra flags and args arguments.
§Arguments
settings- New connection settings, properties, and (optionally) secrets. Provide an empty HashMap to use the current settings.flags- Optional flags. Unknown flags cause the call to fail.- 0x1 (to-disk): The connection is persisted to disk.
- 0x2 (in-memory): The change is only made in memory.
- 0x4 (in-memory-detached): Like “in-memory”, but behaves slightly different when migrating.
- 0x8 (in-memory-only): Like “in-memory”, but behaves slightly different when migrating.
- 0x10 (volatile): Connection is volatile.
- 0x20 (block-autoconnect): Blocks auto-connect on the updated profile.
- 0x40 (no-reapply): Prevents “connection.zone” and “connection.metered” from taking effect on active devices.
args- Optional arguments dictionary. Accepts “plugin” and “version-id” keys.
§Errors
Returns NetworkError::OperationFailed if the update operation fails.
Sourcepub async fn properties_changed_signal(
&self,
) -> Result<impl Stream<Item = HashMap<String, OwnedValue>>, Error>
pub async fn properties_changed_signal( &self, ) -> Result<impl Stream<Item = HashMap<String, OwnedValue>>, Error>
Emitted when any property of any settings object within this Connection has changed.
§Errors
Returns error if D-Bus proxy creation fails.
Trait Implementations§
Source§impl Clone for ConnectionSettings
impl Clone for ConnectionSettings
Source§fn clone(&self) -> ConnectionSettings
fn clone(&self) -> ConnectionSettings
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more