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

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

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: 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: 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