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