pub struct Masking { /* private fields */ }
Expand description

All masking options, see functions for more details on setting them

Implementations§

source§

impl Masking

source

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,
);
source

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,
);
source

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,
);
source

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
);
source

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
);
source

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
);
source

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§

source§

impl Clone for Masking

source§

fn clone(&self) -> Masking

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Masking

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Masking

source§

fn default() -> Masking

Returns the “default value” for a type. Read more
source§

impl From<Masking> for MaskingMetadata

source§

fn from(masking: Masking) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for Twhere T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more