Struct speakeasy_rust_sdk::masking::Masking
source · pub struct Masking { /* private fields */ }
Expand description
All masking options, see functions for more details on setting them
Implementations
sourceimpl Masking
impl Masking
sourcepub fn with_query_string_mask(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<StringMaskingOption>
)
pub fn with_query_string_mask(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<StringMaskingOption>
)
Will mask the specified query strings with an optional mask string.
If no mask is provided, the value will be masked with the default mask.
If a single mask is provided, it will be used for all query strings.
If the number of masks provided is equal to the number of query strings, masks will be used in order.
Otherwise, the masks will be used in order until it they are exhausted. If the masks are exhausted, the default mask will be used.
(defaults to "__masked__"
).
Examples
use std::collections::HashMap;
use speakeasy_rust_sdk::{Masking, masking::StringMaskingOption};
// Mask a single field with the default mask
let mut masking = Masking::default();
masking.with_query_string_mask("password", StringMaskingOption::default());
// Mask a single field with the default mask just using None
let mut masking = Masking::default();
masking.with_query_string_mask("password", None);
// Mask a single field with a custom mask
let mut masking = Masking::default();
masking.with_query_string_mask("password", "************");
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_query_string_mask(
["authorization", "password", "more_secrets"].as_slice(),
["__masked__", "*****", "no_secrets_for_you"].as_slice(),
);
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_query_string_mask(
vec!["authorization", "password", "more_secrets"],
vec!["__my_mask__", "*****"],
);
// Mask multiple fields with multiple associated masks
let mut customs_masks = HashMap::new();
customs_masks.insert("authorization", "*****");
customs_masks.insert("password", "hunter2");
customs_masks.insert("more_secrets", "__my_mask__");
let mut masking = Masking::default();
masking.with_query_string_mask(
vec!["authorization", "password", "more_secrets"],
customs_masks,
);
sourcepub fn with_request_header_mask(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<StringMaskingOption>
)
pub fn with_request_header_mask(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<StringMaskingOption>
)
with_request_header_mask will mask the specified request headers with an optional mask string.
If no mask is provided, the value will be masked with the default mask.
If a single mask is provided, it will be used for all headers.
If the number of masks provided is equal to the number of headers, masks will be used in order.
Otherwise, the masks will be used in order until it they are exhausted. If the masks are exhausted, the default mask will be used.
(defaults to "__masked__"
).
Examples
use std::collections::HashMap;
use speakeasy_rust_sdk::{Masking, masking::StringMaskingOption};
// Mask a single field with the default mask
let mut masking = Masking::default();
masking.with_request_header_mask("password", StringMaskingOption::default());
// Mask a single field with the default mask just using None
let mut masking = Masking::default();
masking.with_request_header_mask("password", None);
// Mask a single field with a custom mask
let mut masking = Masking::default();
masking.with_request_header_mask("password", "************");
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_request_header_mask(
["authorization", "password", "more_secrets"].as_slice(),
["__masked__", "*****", "no_secrets_for_you"].as_slice(),
);
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_request_header_mask(
vec!["authorization", "password", "more_secrets"],
vec!["__my_mask__", "*****"],
);
// Mask multiple fields with multiple associated masks
let mut customs_masks = HashMap::new();
customs_masks.insert("authorization", "*****");
customs_masks.insert("password", "hunter2");
customs_masks.insert("more_secrets", "__my_mask__");
let mut masking = Masking::default();
masking.with_request_header_mask(
vec!["authorization", "password", "more_secrets"],
customs_masks,
);
with_response_cookie_mask will mask the specified response cookies with an optional mask string.
If no mask is provided, the value will be masked with the default mask.
If a single mask is provided, it will be used for all cookies.
If the number of masks provided is equal to the number of cookies, masks will be used in order.
Otherwise, the masks will be used in order until it they are exhausted. If the masks are exhausted, the default mask will be used.
(defaults to "__masked__"
).
Examples
use std::collections::HashMap;
use speakeasy_rust_sdk::{Masking, masking::StringMaskingOption};
// Mask a single field with the default mask
let mut masking = Masking::default();
masking.with_response_cookie_mask("password", StringMaskingOption::default());
// Mask a single field with the default mask just using None
let mut masking = Masking::default();
masking.with_response_cookie_mask("password", None);
// Mask a single field with a custom mask
let mut masking = Masking::default();
masking.with_response_cookie_mask("password", "************");
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_response_cookie_mask(
["authorization", "password", "more_secrets"].as_slice(),
["__masked__", "*****", "no_secrets_for_you"].as_slice(),
);
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_response_cookie_mask(
vec!["authorization", "password", "more_secrets"],
vec!["__my_mask__", "*****"],
);
// Mask multiple fields with multiple associated masks
let mut customs_masks = HashMap::new();
customs_masks.insert("authorization", "*****");
customs_masks.insert("password", "hunter2");
customs_masks.insert("more_secrets", "__my_mask__");
let mut masking = Masking::default();
masking.with_response_cookie_mask(
vec!["authorization", "password", "more_secrets"],
customs_masks,
);
sourcepub fn with_response_header_mask(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<StringMaskingOption>
)
pub fn with_response_header_mask(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<StringMaskingOption>
)
with_response_header_mask will mask the specified response headers with an optional mask string.
If no mask is provided, the value will be masked with the default mask.
If a single mask is provided, it will be used for all headers.
If the number of masks provided is equal to the number of headers, masks will be used in order.
Otherwise, the masks will be used in order until it they are exhausted. If the masks are exhausted, the default mask will be used.
(defaults to "__masked__"
).
Examples
use std::collections::HashMap;
use speakeasy_rust_sdk::{Masking, masking::StringMaskingOption};
// Mask a single field with the default mask
let mut masking = Masking::default();
masking.with_response_header_mask("password", StringMaskingOption::default());
// Mask a single field with the default mask just using None
let mut masking = Masking::default();
masking.with_response_header_mask("password", None);
// Mask a single field with a custom mask
let mut masking = Masking::default();
masking.with_response_header_mask("password", "************");
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_response_header_mask(
["authorization", "password", "more_secrets"].as_slice(),
["__masked__", "*****", "no_secrets_for_you"].as_slice(),
);
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_response_header_mask(
vec!["authorization", "password", "more_secrets"],
vec!["__my_mask__", "*****"],
);
// Mask multiple fields with multiple associated masks
let mut customs_masks = HashMap::new();
customs_masks.insert("authorization", "*****");
customs_masks.insert("password", "hunter2");
customs_masks.insert("more_secrets", "__my_mask__");
let mut masking = Masking::default();
masking.with_response_header_mask(
vec!["authorization", "password", "more_secrets"],
customs_masks,
);
with_request_cookie_mask will mask the specified request cookies with an optional mask string.
If no mask is provided, the value will be masked with the default mask.
If a single mask is provided, it will be used for all cookies.
If the number of masks provided is equal to the number of cookies, masks will be used in order.
Otherwise, the masks will be used in order until it they are exhausted. If the masks are exhausted, the default mask will be used.
(defaults to "__masked__"
).
Examples
use std::collections::HashMap;
use speakeasy_rust_sdk::{Masking, masking::StringMaskingOption};
// Mask a single field with the default mask
let mut masking = Masking::default();
masking.with_request_cookie_mask("password", StringMaskingOption::default());
// Mask a single field with the default mask just using None
let mut masking = Masking::default();
masking.with_request_cookie_mask("password", None);
// Mask a single field with a custom mask
let mut masking = Masking::default();
masking.with_request_cookie_mask("password", "************");
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_request_cookie_mask(
["authorization", "password", "more_secrets"].as_slice(),
["__masked__", "*****", "no_secrets_for_you"].as_slice(),
);
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_request_cookie_mask(
vec!["authorization", "password", "more_secrets"],
vec!["__my_mask__", "*****"],
);
// Mask multiple fields with multiple associated masks
let mut customs_masks = HashMap::new();
customs_masks.insert("authorization", "*****");
customs_masks.insert("password", "hunter2");
customs_masks.insert("more_secrets", "__my_mask__");
let mut masking = Masking::default();
masking.with_request_cookie_mask(
vec!["authorization", "password", "more_secrets"],
customs_masks,
);
sourcepub fn with_request_field_mask_string(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<StringMaskingOption>
)
pub fn with_request_field_mask_string(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<StringMaskingOption>
)
Will mask the specified request body fields with an optional mask.
Supports string fields only. Matches using regex.
If no mask is provided, the value will be masked with the default mask.
If a single mask is provided, it will be used for all fields.
If the number of masks provided is equal to the number of fields, masks will be used in order.
Otherwise, the masks will be used in order until it they are exhausted. If the masks are exhausted, the default mask will be used.
(defaults to "__masked__"
).
Examples
use std::collections::HashMap;
use speakeasy_rust_sdk::{Masking, masking::StringMaskingOption};
// Mask a single field with the default mask
let mut masking = Masking::default();
masking.with_request_field_mask_string("password", StringMaskingOption::default());
// Mask a single field with the default mask just using None
let mut masking = Masking::default();
masking.with_request_field_mask_string("password", None);
// Mask a single field with a custom mask
let mut masking = Masking::default();
masking.with_request_field_mask_string("password", "************");
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_request_field_mask_string(
["authorization", "password", "more_secrets"].as_slice(),
["__masked__", "*****", "no_secrets_for_you"].as_slice(),
);
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_request_field_mask_string(
vec!["authorization", "password", "more_secrets"],
vec!["__my_mask__", "*****"],
);
// Mask multiple fields with multiple associated masks
let mut customs_masks = HashMap::new();
customs_masks.insert("authorization", "*****");
customs_masks.insert("password", "hunter2");
customs_masks.insert("more_secrets", "__my_mask__");
let mut masking = Masking::default();
masking.with_request_field_mask_string(
vec!["authorization", "password", "more_secrets"],
customs_masks
);
sourcepub fn with_request_field_mask_number(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<NumberMaskingOption>
)
pub fn with_request_field_mask_number(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<NumberMaskingOption>
)
with_request_field_mask_number will mask the specified request body fields with an optional mask. Supports number fields only. Matches using regex. If no mask is provided, the value will be masked with the default mask. If a single mask is provided, it will be used for all fields. If the number of masks provided is equal to the number of fields, masks will be used in order. Otherwise, the masks will be used in order until it they are exhausted. If the masks are exhausted, the default mask will be used. (defaults to “-12321”).
Examples
use std::collections::HashMap;
use speakeasy_rust_sdk::{Masking, masking::NumberMaskingOption};
// Mask a single field with the default mask
let mut masking = Masking::default();
masking.with_request_field_mask_number("credit_card", NumberMaskingOption::default());
// Mask a single field with the default mask just using None
let mut masking = Masking::default();
masking.with_request_field_mask_number("SIN", None);
// Mask a single field with a custom mask
let mut masking = Masking::default();
masking.with_request_field_mask_number("SSN", 0);
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_request_field_mask_number(
["authorization", "password", "more_secrets"].as_slice(),
[-1, -2, -3].as_slice(),
);
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_request_field_mask_number(
vec!["authorization", "password", "more_secrets"],
vec![-111111, -222222],
);
// Mask multiple fields with multiple associated masks
let mut customs_masks = HashMap::new();
customs_masks.insert("authorization", -1);
customs_masks.insert("password", -11);
customs_masks.insert("more_secrets", -111);
let mut masking = Masking::default();
masking.with_request_field_mask_number(
vec!["authorization", "password", "more_secrets"],
customs_masks
);
sourcepub fn with_response_field_mask_string(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<StringMaskingOption>
)
pub fn with_response_field_mask_string(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<StringMaskingOption>
)
Will mask the specified response body with an optional mask. Supports string only. Matches using regex.
If no mask is provided, the value will be masked with the default mask.
If a single mask is provided, it will be used for all fields.
If the number of masks provided is equal to the number of fields, masks will be used in order.
Otherwise, the masks will be used in order until it they are exhausted. If the masks are exhausted, the default mask will be used.
(defaults to "__masked__"
).
Examples
use std::collections::HashMap;
use speakeasy_rust_sdk::{Masking, masking::StringMaskingOption};
// Mask a single field with the default mask
let mut masking = Masking::default();
masking.with_response_field_mask_string("password", StringMaskingOption::default());
// Mask a single field with the default mask just using None
let mut masking = Masking::default();
masking.with_response_field_mask_string("password", None);
// Mask a single field with a custom mask
let mut masking = Masking::default();
masking.with_response_field_mask_string("password", "************");
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_response_field_mask_string(
["authorization", "password", "more_secrets"].as_slice(),
["__masked__", "*****", "no_secrets_for_you"].as_slice(),
);
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_response_field_mask_string(
vec!["authorization", "password", "more_secrets"],
vec!["__my_mask__", "*****"],
);
// Mask multiple fields with multiple associated masks
let mut customs_masks = HashMap::new();
customs_masks.insert("authorization", "*****");
customs_masks.insert("password", "hunter2");
customs_masks.insert("more_secrets", "__my_mask__");
let mut masking = Masking::default();
masking.with_response_field_mask_string(
vec!["authorization", "password", "more_secrets"],
customs_masks
);
sourcepub fn with_response_field_mask_number(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<NumberMaskingOption>
)
pub fn with_response_field_mask_number(
&mut self,
fields: impl Into<Fields>,
masking_option: impl Into<NumberMaskingOption>
)
with_response_field_mask_number will mask the specified response body with an optional mask. Supports number fields only. Matches using regex. If no mask is provided, the value will be masked with the default mask. If a single mask is provided, it will be used for all fields. If the number of masks provided is equal to the number of fields, masks will be used in order. Otherwise, the masks will be used in order until it they are exhausted. If the masks are exhausted, the default mask will be used. (defaults to “-12321”).
Examples
use std::collections::HashMap;
use speakeasy_rust_sdk::{Masking, masking::NumberMaskingOption};
// Mask a single field with the default mask
let mut masking = Masking::default();
masking.with_response_field_mask_number("credit_card", NumberMaskingOption::default());
// Mask a single field with the default mask just using None
let mut masking = Masking::default();
masking.with_response_field_mask_number("SIN", None);
// Mask a single field with a custom mask
let mut masking = Masking::default();
masking.with_response_field_mask_number("SSN", 0);
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_response_field_mask_number(
["authorization", "password", "more_secrets"].as_slice(),
[-1, -2, -3].as_slice(),
);
// Mask multiple fields with a multiple masks
let mut masking = Masking::default();
masking.with_response_field_mask_number(
vec!["authorization", "password", "more_secrets"],
vec![-111111, -222222],
);
// Mask multiple fields with multiple associated masks
let mut customs_masks = HashMap::new();
customs_masks.insert("authorization", -1);
customs_masks.insert("password", -11);
customs_masks.insert("more_secrets", -111);
let mut masking = Masking::default();
masking.with_response_field_mask_number(
vec!["authorization", "password", "more_secrets"],
customs_masks
);
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Masking
impl Send for Masking
impl Sync for Masking
impl Unpin for Masking
impl UnwindSafe for Masking
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request