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

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

Implementations

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

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

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

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

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

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

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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

Wrap the input message T in a tonic::Request
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more