pub trait SzConfig {
// Required methods
fn export(&self) -> SzResult<JsonString>;
fn get_data_source_registry(&self) -> SzResult<JsonString>;
fn register_data_source(
&self,
data_source_code: &str,
) -> SzResult<JsonString>;
fn unregister_data_source(&self, data_source_code: &str) -> SzResult<()>;
}Expand description
Configuration management operations.
The SzConfig trait provides methods for managing Senzing configuration data,
including data source registration and configuration export.
§Obtaining an Instance
Configuration instances are obtained through SzConfigManager:
use sz_rust_sdk::prelude::*;
let config_mgr = env.get_config_manager()?;
let config = config_mgr.create_config()?;Required Methods§
Sourcefn export(&self) -> SzResult<JsonString>
fn export(&self) -> SzResult<JsonString>
Exports the complete configuration as JSON.
Returns the full configuration definition that can be saved, modified, or registered as a new configuration version.
§Returns
JSON string containing the complete configuration.
§Examples
use sz_rust_sdk::prelude::*;
let config_mgr = env.get_config_manager()?;
let config = config_mgr.create_config()?;
let json = config.export()?;
assert!(!json.is_empty());Sourcefn get_data_source_registry(&self) -> SzResult<JsonString>
fn get_data_source_registry(&self) -> SzResult<JsonString>
Gets the data source registry.
Returns information about all registered data sources in this configuration.
§Returns
JSON string with array of data source definitions including codes and IDs.
§Examples
use sz_rust_sdk::prelude::*;
let config_mgr = env.get_config_manager()?;
let config = config_mgr.create_config()?;
let registry = config.get_data_source_registry()?;
println!("Data sources: {}", registry);Sourcefn register_data_source(&self, data_source_code: &str) -> SzResult<JsonString>
fn register_data_source(&self, data_source_code: &str) -> SzResult<JsonString>
Registers a new data source.
Adds a data source to the configuration. Data sources must be registered before records can be added from that source.
§Arguments
data_source_code- Unique identifier for the data source (e.g., “CUSTOMERS”, “WATCHLIST”)
§Returns
JSON string with the registered data source details including assigned ID.
§Examples
use sz_rust_sdk::prelude::*;
let config_mgr = env.get_config_manager()?;
let config = config_mgr.create_config()?;
let result = config.register_data_source("VENDORS")?;
println!("Registered: {}", result);
// Clean up by unregistering
config.unregister_data_source("VENDORS")?;§Errors
SzError::BadInput- Data source code is invalid or already exists
Sourcefn unregister_data_source(&self, data_source_code: &str) -> SzResult<()>
fn unregister_data_source(&self, data_source_code: &str) -> SzResult<()>
Removes a data source from the configuration.
Unregisters a data source. This should only be done if no records exist from that data source.
§Arguments
data_source_code- The data source identifier to remove
§Examples
use sz_rust_sdk::prelude::*;
let config_mgr = env.get_config_manager()?;
let config = config_mgr.create_config()?;
config.unregister_data_source("TEMP_SOURCE")?;§Errors
SzError::BadInput- Data source does not exist