Skip to main content

DataverseSourceConfig

Struct DataverseSourceConfig 

Source
pub struct DataverseSourceConfig {
    pub environment_url: String,
    pub tenant_id: String,
    pub client_id: String,
    pub client_secret: String,
    pub use_azure_cli: bool,
    pub entities: Vec<String>,
    pub entity_set_overrides: HashMap<String, String>,
    pub entity_columns: HashMap<String, Vec<String>>,
    pub min_interval_ms: u64,
    pub max_interval_seconds: u64,
    pub api_version: String,
}
Expand description

Configuration for the Dataverse replication source.

Mirrors the platform Dataverse source configuration which uses RetrieveEntityChangesRequest for change tracking. In the Rust/Web API implementation, this is achieved via OData change tracking with Prefer: odata.track-changes headers and delta links.

§Required Configuration

  • environment_url: The Dataverse environment URL (e.g., https://myorg.crm.dynamics.com)
  • entities: List of entity logical names to monitor (e.g., ["account", "contact"])
  • Authentication (one of):
    • Identity provider via [DataverseSource::builder] .with_identity_provider() (recommended)
    • tenant_id + client_id + client_secret for client credentials flow
    • use_azure_cli = true for Azure CLI authentication (local dev)

§Optional Configuration

  • entity_set_overrides: Override computed entity set names for specific entities
  • min_interval_ms: Minimum adaptive polling interval (default: 500)
  • max_interval_seconds: Maximum adaptive polling interval (default: 30)
  • api_version: Dataverse Web API version (default: v9.2)

Fields§

§environment_url: String

Dataverse environment URL (e.g., https://myorg.crm.dynamics.com).

§tenant_id: String

Azure AD / Microsoft Entra ID tenant ID for OAuth2 authentication. Required for client credentials flow, ignored when use_azure_cli is true.

§client_id: String

Azure AD application (client) ID. Required for client credentials flow, ignored when use_azure_cli is true.

§client_secret: String

Azure AD client secret for OAuth2 client credentials flow. Required for client credentials flow, ignored when use_azure_cli is true.

§use_azure_cli: bool

Use Azure CLI (az account get-access-token) for authentication. When true, tenant_id, client_id, and client_secret are not required. Requires az login to have been run beforehand.

§entities: Vec<String>

List of entity logical names to monitor (e.g., ["account", "contact"]). These are the singular logical names matching the platform’s RetrieveEntityChangesRequest.EntityName parameter.

§entity_set_overrides: HashMap<String, String>

Override the entity set name (Web API plural form) for specific entities. By default, entity set names are derived by appending ‘s’ to the logical name. Use this for entities with non-standard pluralization.

Example: {"activityparty": "activityparties"}

§entity_columns: HashMap<String, Vec<String>>

Per-entity column selection. If an entity is not in this map, all columns are retrieved (equivalent to ColumnSet(true) in the SDK).

§min_interval_ms: u64

Minimum adaptive polling interval in milliseconds (default: 500). Matches the platform’s MinIntervalMs = 500.

§max_interval_seconds: u64

Maximum adaptive polling interval per entity in seconds (default: 30). This is the single-entity base value, matching the platform’s SingleEntityMaxIntervalMs / 1000. At startup, the effective max is scaled by sqrt(entity_count) (e.g., 1 entity → 30s, 5 → 67s, 10 → 95s).

§api_version: String

Dataverse Web API version (default: v9.2).

Implementations§

Source§

impl DataverseSourceConfig

Source

pub fn validate(&self) -> Result<(), String>

Validate the configuration, returning an error if required fields are missing.

Source

pub fn validate_with_identity_provider(&self) -> Result<(), String>

Validate config when an external identity provider handles authentication.

Only checks that environment_url and entities are set — credential fields (tenant_id, client_id, client_secret) are not required because the identity provider supplies tokens directly.

Source

pub fn entity_set_name(&self, entity: &str) -> String

Get the entity set name (plural form) for a given entity logical name.

First checks entity_set_overrides, then falls back to appending ‘s’. This mirrors how the platform’s RetrieveEntityChangesRequest uses entity logical names but the Web API requires entity set names.

Source

pub fn select_columns(&self, entity: &str) -> Option<String>

Get the $select clause for a given entity, or None for all columns.

Ensures that the primary key column ({entity}id) is always included when a column list is configured, to keep change tracking and bootstrap logic functional.

Trait Implementations§

Source§

impl Clone for DataverseSourceConfig

Source§

fn clone(&self) -> DataverseSourceConfig

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 DataverseSourceConfig

Manual Debug implementation that redacts client_secret so it cannot leak through tracing, panic messages, or any {:?} formatting.

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: 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: 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> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

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