Struct google_cloud_auth::credentials::CredentialsFile
source · pub struct CredentialsFile {Show 17 fields
pub tp: String,
pub client_email: Option<String>,
pub private_key_id: Option<String>,
pub private_key: Option<String>,
pub auth_uri: Option<String>,
pub token_uri: Option<String>,
pub project_id: Option<String>,
pub client_secret: Option<String>,
pub client_id: Option<String>,
pub refresh_token: Option<String>,
pub audience: Option<String>,
pub subject_token_type: Option<String>,
pub token_url_external: Option<String>,
pub token_info_url: Option<String>,
pub service_account_impersonation_url: Option<String>,
pub credential_source: Option<CredentialSource>,
pub quota_project_id: Option<String>,
}Fields§
§tp: String§client_email: Option<String>§private_key_id: Option<String>§private_key: Option<String>§auth_uri: Option<String>§token_uri: Option<String>§project_id: Option<String>§client_secret: Option<String>§client_id: Option<String>§refresh_token: Option<String>§audience: Option<String>§subject_token_type: Option<String>§token_url_external: Option<String>§token_info_url: Option<String>§service_account_impersonation_url: Option<String>§credential_source: Option<CredentialSource>§quota_project_id: Option<String>Implementations§
source§impl CredentialsFile
impl CredentialsFile
sourcepub async fn new() -> Result<Self, Error>
pub async fn new() -> Result<Self, Error>
Examples found in repository?
src/lib.rs (line 67)
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
pub async fn project() -> Result<Project, error::Error> {
let credentials = credentials::CredentialsFile::new().await;
match credentials {
Ok(credentials) => Ok(Project::FromFile(Box::new(credentials))),
Err(e) => {
if on_gce().await {
let project_id = google_cloud_metadata::project_id().await;
Ok(Project::FromMetadataServer(ProjectInfo {
project_id: if project_id.is_empty() { None } else { Some(project_id) },
}))
} else {
Err(e)
}
}
}
}Trait Implementations§
source§impl Clone for CredentialsFile
impl Clone for CredentialsFile
source§fn clone(&self) -> CredentialsFile
fn clone(&self) -> CredentialsFile
Returns a copy 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 moresource§impl<'de> Deserialize<'de> for CredentialsFile
impl<'de> Deserialize<'de> for CredentialsFile
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more