Skip to content

Commit 97dfde0

Browse files
committed
fmt: standardize formatting for EKS Pod Identity provider
1 parent d7d0201 commit 97dfde0

File tree

2 files changed

+29
-13
lines changed

2 files changed

+29
-13
lines changed

services/aws-v4/src/provide_credential/default.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
use crate::Credential;
1919
use crate::provide_credential::{
20-
AssumeRoleWithWebIdentityCredentialProvider, ECSCredentialProvider, EKSPodIdentityCredentialProvider,
21-
EnvCredentialProvider, IMDSv2CredentialProvider, ProfileCredentialProvider,
20+
AssumeRoleWithWebIdentityCredentialProvider, ECSCredentialProvider,
21+
EKSPodIdentityCredentialProvider, EnvCredentialProvider, IMDSv2CredentialProvider,
22+
ProfileCredentialProvider,
2223
};
2324
#[cfg(not(target_arch = "wasm32"))]
2425
use crate::provide_credential::{ProcessCredentialProvider, SSOCredentialProvider};

services/aws-v4/src/provide_credential/eks_pod_identity.rs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,19 @@ impl ProvideCredential for EKSPodIdentityCredentialProvider {
160160
let endpoint = match self.get_endpoint(ctx) {
161161
Some(ep) => ep,
162162
None => {
163-
debug!("EKS Pod Identity provider: no endpoint found, not running in EKS Pod Identity environment");
163+
debug!(
164+
"EKS Pod Identity provider: no endpoint found, not running in EKS Pod Identity environment"
165+
);
164166
return Ok(None);
165167
}
166168
};
167169

168170
let token_file = match self.get_token_file(ctx) {
169171
Some(tf) => tf,
170172
None => {
171-
debug!("EKS Pod Identity provider: no token file found, not running in EKS Pod Identity environment");
173+
debug!(
174+
"EKS Pod Identity provider: no token file found, not running in EKS Pod Identity environment"
175+
);
172176
return Ok(None);
173177
}
174178
};
@@ -293,7 +297,10 @@ mod tests {
293297

294298
let provider = EKSPodIdentityCredentialProvider::new();
295299
let endpoint = provider.get_endpoint(&ctx);
296-
assert_eq!(endpoint, Some("http://169.254.170.23/v1/credentials".to_string()));
300+
assert_eq!(
301+
endpoint,
302+
Some("http://169.254.170.23/v1/credentials".to_string())
303+
);
297304
}
298305

299306
#[tokio::test]
@@ -311,7 +318,10 @@ mod tests {
311318

312319
let provider = EKSPodIdentityCredentialProvider::new();
313320
let endpoint = provider.get_endpoint(&ctx);
314-
assert!(endpoint.is_none(), "Should not use ECS endpoint for EKS Pod Identity");
321+
assert!(
322+
endpoint.is_none(),
323+
"Should not use ECS endpoint for EKS Pod Identity"
324+
);
315325
}
316326

317327
#[tokio::test]
@@ -328,7 +338,10 @@ mod tests {
328338
.with_endpoint("http://custom-endpoint/v1/credentials");
329339

330340
let endpoint = provider.get_endpoint(&ctx);
331-
assert_eq!(endpoint, Some("http://custom-endpoint/v1/credentials".to_string()));
341+
assert_eq!(
342+
endpoint,
343+
Some("http://custom-endpoint/v1/credentials".to_string())
344+
);
332345
}
333346

334347
#[tokio::test]
@@ -340,15 +353,19 @@ mod tests {
340353
home_dir: None,
341354
envs: HashMap::from_iter([(
342355
AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE.to_string(),
343-
"/var/run/secrets/pods.eks.amazonaws.com/serviceaccount/eks-pod-identity-token".to_string(),
356+
"/var/run/secrets/pods.eks.amazonaws.com/serviceaccount/eks-pod-identity-token"
357+
.to_string(),
344358
)]),
345359
});
346360

347361
let provider = EKSPodIdentityCredentialProvider::new();
348362
let token_file = provider.get_token_file(&ctx);
349363
assert_eq!(
350364
token_file,
351-
Some("/var/run/secrets/pods.eks.amazonaws.com/serviceaccount/eks-pod-identity-token".to_string())
365+
Some(
366+
"/var/run/secrets/pods.eks.amazonaws.com/serviceaccount/eks-pod-identity-token"
367+
.to_string()
368+
)
352369
);
353370
}
354371

@@ -362,12 +379,10 @@ mod tests {
362379
envs: HashMap::new(),
363380
});
364381

365-
let provider = EKSPodIdentityCredentialProvider::new()
366-
.with_token_file("/custom/token/path");
382+
let provider =
383+
EKSPodIdentityCredentialProvider::new().with_token_file("/custom/token/path");
367384

368385
let token_file = provider.get_token_file(&ctx);
369386
assert_eq!(token_file, Some("/custom/token/path".to_string()));
370387
}
371388
}
372-
373-

0 commit comments

Comments
 (0)