1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* 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
}
}