Skip to main content

greentic_bundle/access/
gmap.rs

1use anyhow::Result;
2use serde::Serialize;
3
4use crate::access::{Policy, parse_path};
5
6#[derive(Debug, Clone, PartialEq, Eq)]
7pub struct GmapTarget {
8    pub tenant: String,
9    pub team: Option<String>,
10}
11
12#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
13pub struct GmapMutation {
14    pub rule_path: String,
15    pub policy: Policy,
16}
17
18impl GmapMutation {
19    pub fn new(rule_path: &str, policy: Policy) -> Result<Self> {
20        let parsed = parse_path(rule_path, 0)?;
21        Ok(Self {
22            rule_path: parsed.to_string(),
23            policy,
24        })
25    }
26}