Skip to main content

RedfishClient

Struct RedfishClient 

Source
pub struct RedfishClient { /* private fields */ }
Expand description

Async Redfish client for BMC management.

Implementations§

Source§

impl RedfishClient

Source

pub fn builder(host: &str) -> RedfishClientBuilder

Create a builder for configuring a RedfishClient.

Source

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.

Source

pub fn set_session(&mut self, token: &str, session_uri: &str)

Inject an existing session token and URI.

Source

pub fn session_token(&self) -> Option<&str>

Get the current session token, if any.

Source

pub fn session_uri(&self) -> Option<&str>

Get the current session URI, if any.

Source

pub async fn login(&mut self) -> Result<()>

Establish a Redfish session (POST to SessionService).

Source

pub async fn logout(&mut self) -> Result<()>

Close the Redfish session.

Source

pub async fn get(&self, path: &str) -> Result<Value>

GET a Redfish resource by path (e.g. “/redfish/v1/Systems”).

Source

pub async fn get_as<T: DeserializeOwned>(&self, path: &str) -> Result<T>

GET and deserialize into a typed struct.

Source

pub async fn post(&self, path: &str, body: &Value) -> Result<Value>

POST an action (e.g. Reset).

Source

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.

Source

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).

Source

pub async fn delete(&self, path: &str) -> Result<()>

DELETE a resource.

Source

pub async fn get_service_root(&self) -> Result<ServiceRoot>

Get Service Root.

Source

pub async fn list_systems(&self) -> Result<Collection>

List all computer systems.

Source

pub async fn get_system(&self, id: &str) -> Result<ComputerSystem>

Get a specific system by ID.

Source

pub async fn list_chassis(&self) -> Result<Collection>

List all chassis.

Source

pub async fn get_chassis(&self, id: &str) -> Result<Chassis>

Get a specific chassis by ID.

Source

pub async fn list_managers(&self) -> Result<Collection>

List all managers (BMCs).

Source

pub async fn get_manager(&self, id: &str) -> Result<Manager>

Get a specific manager by ID.

Source

pub async fn get_power(&self, chassis_id: &str) -> Result<Power>

Get power info for a chassis.

Source

pub async fn get_thermal(&self, chassis_id: &str) -> Result<Thermal>

Get thermal info for a chassis.

Source

pub async fn list_processors(&self, system_id: &str) -> Result<Collection>

List processors for a system.

Source

pub async fn get_processor( &self, system_id: &str, proc_id: &str, ) -> Result<Processor>

Get a specific processor.

Source

pub async fn list_memory(&self, system_id: &str) -> Result<Collection>

List memory for a system.

Source

pub async fn get_memory(&self, system_id: &str, mem_id: &str) -> Result<Memory>

Get a specific memory module.

Source

pub async fn list_storage(&self, system_id: &str) -> Result<Collection>

List storage for a system.

Source

pub async fn get_storage( &self, system_id: &str, storage_id: &str, ) -> Result<Storage>

Get a specific storage resource.

Source

pub async fn list_ethernet_interfaces( &self, system_id: &str, ) -> Result<Collection>

List ethernet interfaces for a system.

Source

pub async fn get_ethernet_interface( &self, system_id: &str, iface_id: &str, ) -> Result<EthernetInterface>

Get a specific ethernet interface.

Source

pub async fn get_account_service(&self) -> Result<AccountService>

Get account service.

Source

pub async fn list_accounts(&self) -> Result<Collection>

List user accounts.

Source

pub async fn get_update_service(&self) -> Result<UpdateService>

Get update service.

Source

pub async fn get_event_service(&self) -> Result<EventService>

Get event service.

Source

pub async fn list_log_entries( &self, manager_id: &str, log_id: &str, ) -> Result<Collection>

List log entries for a manager.

Source

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”

Source

pub async fn power_on(&self, system_id: &str) -> Result<Value>

Power on a system.

Source

pub async fn power_off(&self, system_id: &str) -> Result<Value>

Force power off a system.

Source

pub async fn graceful_shutdown(&self, system_id: &str) -> Result<Value>

Graceful shutdown.

Source

pub async fn graceful_restart(&self, system_id: &str) -> Result<Value>

Graceful restart.

Source

pub async fn force_restart(&self, system_id: &str) -> Result<Value>

Force restart.

Source

pub async fn power_cycle(&self, system_id: &str) -> Result<Value>

Power cycle.

Source

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”

Source

pub async fn set_boot_pxe(&self, system_id: &str) -> Result<Value>

Set next boot to PXE.

Source

pub async fn set_boot_bios(&self, system_id: &str) -> Result<Value>

Set next boot to BIOS Setup.

Source

pub async fn reset_manager( &self, manager_id: &str, reset_type: &str, ) -> Result<Value>

Reset a manager (BMC).

Source

pub async fn clear_log(&self, manager_id: &str, log_id: &str) -> Result<Value>

Clear a log service.

Source

pub async fn list_virtual_media(&self, manager_id: &str) -> Result<Collection>

List virtual media for a manager.

Source

pub async fn get_virtual_media( &self, manager_id: &str, media_id: &str, ) -> Result<VirtualMedia>

Get a virtual media resource.

Source

pub async fn insert_media( &self, manager_id: &str, media_id: &str, image_url: &str, ) -> Result<Value>

Insert (mount) virtual media image.

Source

pub async fn eject_media( &self, manager_id: &str, media_id: &str, ) -> Result<Value>

Eject (unmount) virtual media.

Source

pub async fn get_bios(&self, system_id: &str) -> Result<Bios>

Get BIOS attributes.

Source

pub async fn get_bios_settings(&self, system_id: &str) -> Result<Bios>

Get BIOS pending settings.

Source

pub async fn set_bios_attributes( &self, system_id: &str, attributes: &Value, ) -> Result<Value>

Set BIOS attributes (applied on next boot).

Source

pub async fn reset_bios_defaults(&self, system_id: &str) -> Result<Value>

Reset BIOS to factory defaults (requires reboot).

Source

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.).

Source

pub async fn list_registries(&self) -> Result<Collection>

List all registries available on this BMC.

Source

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).

Source

pub async fn get_message_registry( &self, registry_id: &str, ) -> Result<(RegistryInfo, Vec<RegistryMessage>)>

Get a message registry parsed into structured messages.

Source

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”).

Source

pub async fn get_secure_boot(&self, system_id: &str) -> Result<SecureBoot>

Get Secure Boot status.

Source

pub async fn set_secure_boot( &self, system_id: &str, enabled: bool, ) -> Result<Value>

Enable or disable Secure Boot.

Source

pub async fn get_network_protocol( &self, manager_id: &str, ) -> Result<NetworkProtocol>

Get manager network protocol settings.

Source

pub async fn set_network_protocol( &self, manager_id: &str, settings: &Value, ) -> Result<Value>

Update network protocol settings (e.g. NTP servers).

Source

pub async fn list_serial_interfaces( &self, manager_id: &str, ) -> Result<Collection>

List serial interfaces for a manager.

Source

pub async fn get_serial_interface( &self, manager_id: &str, iface_id: &str, ) -> Result<SerialInterface>

Get a serial interface.

Source

pub async fn list_volumes( &self, system_id: &str, storage_id: &str, ) -> Result<Collection>

List volumes for a storage resource.

Source

pub async fn get_volume( &self, system_id: &str, storage_id: &str, volume_id: &str, ) -> Result<Volume>

Get a specific volume.

Source

pub async fn create_volume( &self, system_id: &str, storage_id: &str, body: &Value, ) -> Result<Value>

Create a volume (RAID).

Source

pub async fn delete_volume( &self, system_id: &str, storage_id: &str, volume_id: &str, ) -> Result<()>

Delete a volume.

Source

pub async fn get_drive(&self, path: &str) -> Result<Drive>

Get a specific drive.

Source

pub async fn list_certificates(&self, manager_id: &str) -> Result<Collection>

List certificates for a manager.

Source

pub async fn get_certificate(&self, path: &str) -> Result<Certificate>

Get a certificate.

Source

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).

Source

pub async fn list_subscriptions(&self) -> Result<Collection>

List event subscriptions.

Source

pub async fn create_subscription( &self, destination: &str, event_types: &[&str], context: &str, ) -> Result<Value>

Create an event subscription.

Source

pub async fn delete_subscription(&self, subscription_id: &str) -> Result<()>

Delete an event subscription.

Source

pub async fn list_firmware_inventory(&self) -> Result<Collection>

List firmware inventory.

Source

pub async fn get_firmware_item( &self, item_id: &str, ) -> Result<SoftwareInventory>

Get a firmware inventory item.

Source

pub async fn simple_update(&self, image_uri: &str) -> Result<Value>

Simple firmware update via URI (BMC pulls the image).

Source

pub async fn list_tasks(&self) -> Result<Collection>

List tasks.

Source

pub async fn get_task(&self, task_id: &str) -> Result<Task>

Get a task by ID.

Source

pub async fn wait_task(&self, task_id: &str, max_wait_secs: u64) -> Result<Task>

Poll a task until completion (max wait in seconds).

Source

pub async fn get_all_members(&self, path: &str) -> Result<Vec<OdataLink>>

GET a collection and automatically follow @odata.nextLink to get all members.

Source

pub async fn list_manager_ethernet_interfaces( &self, manager_id: &str, ) -> Result<Collection>

List ethernet interfaces for a manager (BMC network).

Source

pub async fn get_manager_ethernet_interface( &self, manager_id: &str, iface_id: &str, ) -> Result<EthernetInterface>

Get a specific manager ethernet interface.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn list_users(&self) -> Result<Vec<UserAccount>>

List all user accounts as simplified structs.

Source

pub async fn create_user( &self, username: &str, password: &str, role: &str, ) -> Result<Value>

Create a new user account.

Source

pub async fn change_password( &self, account_id: &str, new_password: &str, ) -> Result<Value>

Change a user’s password.

Source

pub async fn set_user_role(&self, account_id: &str, role: &str) -> Result<Value>

Set a user’s role.

Source

pub async fn set_user_enabled( &self, account_id: &str, enabled: bool, ) -> Result<Value>

Enable or disable a user account.

Source

pub async fn unlock_user(&self, account_id: &str) -> Result<Value>

Unlock a locked user account.

Source

pub async fn delete_user(&self, account_id: &str) -> Result<()>

Delete a user account.

Source

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).

Source

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).

Source

pub async fn export_bios_config(&self, system_id: &str) -> Result<BiosConfig>

Export BIOS configuration from a system as a portable config.

Source

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.

Source

pub async fn diff_bios_config( &self, system_id: &str, config: &BiosConfig, ) -> Result<BiosConfigDiff>

Compare current BIOS settings against a config, returning differences.

Source

pub async fn get_topology(&self, system_id: &str) -> Result<HardwareTopology>

Get the full hardware topology for UI visualization.

Source

pub async fn update_firmware_with_progress<F>( &self, image_uri: &str, max_wait_secs: u64, progress_cb: F, ) -> Result<Task>
where F: FnMut(&str, Option<u32>),

Perform a firmware update and track progress until completion.

progress_cb is called with (task_state, percent_complete) on each poll.

Source

pub async fn get_with_retry( &mut self, path: &str, max_retries: u32, ) -> Result<Value>

GET with automatic retry and session renewal on 401.

Source

pub async fn patch_with_retry( &mut self, path: &str, body: &Value, max_retries: u32, ) -> Result<Value>

PATCH with automatic retry and session renewal on 401.

Source

pub async fn post_with_retry( &mut self, path: &str, body: &Value, max_retries: u32, ) -> Result<Value>

POST with automatic retry and session renewal on 401.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more