nv_redfish/lib.rs
1// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! Redfish protocol client
17//!
18//! This crate provides a thin, ergonomic layer on top of generated Redfish
19//! schema types and the `nv-redfish-core` primitives. It focuses on:
20//! - High-level entry points (for example, [`ServiceRoot`])
21//! - Modular, feature-gated services (enable only what you need)
22//! - OEM extension support (also under feature flags)
23//! - Patch helpers for vendor quirks that deviate from the Redfish CSDL
24//!
25//! Relationship to other crates
26//! - Depends on `nv-redfish-core` for transport-agnostic traits (`Bmc`) and
27//! foundational types (`ODataId`, navigation properties, actions).
28//! - Uses code generated by the CSDL compiler (included via the internal
29//! `schema` module) and re-exports ergonomic wrappers where applicable.
30//! - The set of compiled schemas is controlled by `features.toml` to include
31//! only what is required by enabled features — keeping the build as
32//! lightweight as possible.
33//!
34//! Features
35//! - Service feature flags such as `accounts`, `session-service`,
36//! `update-service`, and others enable typed wrappers for specific Redfish
37//! services and resources.
38//! - OEM-specific feature flags enable vendor extensions when needed.
39//!
40//! Status
41//! - The crate exposes typed wrappers for a growing subset of standard Redfish
42//! services and resources, plus selected OEM extensions.
43//! - Additional services and OEM extensions continue to be added over time.
44//!
45
46#![recursion_limit = "256"]
47#![deny(
48 clippy::all,
49 clippy::pedantic,
50 clippy::nursery,
51 clippy::suspicious,
52 clippy::complexity,
53 clippy::perf
54)]
55#![deny(
56 clippy::absolute_paths,
57 clippy::todo,
58 clippy::unimplemented,
59 clippy::tests_outside_test_module,
60 clippy::panic,
61 clippy::unwrap_used,
62 clippy::unwrap_in_result,
63 clippy::unused_trait_names,
64 clippy::print_stdout,
65 clippy::print_stderr
66)]
67#![deny(missing_docs)]
68#![allow(clippy::doc_markdown)]
69
70/// Errors defined by the crate.
71pub mod error;
72
73/// Service Root implementation.
74pub mod service_root;
75
76/// Redfish resource common functions.
77pub mod resource;
78
79/// Hardware identifier (Manufacturer + Model + Part Number + Serial
80/// Number).
81pub mod hardware_id;
82
83/// MAC addresses returned by the crate.
84pub mod mac_address;
85
86/// Accounts Service.
87#[cfg(feature = "accounts")]
88pub mod account;
89/// Chassis.
90#[cfg(feature = "chassis")]
91pub mod chassis;
92/// Computer System.
93#[cfg(feature = "computer-systems")]
94pub mod computer_system;
95/// Manager.
96#[cfg(feature = "managers")]
97pub mod manager;
98/// Update Service.
99#[cfg(feature = "update-service")]
100pub mod update_service;
101
102#[cfg(feature = "assembly")]
103pub mod assembly;
104/// Ethernet interfaces.
105#[cfg(feature = "ethernet-interfaces")]
106pub mod ethernet_interface;
107/// Event Service.
108#[cfg(feature = "event-service")]
109pub mod event_service;
110/// Host interfaces.
111#[cfg(feature = "host-interfaces")]
112pub mod host_interface;
113/// Log Service.
114#[cfg(feature = "log-services")]
115pub mod log_service;
116#[cfg(feature = "network-device-functions")]
117pub mod network_device_function;
118/// `PCIe` devices.
119#[cfg(feature = "pcie-devices")]
120pub mod pcie_device;
121/// Metrics and sensor abstraction.
122#[cfg(feature = "sensors")]
123pub mod sensor;
124/// Session Service.
125#[cfg(feature = "session-service")]
126pub mod session_service;
127/// Telemetry Service.
128#[cfg(feature = "telemetry-service")]
129pub mod telemetry_service;
130
131/// Individual OEM extensions support.
132#[cfg(feature = "oem")]
133pub mod oem;
134
135/// Compiled Redfish schema.
136pub(crate) mod schema;
137
138#[cfg(feature = "patch")]
139pub(crate) mod patch_support;
140
141/// Redfish protocol features.
142pub(crate) mod protocol_features;
143
144/// Bmc wrapper used in nv-redfish.
145pub(crate) mod bmc;
146
147/// BMC quirks support.
148pub(crate) mod bmc_quirks;
149
150/// Common patches
151#[cfg(any(feature = "chassis", feature = "managers", feature = "sensors"))]
152pub(crate) mod patches;
153
154#[doc(inline)]
155pub use nv_redfish_core as core;
156
157#[cfg(feature = "bmc-http")]
158#[doc(inline)]
159pub use nv_redfish_bmc_http as bmc_http;
160
161#[doc(inline)]
162pub use error::Error;
163#[doc(inline)]
164pub use nv_redfish_core::Bmc;
165#[doc(inline)]
166pub use protocol_features::ProtocolFeatures;
167#[doc(inline)]
168pub use resource::Resource;
169#[doc(inline)]
170pub use service_root::ServiceRoot;
171
172#[doc(inline)]
173#[cfg(feature = "resource-status")]
174pub use resource::ResourceProvidesStatus;
175
176pub(crate) use crate::schema::redfish::resource::Resource as ResourceSchema;
177#[cfg(feature = "resource-status")]
178pub(crate) use crate::schema::redfish::resource::Status as ResourceStatusSchema;
179pub(crate) use bmc::NvBmc;