pub struct Profile { /* private fields */ }Expand description
Delta Sharing profile.
The Delta Sharing profile is used to connect with a Delta Sharing server. The profile contains the endpoint and authentication information to make a succesful connection.
Implementations§
Source§impl Profile
impl Profile
Sourcepub fn try_from_path<P: AsRef<Path>>(path: P) -> Result<Self, DeltaSharingError>
pub fn try_from_path<P: AsRef<Path>>(path: P) -> Result<Self, DeltaSharingError>
Try to create a new Delta Sharing profile from a profile file.
§Example
use datafusion_delta_sharing::Profile;
let profile = Profile::try_from_path("./path/to/profile.json")?;Sourcepub fn from_profile_type(
share_credentials_version: u32,
endpoint: Url,
profile_type: ProfileType,
) -> Self
pub fn from_profile_type( share_credentials_version: u32, endpoint: Url, profile_type: ProfileType, ) -> Self
Create a new Delta Sharing profile with a profile type.
§Example
use datafusion_delta_sharing::{Profile, profile::ProfileType};
use url::Url;
let version = 1;
let endpoint = Url::parse("https://sharing.delta.io/delta-sharing/").unwrap();
let profile_type = ProfileType::new_bearer_token("foo", None);
let profile = Profile::from_profile_type(version, endpoint.clone(), profile_type);
assert_eq!(profile.share_credentials_version(), 1);
assert_eq!(profile.endpoint(), &endpoint);
assert!(profile.is_bearer_token());Retrieve the share credentials version from the profile.
§Example
use datafusion_delta_sharing::{Profile, profile::ProfileType};
use url::Url;
let version = 1;
let endpoint = "https://sharing.delta.io/delta-sharing/".parse::<Url>().unwrap();
let profile_type = ProfileType::new_bearer_token("token", None);
let profile = Profile::from_profile_type(1, endpoint, profile_type);
assert_eq!(profile.share_credentials_version(), 1);Sourcepub fn endpoint(&self) -> &Url
pub fn endpoint(&self) -> &Url
Retrieve the endpoint from the profile.
§Example
use datafusion_delta_sharing::{Profile, profile::ProfileType};
use url::Url;
let version = 1;
let endpoint = "https://sharing.delta.io/delta-sharing/".parse::<Url>().unwrap();
let profile_type = ProfileType::new_bearer_token("token", None);
let profile = Profile::from_profile_type(1, endpoint.clone(), profile_type);
assert_eq!(profile.endpoint(), &endpoint);Sourcepub fn new_bearer_token(
version: u32,
endpoint: impl Into<String>,
bearer_token: impl Into<String>,
expiration_time: Option<DateTime<Utc>>,
) -> Self
pub fn new_bearer_token( version: u32, endpoint: impl Into<String>, bearer_token: impl Into<String>, expiration_time: Option<DateTime<Utc>>, ) -> Self
Create a new Delta Sharing profile using a bearer token.
§Example
use datafusion_delta_sharing::Profile;
let profile = Profile::new_bearer_token(1, "https://sharing.delta.io/delta-sharing/", "token", None);
assert!(profile.is_bearer_token());Sourcepub fn is_bearer_token(&self) -> bool
pub fn is_bearer_token(&self) -> bool
Check if the profile is a bearer token profile.
§Example
use datafusion_delta_sharing::{Profile, profile::ProfileType};
use url::Url;
let version = 1;
let endpoint = "https://sharing.delta.io/delta-sharing/".parse::<Url>().unwrap();
let profile_type = ProfileType::new_bearer_token("token", None);
let profile = Profile::from_profile_type(1, endpoint, profile_type);
assert!(profile.is_bearer_token());Trait Implementations§
Auto Trait Implementations§
impl Freeze for Profile
impl RefUnwindSafe for Profile
impl Send for Profile
impl Sync for Profile
impl Unpin for Profile
impl UnwindSafe for Profile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more