Skip to main content

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 still needed in this crate because otherwise doc
47// generation failed...
48#![recursion_limit = "256"]
49#![deny(
50    clippy::all,
51    clippy::pedantic,
52    clippy::nursery,
53    clippy::suspicious,
54    clippy::complexity,
55    clippy::perf
56)]
57#![deny(
58    clippy::absolute_paths,
59    clippy::todo,
60    clippy::unimplemented,
61    clippy::tests_outside_test_module,
62    clippy::panic,
63    clippy::unwrap_used,
64    clippy::unwrap_in_result,
65    clippy::unused_trait_names,
66    clippy::print_stdout,
67    clippy::print_stderr
68)]
69#![deny(missing_docs)]
70#![allow(clippy::doc_markdown)]
71
72/// Errors defined by the crate.
73pub mod error;
74
75/// Service Root implementation.
76pub mod service_root;
77
78/// Redfish resource common functions.
79pub mod resource;
80
81/// Hardware identifier (Manufacturer + Model + Part Number + Serial
82/// Number).
83pub mod hardware_id;
84
85/// MAC addresses returned by the crate.
86pub mod mac_address;
87
88/// Accounts Service.
89#[cfg(feature = "accounts")]
90pub mod account;
91/// Chassis.
92#[cfg(feature = "chassis")]
93pub mod chassis;
94/// Computer System.
95#[cfg(feature = "computer-systems")]
96pub mod computer_system;
97/// Manager.
98#[cfg(feature = "managers")]
99pub mod manager;
100/// Update Service.
101#[cfg(feature = "update-service")]
102pub mod update_service;
103
104#[cfg(feature = "assembly")]
105pub mod assembly;
106/// Ethernet interfaces.
107#[cfg(feature = "ethernet-interfaces")]
108pub mod ethernet_interface;
109/// Event Service.
110#[cfg(feature = "event-service")]
111pub mod event_service;
112/// Host interfaces.
113#[cfg(feature = "host-interfaces")]
114pub mod host_interface;
115/// Log Service.
116#[cfg(feature = "log-services")]
117pub mod log_service;
118#[cfg(feature = "network-device-functions")]
119pub mod network_device_function;
120/// `PCIe` devices.
121#[cfg(feature = "pcie-devices")]
122pub mod pcie_device;
123/// Metrics and sensor abstraction.
124#[cfg(feature = "sensors")]
125pub mod sensor;
126/// Session Service.
127#[cfg(feature = "session-service")]
128pub mod session_service;
129/// Telemetry Service.
130#[cfg(feature = "telemetry-service")]
131pub mod telemetry_service;
132
133/// Individual OEM extensions support.
134#[cfg(feature = "oem")]
135pub mod oem;
136
137mod compiled_schema;
138
139#[cfg(feature = "patch")]
140pub(crate) mod patch_support;
141
142/// Generic lightweight Redfish entity link.
143#[cfg(feature = "impl-entity-link")]
144pub mod entity_link;
145
146/// Redfish protocol features.
147pub(crate) mod protocol_features;
148
149/// Bmc wrapper used in nv-redfish.
150pub(crate) mod bmc;
151
152/// BMC quirks support.
153pub(crate) mod bmc_quirks;
154
155#[doc(inline)]
156pub use nv_redfish_core as core;
157
158#[cfg(feature = "bmc-http")]
159#[doc(inline)]
160pub use nv_redfish_bmc_http as bmc_http;
161
162#[doc(inline)]
163pub use compiled_schema::redfish as schema;
164
165#[doc(inline)]
166pub use error::Error;
167#[doc(inline)]
168pub use nv_redfish_core::Bmc;
169#[doc(inline)]
170pub use protocol_features::ProtocolFeatures;
171#[doc(inline)]
172pub use resource::Resource;
173#[doc(inline)]
174pub use service_root::ServiceRoot;
175
176#[doc(inline)]
177#[cfg(feature = "resource-status")]
178pub use resource::ResourceProvidesStatus;
179
180#[cfg(feature = "resource-status")]
181pub(crate) use crate::schema::resource::Status as ResourceStatusSchema;
182
183pub(crate) use crate::schema::resource::Resource as ResourceSchema;
184pub(crate) use bmc::NvBmc;