pub struct SimpleAuthProvider { /* private fields */ }Expand description
Simple authentication provider that holds credentials directly in memory
This is the Rust equivalent of TypeScript SDK’s SimpleAuthenticationDetailsProvider. It provides a straightforward way to create an authentication provider with credentials provided directly, without reading from configuration files.
§Example
use oci_rust_sdk::auth::{SimpleAuthProvider, SimpleAuthProviderRequiredFields};
use oci_rust_sdk::core::Region;
let required = SimpleAuthProviderRequiredFields {
tenancy: "ocid1.tenancy.oc1..aaa...".to_string(),
user: "ocid1.user.oc1..aaa...".to_string(),
fingerprint: "aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99".to_string(),
private_key: "-----BEGIN RSA PRIVATE KEY-----\n...".to_string(),
};
let provider = SimpleAuthProvider::builder(required)
.region(Region::ApSeoul1)
.build();Implementations§
Source§impl SimpleAuthProvider
impl SimpleAuthProvider
Sourcepub fn new(
tenancy: impl Into<String>,
user: impl Into<String>,
fingerprint: impl Into<String>,
private_key: impl Into<String>,
) -> Self
pub fn new( tenancy: impl Into<String>, user: impl Into<String>, fingerprint: impl Into<String>, private_key: impl Into<String>, ) -> Self
Create a new SimpleAuthProvider with required fields
§Arguments
tenancy- Tenancy OCIDuser- User OCIDfingerprint- Public key fingerprintprivate_key- Private key in PEM format
Sourcepub fn builder(
required: SimpleAuthProviderRequiredFields,
) -> SimpleAuthProviderBuilder
pub fn builder( required: SimpleAuthProviderRequiredFields, ) -> SimpleAuthProviderBuilder
Create a builder for constructing a SimpleAuthProvider
Sourcepub fn fingerprint(&self) -> &str
pub fn fingerprint(&self) -> &str
Get the fingerprint
Sourcepub fn set_region(&mut self, region: Region)
pub fn set_region(&mut self, region: Region)
Set the region
Sourcepub fn with_region(self, region: Region) -> Self
pub fn with_region(self, region: Region) -> Self
Set the region (builder style)
Sourcepub fn set_auth_type(&mut self, auth_type: impl Into<String>)
pub fn set_auth_type(&mut self, auth_type: impl Into<String>)
Set the authentication type
Sourcepub fn with_auth_type(self, auth_type: impl Into<String>) -> Self
pub fn with_auth_type(self, auth_type: impl Into<String>) -> Self
Set the authentication type (builder style)
Sourcepub fn delegation_token(&self) -> Option<&str>
pub fn delegation_token(&self) -> Option<&str>
Get the delegation token
Sourcepub fn set_delegation_token(&mut self, token: impl Into<String>)
pub fn set_delegation_token(&mut self, token: impl Into<String>)
Set the delegation token
Sourcepub fn with_delegation_token(self, token: impl Into<String>) -> Self
pub fn with_delegation_token(self, token: impl Into<String>) -> Self
Set the delegation token (builder style)
Sourcepub fn session_token(&self) -> Option<&str>
pub fn session_token(&self) -> Option<&str>
Get the session token
Sourcepub fn set_session_token(&mut self, token: impl Into<String>)
pub fn set_session_token(&mut self, token: impl Into<String>)
Set the session token
Sourcepub fn with_session_token(self, token: impl Into<String>) -> Self
pub fn with_session_token(self, token: impl Into<String>) -> Self
Set the session token (builder style)
Trait Implementations§
Source§impl AuthProvider for SimpleAuthProvider
impl AuthProvider for SimpleAuthProvider
Source§fn get_key_id(&self) -> String
fn get_key_id(&self) -> String
Get the key ID (e.g., “ocid1.tenancy.oc1..xxxxx/ocid1.user.oc1..xxxxx/fingerprint”)
Source§fn get_private_key(&self) -> &str
fn get_private_key(&self) -> &str
Get the private key in PEM format
Source§fn get_passphrase(&self) -> Option<&str>
fn get_passphrase(&self) -> Option<&str>
Get the passphrase for the private key (if any)
Source§impl Clone for SimpleAuthProvider
impl Clone for SimpleAuthProvider
Source§fn clone(&self) -> SimpleAuthProvider
fn clone(&self) -> SimpleAuthProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SimpleAuthProvider
impl RefUnwindSafe for SimpleAuthProvider
impl Send for SimpleAuthProvider
impl Sync for SimpleAuthProvider
impl Unpin for SimpleAuthProvider
impl UnsafeUnpin for SimpleAuthProvider
impl UnwindSafe for SimpleAuthProvider
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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