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