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/// Accounts Service.
82#[cfg(feature = "accounts")]
83pub mod account;
84/// Chassis.
85#[cfg(feature = "chassis")]
86pub mod chassis;
87/// Computer System.
88#[cfg(feature = "computer-systems")]
89pub mod computer_system;
90/// Manager.
91#[cfg(feature = "managers")]
92pub mod manager;
93/// Update Service.
94#[cfg(feature = "update-service")]
95pub mod update_service;
96
97#[cfg(feature = "assembly")]
98pub mod assembly;
99/// Ethernet interfaces.
100#[cfg(feature = "ethernet-interfaces")]
101pub mod ethernet_interface;
102/// Log Service.
103#[cfg(feature = "log-services")]
104pub mod log_service;
105/// `PCIe` devices.
106#[cfg(feature = "pcie-devices")]
107pub mod pcie_device;
108/// Metrics and sensor abstraction.
109#[cfg(feature = "sensors")]
110pub mod sensor;
111
112/// Individual OEM extensions support.
113#[cfg(feature = "oem")]
114pub mod oem;
115
116/// Compiled Redfish schema.
117pub(crate) mod schema;
118
119#[cfg(feature = "patch")]
120pub(crate) mod patch_support;
121
122/// Redfish protocol features.
123pub(crate) mod protocol_features;
124
125/// Bmc wrapper used in nv-redfish.
126pub(crate) mod bmc;
127
128#[doc(inline)]
129pub use error::Error;
130#[doc(inline)]
131pub use nv_redfish_core::Bmc;
132#[doc(inline)]
133pub use protocol_features::ProtocolFeatures;
134#[doc(inline)]
135pub use resource::Resource;
136#[doc(inline)]
137pub use service_root::ServiceRoot;
138
139#[doc(inline)]
140#[cfg(feature = "resource-status")]
141pub use resource::ResourceProvidesStatus;
142
143pub(crate) use crate::schema::redfish::resource::Resource as ResourceSchema;
144#[cfg(feature = "resource-status")]
145pub(crate) use crate::schema::redfish::resource::Status as ResourceStatusSchema;
146pub(crate) use bmc::NvBmc;