Struct gcp_auth::CustomServiceAccount
source · pub struct CustomServiceAccount { /* private fields */ }
Expand description
A custom service account containing credentials
Once initialized, a CustomServiceAccount
can be converted into an AuthenticationManager
using the applicable From
implementation.
Implementations§
source§impl CustomServiceAccount
impl CustomServiceAccount
sourcepub fn from_env() -> Result<Option<Self>, Error>
pub fn from_env() -> Result<Option<Self>, Error>
Check GOOGLE_APPLICATION_CREDENTIALS
environment variable for a path to JSON credentials
sourcepub fn from_file<T: AsRef<Path>>(path: T) -> Result<Self, Error>
pub fn from_file<T: AsRef<Path>>(path: T) -> Result<Self, Error>
Read service account credentials from the given JSON file
sourcepub fn from_json(s: &str) -> Result<Self, Error>
pub fn from_json(s: &str) -> Result<Self, Error>
Read service account credentials from the given JSON string
sourcepub fn with_subject(self, subject: String) -> Self
pub fn with_subject(self, subject: String) -> Self
Set the subject
to impersonate a user
sourcepub fn project_id(&self) -> Option<&str>
pub fn project_id(&self) -> Option<&str>
The project ID as found in the credentials
sourcepub fn private_key_pem(&self) -> &str
pub fn private_key_pem(&self) -> &str
The private key as found in the credentials
Trait Implementations§
source§impl Debug for CustomServiceAccount
impl Debug for CustomServiceAccount
source§impl TokenProvider for CustomServiceAccount
impl TokenProvider for CustomServiceAccount
source§fn token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scopes: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Arc<Token>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scopes: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Arc<Token>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get a valid token for the given scopes Read more
Auto Trait Implementations§
impl !Freeze for CustomServiceAccount
impl !RefUnwindSafe for CustomServiceAccount
impl Send for CustomServiceAccount
impl Sync for CustomServiceAccount
impl Unpin for CustomServiceAccount
impl !UnwindSafe for CustomServiceAccount
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