Skip to content

Commit

Permalink
Rename DefaultServiceAccount to MetadataServiceAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Jun 30, 2023
1 parent 166406b commit 6e6a440
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/authentication_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use tokio::sync::Mutex;

use crate::custom_service_account::CustomServiceAccount;
use crate::default_authorized_user::ConfigDefaultCredentials;
use crate::default_service_account::DefaultServiceAccount;
use crate::default_service_account::MetadataServiceAccount;
use crate::error::Error;
use crate::gcloud_authorized_user::GCloudAuthorizedUser;
use crate::types::{self, HyperClient, Token};
Expand Down Expand Up @@ -56,9 +56,9 @@ impl AuthenticationManager {
Err(e) => e,
};

let default_service_error = match DefaultServiceAccount::new(&client).await {
let default_service_error = match MetadataServiceAccount::new(&client).await {
Ok(service_account) => {
tracing::debug!("Using DefaultServiceAccount");
tracing::debug!("Using MetadataServiceAccount");
return Ok(Self::build(client, service_account));
}
Err(e) => e,
Expand Down
6 changes: 3 additions & 3 deletions src/default_service_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ use crate::types::{HyperClient, Token};
use crate::util::HyperExt;

#[derive(Debug)]
pub(crate) struct DefaultServiceAccount {
pub(crate) struct MetadataServiceAccount {
token: RwLock<Token>,
}

impl DefaultServiceAccount {
impl MetadataServiceAccount {
const DEFAULT_PROJECT_ID_GCP_URI: &'static str =
"http://metadata.google.internal/computeMetadata/v1/project/project-id";
const DEFAULT_TOKEN_GCP_URI: &'static str = "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token";
Expand Down Expand Up @@ -61,7 +61,7 @@ impl DefaultServiceAccount {
}

#[async_trait]
impl ServiceAccount for DefaultServiceAccount {
impl ServiceAccount for MetadataServiceAccount {
async fn project_id(&self, client: &HyperClient) -> Result<String, Error> {
tracing::debug!("Getting project ID from GCP instance metadata server");
let req = Self::build_token_request(Self::DEFAULT_PROJECT_ID_GCP_URI);
Expand Down

0 comments on commit 6e6a440

Please sign in to comment.