manta_shared/types/api/configuration.rs
1//! Parameters for `GET /configurations`.
2
3use chrono::NaiveDateTime;
4
5/// Typed parameters for fetching CFS configurations.
6pub struct GetConfigurationParams {
7 /// Exact configuration name.
8 pub name: Option<String>,
9 /// Glob pattern matched against configuration names; mutually
10 /// exclusive with `name`.
11 pub pattern: Option<String>,
12 /// Group whose associated configurations should be returned.
13 pub group_name: Option<String>,
14 /// Operator default from `cli.toml`'s `hsm_group`, used
15 /// as a fallback for `group_name`.
16 pub settings_hsm_group_name: Option<String>,
17 /// Lower-bound timestamp (configurations last updated at or after
18 /// this point).
19 pub since: Option<NaiveDateTime>,
20 /// Upper-bound timestamp (configurations last updated at or before
21 /// this point).
22 pub until: Option<NaiveDateTime>,
23 /// Cap on the number of configurations returned (most recent first).
24 pub limit: Option<u8>,
25}
26
27impl GetConfigurationParams {
28 /// Returns the effective group name, preferring the explicit
29 /// `--group` flag and falling back to the operator default from
30 /// `cli.toml`.
31 pub fn effective_group(&self) -> Option<&str> {
32 self
33 .group_name
34 .as_deref()
35 .or(self.settings_hsm_group_name.as_deref())
36 }
37}