Skip to main content

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 (the newest N; listed
24  /// oldest first, newest last).
25  pub limit: Option<u8>,
26}
27
28impl GetConfigurationParams {
29  /// Returns the effective group name, preferring the explicit
30  /// `--group` flag and falling back to the operator default from
31  /// `cli.toml`.
32  pub fn effective_group(&self) -> Option<&str> {
33    self
34      .group_name
35      .as_deref()
36      .or(self.settings_hsm_group_name.as_deref())
37  }
38}