pub struct RedfishClient { /* private fields */ }Expand description
Async Redfish client for BMC management.
Implementations§
Source§impl RedfishClient
impl RedfishClient
Sourcepub fn builder(host: &str) -> RedfishClientBuilder
pub fn builder(host: &str) -> RedfishClientBuilder
Create a builder for configuring a RedfishClient.
Sourcepub fn new(host: &str, username: &str, password: &str) -> Result<Self>
pub fn new(host: &str, username: &str, password: &str) -> Result<Self>
Create a new Redfish client.
host can be IP or hostname. Uses HTTPS by default.
Sourcepub fn set_session(&mut self, token: &str, session_uri: &str)
pub fn set_session(&mut self, token: &str, session_uri: &str)
Inject an existing session token and URI.
Sourcepub fn session_token(&self) -> Option<&str>
pub fn session_token(&self) -> Option<&str>
Get the current session token, if any.
Sourcepub fn session_uri(&self) -> Option<&str>
pub fn session_uri(&self) -> Option<&str>
Get the current session URI, if any.
Sourcepub async fn login(&mut self) -> Result<()>
pub async fn login(&mut self) -> Result<()>
Establish a Redfish session (POST to SessionService).
Sourcepub async fn get(&self, path: &str) -> Result<Value>
pub async fn get(&self, path: &str) -> Result<Value>
GET a Redfish resource by path (e.g. “/redfish/v1/Systems”).
Sourcepub async fn get_as<T: DeserializeOwned>(&self, path: &str) -> Result<T>
pub async fn get_as<T: DeserializeOwned>(&self, path: &str) -> Result<T>
GET and deserialize into a typed struct.
Sourcepub async fn post(&self, path: &str, body: &Value) -> Result<Value>
pub async fn post(&self, path: &str, body: &Value) -> Result<Value>
POST an action (e.g. Reset).
Sourcepub async fn patch(&self, path: &str, body: &Value) -> Result<Value>
pub async fn patch(&self, path: &str, body: &Value) -> Result<Value>
PATCH a resource (update properties).
If the server returns 412 (Precondition Required), automatically retries
with an ETag by doing a GET first. This handles AMI and OpenBMC style BMCs
that require If-Match headers.
Sourcepub async fn patch_with_etag(&self, path: &str, body: &Value) -> Result<Value>
pub async fn patch_with_etag(&self, path: &str, body: &Value) -> Result<Value>
PATCH a resource with explicit ETag handling.
Performs a GET to retrieve the current ETag, then PATCHes with
the If-Match header. Required by some BMCs (AMI, OpenBMC).
Sourcepub async fn get_service_root(&self) -> Result<ServiceRoot>
pub async fn get_service_root(&self) -> Result<ServiceRoot>
Get Service Root.
Sourcepub async fn list_systems(&self) -> Result<Collection>
pub async fn list_systems(&self) -> Result<Collection>
List all computer systems.
Sourcepub async fn get_system(&self, id: &str) -> Result<ComputerSystem>
pub async fn get_system(&self, id: &str) -> Result<ComputerSystem>
Get a specific system by ID.
Sourcepub async fn list_chassis(&self) -> Result<Collection>
pub async fn list_chassis(&self) -> Result<Collection>
List all chassis.
Sourcepub async fn get_chassis(&self, id: &str) -> Result<Chassis>
pub async fn get_chassis(&self, id: &str) -> Result<Chassis>
Get a specific chassis by ID.
Sourcepub async fn list_managers(&self) -> Result<Collection>
pub async fn list_managers(&self) -> Result<Collection>
List all managers (BMCs).
Sourcepub async fn get_manager(&self, id: &str) -> Result<Manager>
pub async fn get_manager(&self, id: &str) -> Result<Manager>
Get a specific manager by ID.
Sourcepub async fn get_thermal(&self, chassis_id: &str) -> Result<Thermal>
pub async fn get_thermal(&self, chassis_id: &str) -> Result<Thermal>
Get thermal info for a chassis.
Sourcepub async fn list_processors(&self, system_id: &str) -> Result<Collection>
pub async fn list_processors(&self, system_id: &str) -> Result<Collection>
List processors for a system.
Sourcepub async fn get_processor(
&self,
system_id: &str,
proc_id: &str,
) -> Result<Processor>
pub async fn get_processor( &self, system_id: &str, proc_id: &str, ) -> Result<Processor>
Get a specific processor.
Sourcepub async fn list_memory(&self, system_id: &str) -> Result<Collection>
pub async fn list_memory(&self, system_id: &str) -> Result<Collection>
List memory for a system.
Sourcepub async fn get_memory(&self, system_id: &str, mem_id: &str) -> Result<Memory>
pub async fn get_memory(&self, system_id: &str, mem_id: &str) -> Result<Memory>
Get a specific memory module.
Sourcepub async fn list_storage(&self, system_id: &str) -> Result<Collection>
pub async fn list_storage(&self, system_id: &str) -> Result<Collection>
List storage for a system.
Sourcepub async fn get_storage(
&self,
system_id: &str,
storage_id: &str,
) -> Result<Storage>
pub async fn get_storage( &self, system_id: &str, storage_id: &str, ) -> Result<Storage>
Get a specific storage resource.
Sourcepub async fn list_ethernet_interfaces(
&self,
system_id: &str,
) -> Result<Collection>
pub async fn list_ethernet_interfaces( &self, system_id: &str, ) -> Result<Collection>
List ethernet interfaces for a system.
Sourcepub async fn get_ethernet_interface(
&self,
system_id: &str,
iface_id: &str,
) -> Result<EthernetInterface>
pub async fn get_ethernet_interface( &self, system_id: &str, iface_id: &str, ) -> Result<EthernetInterface>
Get a specific ethernet interface.
Sourcepub async fn get_account_service(&self) -> Result<AccountService>
pub async fn get_account_service(&self) -> Result<AccountService>
Get account service.
Sourcepub async fn list_accounts(&self) -> Result<Collection>
pub async fn list_accounts(&self) -> Result<Collection>
List user accounts.
Sourcepub async fn get_update_service(&self) -> Result<UpdateService>
pub async fn get_update_service(&self) -> Result<UpdateService>
Get update service.
Sourcepub async fn get_event_service(&self) -> Result<EventService>
pub async fn get_event_service(&self) -> Result<EventService>
Get event service.
Sourcepub async fn list_log_entries(
&self,
manager_id: &str,
log_id: &str,
) -> Result<Collection>
pub async fn list_log_entries( &self, manager_id: &str, log_id: &str, ) -> Result<Collection>
List log entries for a manager.
Sourcepub async fn reset_system(
&self,
system_id: &str,
reset_type: &str,
) -> Result<Value>
pub async fn reset_system( &self, system_id: &str, reset_type: &str, ) -> Result<Value>
Reset/power control a system. reset_type: “On”, “ForceOff”, “GracefulShutdown”, “GracefulRestart”, “ForceRestart”, “Nmi”, “ForceOn”, “PushPowerButton”, “PowerCycle”
Sourcepub async fn graceful_shutdown(&self, system_id: &str) -> Result<Value>
pub async fn graceful_shutdown(&self, system_id: &str) -> Result<Value>
Graceful shutdown.
Sourcepub async fn graceful_restart(&self, system_id: &str) -> Result<Value>
pub async fn graceful_restart(&self, system_id: &str) -> Result<Value>
Graceful restart.
Sourcepub async fn force_restart(&self, system_id: &str) -> Result<Value>
pub async fn force_restart(&self, system_id: &str) -> Result<Value>
Force restart.
Sourcepub async fn power_cycle(&self, system_id: &str) -> Result<Value>
pub async fn power_cycle(&self, system_id: &str) -> Result<Value>
Power cycle.
Sourcepub async fn set_boot_override(
&self,
system_id: &str,
target: &str,
enabled: Option<&str>,
) -> Result<Value>
pub async fn set_boot_override( &self, system_id: &str, target: &str, enabled: Option<&str>, ) -> Result<Value>
Set boot source override. target: “None”, “Pxe”, “Cd”, “Usb”, “Hdd”, “BiosSetup”, “Diags” enabled: “Once”, “Continuous”, “Disabled”
Sourcepub async fn set_boot_pxe(&self, system_id: &str) -> Result<Value>
pub async fn set_boot_pxe(&self, system_id: &str) -> Result<Value>
Set next boot to PXE.
Sourcepub async fn set_boot_bios(&self, system_id: &str) -> Result<Value>
pub async fn set_boot_bios(&self, system_id: &str) -> Result<Value>
Set next boot to BIOS Setup.
Sourcepub async fn reset_manager(
&self,
manager_id: &str,
reset_type: &str,
) -> Result<Value>
pub async fn reset_manager( &self, manager_id: &str, reset_type: &str, ) -> Result<Value>
Reset a manager (BMC).
Sourcepub async fn clear_log(&self, manager_id: &str, log_id: &str) -> Result<Value>
pub async fn clear_log(&self, manager_id: &str, log_id: &str) -> Result<Value>
Clear a log service.
Sourcepub async fn list_virtual_media(&self, manager_id: &str) -> Result<Collection>
pub async fn list_virtual_media(&self, manager_id: &str) -> Result<Collection>
List virtual media for a manager.
Sourcepub async fn get_virtual_media(
&self,
manager_id: &str,
media_id: &str,
) -> Result<VirtualMedia>
pub async fn get_virtual_media( &self, manager_id: &str, media_id: &str, ) -> Result<VirtualMedia>
Get a virtual media resource.
Sourcepub async fn insert_media(
&self,
manager_id: &str,
media_id: &str,
image_url: &str,
) -> Result<Value>
pub async fn insert_media( &self, manager_id: &str, media_id: &str, image_url: &str, ) -> Result<Value>
Insert (mount) virtual media image.
Sourcepub async fn eject_media(
&self,
manager_id: &str,
media_id: &str,
) -> Result<Value>
pub async fn eject_media( &self, manager_id: &str, media_id: &str, ) -> Result<Value>
Eject (unmount) virtual media.
Sourcepub async fn get_bios_settings(&self, system_id: &str) -> Result<Bios>
pub async fn get_bios_settings(&self, system_id: &str) -> Result<Bios>
Get BIOS pending settings.
Sourcepub async fn set_bios_attributes(
&self,
system_id: &str,
attributes: &Value,
) -> Result<Value>
pub async fn set_bios_attributes( &self, system_id: &str, attributes: &Value, ) -> Result<Value>
Set BIOS attributes (applied on next boot).
Sourcepub async fn reset_bios_defaults(&self, system_id: &str) -> Result<Value>
pub async fn reset_bios_defaults(&self, system_id: &str) -> Result<Value>
Reset BIOS to factory defaults (requires reboot).
Sourcepub async fn get_bios_attributes_full(
&self,
system_id: &str,
) -> Result<Vec<RegistryAttribute>>
pub async fn get_bios_attributes_full( &self, system_id: &str, ) -> Result<Vec<RegistryAttribute>>
Get BIOS attributes with full registry metadata for UI rendering.
This fetches the BIOS attribute registry and merges it with current and pending values, returning structured data suitable for building management UIs (dropdowns, toggles, grouped forms, etc.).
Sourcepub async fn list_registries(&self) -> Result<Collection>
pub async fn list_registries(&self) -> Result<Collection>
List all registries available on this BMC.
Sourcepub async fn get_registry(&self, registry_id: &str) -> Result<Value>
pub async fn get_registry(&self, registry_id: &str) -> Result<Value>
Get a registry file by ID and return the parsed JSON body.
Automatically resolves the registry location (local URI or public URI).
Sourcepub async fn get_message_registry(
&self,
registry_id: &str,
) -> Result<(RegistryInfo, Vec<RegistryMessage>)>
pub async fn get_message_registry( &self, registry_id: &str, ) -> Result<(RegistryInfo, Vec<RegistryMessage>)>
Get a message registry parsed into structured messages.
Sourcepub async fn get_attributes_full(
&self,
registry_id: &str,
resource_path: &str,
) -> Result<Vec<RegistryAttribute>>
pub async fn get_attributes_full( &self, registry_id: &str, resource_path: &str, ) -> Result<Vec<RegistryAttribute>>
Get an attribute registry (non-BIOS) with current values merged.
resource_path is the path to the resource whose attributes you want
(e.g. “/redfish/v1/Managers/1/Attributes”).
Sourcepub async fn get_secure_boot(&self, system_id: &str) -> Result<SecureBoot>
pub async fn get_secure_boot(&self, system_id: &str) -> Result<SecureBoot>
Get Secure Boot status.
Sourcepub async fn set_secure_boot(
&self,
system_id: &str,
enabled: bool,
) -> Result<Value>
pub async fn set_secure_boot( &self, system_id: &str, enabled: bool, ) -> Result<Value>
Enable or disable Secure Boot.
Sourcepub async fn get_network_protocol(
&self,
manager_id: &str,
) -> Result<NetworkProtocol>
pub async fn get_network_protocol( &self, manager_id: &str, ) -> Result<NetworkProtocol>
Get manager network protocol settings.
Sourcepub async fn set_network_protocol(
&self,
manager_id: &str,
settings: &Value,
) -> Result<Value>
pub async fn set_network_protocol( &self, manager_id: &str, settings: &Value, ) -> Result<Value>
Update network protocol settings (e.g. NTP servers).
Sourcepub async fn list_serial_interfaces(
&self,
manager_id: &str,
) -> Result<Collection>
pub async fn list_serial_interfaces( &self, manager_id: &str, ) -> Result<Collection>
List serial interfaces for a manager.
Sourcepub async fn get_serial_interface(
&self,
manager_id: &str,
iface_id: &str,
) -> Result<SerialInterface>
pub async fn get_serial_interface( &self, manager_id: &str, iface_id: &str, ) -> Result<SerialInterface>
Get a serial interface.
Sourcepub async fn list_volumes(
&self,
system_id: &str,
storage_id: &str,
) -> Result<Collection>
pub async fn list_volumes( &self, system_id: &str, storage_id: &str, ) -> Result<Collection>
List volumes for a storage resource.
Sourcepub async fn get_volume(
&self,
system_id: &str,
storage_id: &str,
volume_id: &str,
) -> Result<Volume>
pub async fn get_volume( &self, system_id: &str, storage_id: &str, volume_id: &str, ) -> Result<Volume>
Get a specific volume.
Sourcepub async fn create_volume(
&self,
system_id: &str,
storage_id: &str,
body: &Value,
) -> Result<Value>
pub async fn create_volume( &self, system_id: &str, storage_id: &str, body: &Value, ) -> Result<Value>
Create a volume (RAID).
Sourcepub async fn delete_volume(
&self,
system_id: &str,
storage_id: &str,
volume_id: &str,
) -> Result<()>
pub async fn delete_volume( &self, system_id: &str, storage_id: &str, volume_id: &str, ) -> Result<()>
Delete a volume.
Sourcepub async fn list_certificates(&self, manager_id: &str) -> Result<Collection>
pub async fn list_certificates(&self, manager_id: &str) -> Result<Collection>
List certificates for a manager.
Sourcepub async fn get_certificate(&self, path: &str) -> Result<Certificate>
pub async fn get_certificate(&self, path: &str) -> Result<Certificate>
Get a certificate.
Sourcepub async fn replace_certificate(
&self,
path: &str,
cert_pem: &str,
cert_type: &str,
) -> Result<Value>
pub async fn replace_certificate( &self, path: &str, cert_pem: &str, cert_type: &str, ) -> Result<Value>
Replace a certificate (POST new cert to collection or PATCH existing).
Sourcepub async fn list_subscriptions(&self) -> Result<Collection>
pub async fn list_subscriptions(&self) -> Result<Collection>
List event subscriptions.
Sourcepub async fn create_subscription(
&self,
destination: &str,
event_types: &[&str],
context: &str,
) -> Result<Value>
pub async fn create_subscription( &self, destination: &str, event_types: &[&str], context: &str, ) -> Result<Value>
Create an event subscription.
Sourcepub async fn delete_subscription(&self, subscription_id: &str) -> Result<()>
pub async fn delete_subscription(&self, subscription_id: &str) -> Result<()>
Delete an event subscription.
Sourcepub async fn list_firmware_inventory(&self) -> Result<Collection>
pub async fn list_firmware_inventory(&self) -> Result<Collection>
List firmware inventory.
Sourcepub async fn get_firmware_item(
&self,
item_id: &str,
) -> Result<SoftwareInventory>
pub async fn get_firmware_item( &self, item_id: &str, ) -> Result<SoftwareInventory>
Get a firmware inventory item.
Sourcepub async fn simple_update(&self, image_uri: &str) -> Result<Value>
pub async fn simple_update(&self, image_uri: &str) -> Result<Value>
Simple firmware update via URI (BMC pulls the image).
Sourcepub async fn list_tasks(&self) -> Result<Collection>
pub async fn list_tasks(&self) -> Result<Collection>
List tasks.
Sourcepub async fn wait_task(&self, task_id: &str, max_wait_secs: u64) -> Result<Task>
pub async fn wait_task(&self, task_id: &str, max_wait_secs: u64) -> Result<Task>
Poll a task until completion (max wait in seconds).
Sourcepub async fn get_all_members(&self, path: &str) -> Result<Vec<OdataLink>>
pub async fn get_all_members(&self, path: &str) -> Result<Vec<OdataLink>>
GET a collection and automatically follow @odata.nextLink to get all members.
Sourcepub async fn list_manager_ethernet_interfaces(
&self,
manager_id: &str,
) -> Result<Collection>
pub async fn list_manager_ethernet_interfaces( &self, manager_id: &str, ) -> Result<Collection>
List ethernet interfaces for a manager (BMC network).
Sourcepub async fn get_manager_ethernet_interface(
&self,
manager_id: &str,
iface_id: &str,
) -> Result<EthernetInterface>
pub async fn get_manager_ethernet_interface( &self, manager_id: &str, iface_id: &str, ) -> Result<EthernetInterface>
Get a specific manager ethernet interface.
Sourcepub async fn patch_manager_ethernet_interface(
&self,
manager_id: &str,
iface_id: &str,
body: &Value,
) -> Result<Value>
pub async fn patch_manager_ethernet_interface( &self, manager_id: &str, iface_id: &str, body: &Value, ) -> Result<Value>
Patch a manager ethernet interface (e.g. change IP settings).
Sourcepub async fn get_chassis_indicator(
&self,
chassis_id: &str,
) -> Result<Option<bool>>
pub async fn get_chassis_indicator( &self, chassis_id: &str, ) -> Result<Option<bool>>
Get chassis location indicator state.
Returns Some(true) if active, Some(false) if off, None if unsupported.
Sourcepub async fn set_chassis_indicator(
&self,
chassis_id: &str,
on: bool,
) -> Result<Value>
pub async fn set_chassis_indicator( &self, chassis_id: &str, on: bool, ) -> Result<Value>
Set chassis location indicator on or off.
Tries LocationIndicatorActive first, falls back to IndicatorLED.
Sourcepub async fn get_system_health(
&self,
system_id: &str,
chassis_id: &str,
) -> Result<SystemHealth>
pub async fn get_system_health( &self, system_id: &str, chassis_id: &str, ) -> Result<SystemHealth>
Get aggregated system health (processors, memory, thermal, power, storage).
Single call that fetches System, Thermal, and Power resources and returns a unified health summary suitable for dashboard display.
Sourcepub async fn get_enriched_logs(
&self,
manager_id: &str,
log_id: &str,
) -> Result<Vec<EnrichedLogEntry>>
pub async fn get_enriched_logs( &self, manager_id: &str, log_id: &str, ) -> Result<Vec<EnrichedLogEntry>>
Get log entries with message registry translation.
Fetches log entries and the Base message registry, then returns entries with human-readable translated messages and resolution suggestions.
Sourcepub async fn get_storage_overview(
&self,
system_id: &str,
) -> Result<StorageOverview>
pub async fn get_storage_overview( &self, system_id: &str, ) -> Result<StorageOverview>
Get a complete storage overview for a system.
Aggregates storage controllers, RAID volumes, and unassigned drives into a single topology view.
Sourcepub async fn list_users(&self) -> Result<Vec<UserAccount>>
pub async fn list_users(&self) -> Result<Vec<UserAccount>>
List all user accounts as simplified structs.
Sourcepub async fn create_user(
&self,
username: &str,
password: &str,
role: &str,
) -> Result<Value>
pub async fn create_user( &self, username: &str, password: &str, role: &str, ) -> Result<Value>
Create a new user account.
Sourcepub async fn change_password(
&self,
account_id: &str,
new_password: &str,
) -> Result<Value>
pub async fn change_password( &self, account_id: &str, new_password: &str, ) -> Result<Value>
Change a user’s password.
Sourcepub async fn set_user_role(&self, account_id: &str, role: &str) -> Result<Value>
pub async fn set_user_role(&self, account_id: &str, role: &str) -> Result<Value>
Set a user’s role.
Sourcepub async fn set_user_enabled(
&self,
account_id: &str,
enabled: bool,
) -> Result<Value>
pub async fn set_user_enabled( &self, account_id: &str, enabled: bool, ) -> Result<Value>
Enable or disable a user account.
Sourcepub async fn unlock_user(&self, account_id: &str) -> Result<Value>
pub async fn unlock_user(&self, account_id: &str) -> Result<Value>
Unlock a locked user account.
Sourcepub async fn delete_user(&self, account_id: &str) -> Result<()>
pub async fn delete_user(&self, account_id: &str) -> Result<()>
Delete a user account.
Sourcepub async fn subscribe(&self, params: &SubscribeParams<'_>) -> Result<Value>
pub async fn subscribe(&self, params: &SubscribeParams<'_>) -> Result<Value>
Subscribe to Redfish events with a simplified interface.
params.severity_filter can be “OK”, “Warning”, or “Critical” (BMC support varies).
Sourcepub async fn subscribe_sse(&self) -> Result<EventStream>
pub async fn subscribe_sse(&self) -> Result<EventStream>
Open an SSE stream for real-time Redfish events.
Returns an async Stream that yields RedfishEvent items.
The BMC must support SSE (check EventService.ServerSentEventUri).
Sourcepub async fn export_bios_config(&self, system_id: &str) -> Result<BiosConfig>
pub async fn export_bios_config(&self, system_id: &str) -> Result<BiosConfig>
Export BIOS configuration from a system as a portable config.
Sourcepub async fn import_bios_config(
&self,
system_id: &str,
config: &BiosConfig,
) -> Result<Value>
pub async fn import_bios_config( &self, system_id: &str, config: &BiosConfig, ) -> Result<Value>
Import (apply) a BIOS configuration to a system. Only applies attributes that exist in the config. Takes effect on next boot.
Sourcepub async fn diff_bios_config(
&self,
system_id: &str,
config: &BiosConfig,
) -> Result<BiosConfigDiff>
pub async fn diff_bios_config( &self, system_id: &str, config: &BiosConfig, ) -> Result<BiosConfigDiff>
Compare current BIOS settings against a config, returning differences.
Sourcepub async fn get_topology(&self, system_id: &str) -> Result<HardwareTopology>
pub async fn get_topology(&self, system_id: &str) -> Result<HardwareTopology>
Get the full hardware topology for UI visualization.
Sourcepub async fn update_firmware_with_progress<F>(
&self,
image_uri: &str,
max_wait_secs: u64,
progress_cb: F,
) -> Result<Task>
pub async fn update_firmware_with_progress<F>( &self, image_uri: &str, max_wait_secs: u64, progress_cb: F, ) -> Result<Task>
Perform a firmware update and track progress until completion.
progress_cb is called with (task_state, percent_complete) on each poll.
Sourcepub async fn get_with_retry(
&mut self,
path: &str,
max_retries: u32,
) -> Result<Value>
pub async fn get_with_retry( &mut self, path: &str, max_retries: u32, ) -> Result<Value>
GET with automatic retry and session renewal on 401.