/*
* 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};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct NewDataPolicyRule {
#[serde(rename = "comment", skip_serializing_if = "Option::is_none")]
pub comment: Option<String>,
#[serde(rename = "clauses")]
pub clauses: Vec<models::DataPolicyClause>,
#[serde(rename = "effect")]
pub effect: models::DataPolicyRuleEffect,
/// if the effect 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 effect 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>,
/// This rule's priority. Lower priority numbers rules are evaluated first. if \"assignPriority\" is specified, this field is ignored.
#[serde(rename = "priority", skip_serializing_if = "Option::is_none")]
pub priority: Option<i32>,
/// Automatically determines the rule's priority based on the priority numbers of rules already in the policy. If \"first\", this rule will be assigned a priority number lower than any other rule in the policy, causing it to be evaluated first. If \"last\" this rule will be assigned a priority number higher than any other rule in the policy, causing it to be evaluated last. Specifying this field will also cause the priorities of other rules in the policy to be re-assigned to unique multiples of 10, preserving order.
#[serde(rename = "assignPriority", skip_serializing_if = "Option::is_none")]
pub assign_priority: Option<AssignPriority>,
}
impl NewDataPolicyRule {
pub fn new(clauses: Vec<models::DataPolicyClause>, effect: models::DataPolicyRuleEffect) -> NewDataPolicyRule {
NewDataPolicyRule {
comment: None,
clauses,
effect,
token_scope: None,
token_format: None,
priority: None,
assign_priority: None,
}
}
}
/// if the effect 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 effect 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
}
}
/// Automatically determines the rule's priority based on the priority numbers of rules already in the policy. If \"first\", this rule will be assigned a priority number lower than any other rule in the policy, causing it to be evaluated first. If \"last\" this rule will be assigned a priority number higher than any other rule in the policy, causing it to be evaluated last. Specifying this field will also cause the priorities of other rules in the policy to be re-assigned to unique multiples of 10, preserving order.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AssignPriority {
#[serde(rename = "first")]
First,
#[serde(rename = "last")]
Last,
}
impl Default for AssignPriority {
fn default() -> AssignPriority {
Self::First
}
}