antimatter_api 2.0.13

Interact with the Antimatter Cloud API
Documentation
/*
 * Antimatter Public API
 *
 * Interact with the Antimatter Cloud API
 *
 * The version of the OpenAPI document: 2.0.13
 * Contact: support@antimatter.io
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// ReadContextConfigRule : Information about what must be done to data when it is read from a capsule 
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ReadContextConfigRule {
    /// An identifier for a rule
    #[serde(rename = "id")]
    pub id: String,
    /// A list of expressions referencing the domainIdentity, readParameters and capsule/span tags. Each expression will be ANDed together, and ANDed with the factAssertions to determine if this rule activates. 
    #[serde(rename = "matchExpressions", skip_serializing_if = "Option::is_none")]
    pub match_expressions: Option<Vec<models::ReadContextRuleMatchExpressionsInner>>,
    #[serde(rename = "action")]
    pub action: Action,
    /// if the action is Tokenize, what scope to use for the token 
    #[serde(rename = "tokenScope", skip_serializing_if = "Option::is_none")]
    pub token_scope: Option<TokenScope>,
    /// if the action is Tokenize, what format should the token take. Explicit is of the form tk-xxxxxx and synthetic returns something that looks like the original data type (e.g. John Smith for a name) but is in fact a token 
    #[serde(rename = "tokenFormat", skip_serializing_if = "Option::is_none")]
    pub token_format: Option<TokenFormat>,
    /// assert the existence or nonexistence of facts that reference the domainIdentity, tags and readParameters. These assertions will be ANDed together, and ANDed with the matchExpressions 
    #[serde(rename = "facts", skip_serializing_if = "Option::is_none")]
    pub facts: Option<Vec<models::ReadContextRuleFactsInner>>,
    /// This rule's priority. Lower priority numbers rules are evaluated first
    #[serde(rename = "priority")]
    pub priority: i32,
    /// This rule has been merged into a read context from another domain. Note that rules inside a read context that is entirely imported will not bear the imported flag. Only rules that  have been mapped into a domain's own read context will bear the imported flag 
    #[serde(rename = "imported")]
    pub imported: bool,
    /// A globally unique identifier for a domain
    #[serde(rename = "sourceDomainID", skip_serializing_if = "Option::is_none")]
    pub source_domain_id: Option<String>,
    #[serde(rename = "sourceDomainName", skip_serializing_if = "Option::is_none")]
    pub source_domain_name: Option<String>,
}

impl ReadContextConfigRule {
    /// Information about what must be done to data when it is read from a capsule 
    pub fn new(id: String, action: Action, priority: i32, imported: bool) -> ReadContextConfigRule {
        ReadContextConfigRule {
            id,
            match_expressions: None,
            action,
            token_scope: None,
            token_format: None,
            facts: None,
            priority,
            imported,
            source_domain_id: None,
            source_domain_name: None,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Action {
    #[serde(rename = "DenyCapsule")]
    DenyCapsule,
    #[serde(rename = "DenyRecord")]
    DenyRecord,
    #[serde(rename = "Redact")]
    Redact,
    #[serde(rename = "Tokenize")]
    Tokenize,
    #[serde(rename = "Allow")]
    Allow,
}

impl Default for Action {
    fn default() -> Action {
        Self::DenyCapsule
    }
}
/// if the action is Tokenize, what scope to use for the token 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TokenScope {
    #[serde(rename = "unique")]
    Unique,
    #[serde(rename = "capsule")]
    Capsule,
    #[serde(rename = "domain")]
    Domain,
}

impl Default for TokenScope {
    fn default() -> TokenScope {
        Self::Unique
    }
}
/// if the action is Tokenize, what format should the token take. Explicit is of the form tk-xxxxxx and synthetic returns something that looks like the original data type (e.g. John Smith for a name) but is in fact a token 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TokenFormat {
    #[serde(rename = "explicit")]
    Explicit,
    #[serde(rename = "synthetic")]
    Synthetic,
}

impl Default for TokenFormat {
    fn default() -> TokenFormat {
        Self::Explicit
    }
}