pub struct DataverseSourceBuilder { /* private fields */ }Expand description
Builder for DataverseSource instances.
Provides a fluent API for constructing Dataverse sources with sensible defaults.
The builder takes the source ID at construction and returns a fully constructed
DataverseSource from build().
§Example
let source = DataverseSource::builder("dv-source")
.with_environment_url("https://myorg.crm.dynamics.com")
.with_tenant_id("tenant-id")
.with_client_id("client-id")
.with_client_secret("client-secret")
.with_entities(vec!["account".to_string()])
.build()?;Implementations§
Source§impl DataverseSourceBuilder
impl DataverseSourceBuilder
Sourcepub fn with_environment_url(self, url: impl Into<String>) -> Self
pub fn with_environment_url(self, url: impl Into<String>) -> Self
Set the Dataverse environment URL.
Sourcepub fn with_tenant_id(self, tenant_id: impl Into<String>) -> Self
pub fn with_tenant_id(self, tenant_id: impl Into<String>) -> Self
Set the Azure AD tenant ID.
Sourcepub fn with_client_id(self, client_id: impl Into<String>) -> Self
pub fn with_client_id(self, client_id: impl Into<String>) -> Self
Set the Azure AD client ID.
Sourcepub fn with_client_secret(self, client_secret: impl Into<String>) -> Self
pub fn with_client_secret(self, client_secret: impl Into<String>) -> Self
Set the Azure AD client secret.
Sourcepub fn with_azure_cli_auth(self) -> Self
pub fn with_azure_cli_auth(self) -> Self
Use Azure CLI for authentication instead of client credentials.
When enabled, the source acquires tokens by running
az account get-access-token --resource <environment_url>.
Requires az login to have been run beforehand.
This is the simplest auth option for local development and testing.
When using Azure CLI auth, tenant_id, client_id, and client_secret are not required.
Sourcepub fn with_identity_provider(
self,
provider: impl IdentityProvider + 'static,
) -> Self
pub fn with_identity_provider( self, provider: impl IdentityProvider + 'static, ) -> Self
Set an identity provider for token acquisition.
When an identity provider is set, it takes precedence over
tenant_id/client_id/client_secret and use_azure_cli.
The provider’s get_credentials() must return Credentials::Token.
This enables using any of the platform’s identity providers, including:
AzureIdentityProvider::with_client_secret(...)for client credentialsAzureIdentityProvider::with_default_credentials(...)for managed identityAzureIdentityProvider::with_developer_tools(...)for local dev (CLI, azd, PS)AzureIdentityProvider::with_workload_identity(...)for Kubernetes workloads
§Example
use drasi_lib::identity::AzureIdentityProvider;
use drasi_source_dataverse::DataverseSource;
let provider = AzureIdentityProvider::with_client_secret(
"tenant-id", "client-id", "client-secret", "dataverse",
)?
.with_scope("https://myorg.crm.dynamics.com/.default");
let source = DataverseSource::builder("dv-source")
.with_environment_url("https://myorg.crm.dynamics.com")
.with_entities(vec!["account".to_string()])
.with_identity_provider(provider)
.build()?;Sourcepub fn with_entities(self, entities: Vec<String>) -> Self
pub fn with_entities(self, entities: Vec<String>) -> Self
Set the list of entity logical names to monitor.
Sourcepub fn with_entity(self, entity: impl Into<String>) -> Self
pub fn with_entity(self, entity: impl Into<String>) -> Self
Add a single entity to monitor.
Sourcepub fn with_entity_set_override(
self,
entity_name: impl Into<String>,
entity_set_name: impl Into<String>,
) -> Self
pub fn with_entity_set_override( self, entity_name: impl Into<String>, entity_set_name: impl Into<String>, ) -> Self
Override the entity set name for a specific entity.
Sourcepub fn with_entity_columns(
self,
entity: impl Into<String>,
columns: Vec<String>,
) -> Self
pub fn with_entity_columns( self, entity: impl Into<String>, columns: Vec<String>, ) -> Self
Set column selection for a specific entity.
Sourcepub fn with_min_interval_ms(self, ms: u64) -> Self
pub fn with_min_interval_ms(self, ms: u64) -> Self
Set the minimum adaptive polling interval in milliseconds.
Sourcepub fn with_max_interval_seconds(self, seconds: u64) -> Self
pub fn with_max_interval_seconds(self, seconds: u64) -> Self
Set the maximum adaptive polling interval in seconds.
Sourcepub fn with_api_version(self, version: impl Into<String>) -> Self
pub fn with_api_version(self, version: impl Into<String>) -> Self
Set the Dataverse Web API version.
Sourcepub fn with_dispatch_mode(self, mode: DispatchMode) -> Self
pub fn with_dispatch_mode(self, mode: DispatchMode) -> Self
Set the dispatch mode.
Sourcepub fn with_dispatch_buffer_capacity(self, capacity: usize) -> Self
pub fn with_dispatch_buffer_capacity(self, capacity: usize) -> Self
Set the dispatch buffer capacity.
Sourcepub fn with_bootstrap_provider(
self,
provider: impl BootstrapProvider + 'static,
) -> Self
pub fn with_bootstrap_provider( self, provider: impl BootstrapProvider + 'static, ) -> Self
Set the bootstrap provider for initial data delivery.
Sourcepub fn with_auto_start(self, auto_start: bool) -> Self
pub fn with_auto_start(self, auto_start: bool) -> Self
Set whether this source should auto-start when DrasiLib starts.
Sourcepub fn build(self) -> Result<DataverseSource>
pub fn build(self) -> Result<DataverseSource>
Build the DataverseSource instance.