Skip to main content

PurviewSettings

Struct PurviewSettings 

Source
pub struct PurviewSettings {
    pub app_name: String,
    pub app_version: Option<String>,
    pub tenant_id: Option<String>,
    pub purview_app_location: Option<PurviewAppLocation>,
    pub graph_base_uri: String,
    pub blocked_prompt_message: String,
    pub blocked_response_message: String,
    pub ignore_exceptions: bool,
    pub ignore_payment_required: bool,
    pub cache_ttl_seconds: u64,
    pub max_cache_size_bytes: u64,
}
Expand description

Settings for Purview integration. Mirrors Python’s PurviewSettings (an AFBaseSettings/pydantic model there; a plain builder-style struct here — this port has no environment-variable-driven construction for it, since Python’s PurviewSettings isn’t env-prefixed either, unlike agent-framework-copilotstudio’s CopilotStudioSettings).

Fields§

§app_name: String

Required: the calling application’s display/logical name. Sent as both integratedAppMetadata.name and protectedAppMetadata.name.

§app_version: Option<String>§tenant_id: Option<String>

The tenant id (GUID) evaluated requests are scoped to. Python can also infer this from the bearer token’s tid claim when unset; this port requires it to be set explicitly — see the crate docs’ “Scope” section (no JWT introspection here).

§purview_app_location: Option<PurviewAppLocation>

Where the calling application is considered to run, for policy location matching. Python can also infer an application-type location from the bearer token’s appid claim when unset; this port requires it to be set explicitly, for the same reason as tenant_id.

§graph_base_uri: String§blocked_prompt_message: String§blocked_response_message: String§ignore_exceptions: bool

If true, a policy-evaluation failure (any error other than a 402 — see Self::ignore_payment_required) is logged and swallowed (fail-open: the run proceeds as if evaluation passed) instead of propagated.

§ignore_payment_required: bool

If true, a 402 Payment Required response is logged and swallowed instead of propagated — checked independently of Self::ignore_exceptions, mirroring Python’s separate except PurviewPaymentRequiredError clause (checked before, and independently of, the generic exception handler).

§cache_ttl_seconds: u64

Carried for settings parity with Python; this port does not cache protection-scopes responses (see the crate docs), so this value is currently unused.

§max_cache_size_bytes: u64

Implementations§

Source§

impl PurviewSettings

Source

pub fn new(app_name: impl Into<String>) -> Self

app_name is Purview’s only required setting; everything else takes Python’s documented defaults.

Source

pub fn with_app_version(self, version: impl Into<String>) -> Self

Source

pub fn with_tenant_id(self, tenant_id: impl Into<String>) -> Self

Source

pub fn with_purview_app_location(self, location: PurviewAppLocation) -> Self

Source

pub fn with_graph_base_uri(self, uri: impl Into<String>) -> Self

Source

pub fn with_blocked_prompt_message(self, message: impl Into<String>) -> Self

Source

pub fn with_blocked_response_message(self, message: impl Into<String>) -> Self

Source

pub fn with_ignore_exceptions(self, value: bool) -> Self

Source

pub fn with_ignore_payment_required(self, value: bool) -> Self

Source

pub fn with_cache_ttl_seconds(self, ttl: u64) -> Self

Source

pub fn with_max_cache_size_bytes(self, bytes: u64) -> Self

Source

pub fn get_scopes(&self) -> Vec<String>

The Microsoft Graph OAuth scope(s) required for this base URI: https://{host}/.default. Mirrors PurviewSettings.get_scopes.

Trait Implementations§

Source§

impl Clone for PurviewSettings

Source§

fn clone(&self) -> PurviewSettings

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PurviewSettings

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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 T
where U: From<T>,

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
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