enhance ListSVCs() API to return more info to avoid InfoSvc() (#19642)

ConsoleUI like applications rely on combination of

ListServiceAccounts() and InfoServiceAccount() to populate
UI elements, however individually these calls can be slow
causing the entire UI to load sluggishly.
This commit is contained in:
Harshavardhana
2024-05-01 05:41:13 -07:00
committed by GitHub
parent 0e2148264a
commit 08ff702434
4 changed files with 18 additions and 5 deletions

View File

@@ -156,6 +156,14 @@ func (cred Credentials) IsServiceAccount() bool {
return cred.ParentUser != "" && ok
}
// IsImpliedPolicy - returns if the policy is implied via ParentUser or not.
func (cred Credentials) IsImpliedPolicy() bool {
if cred.IsServiceAccount() {
return cred.Claims[iamPolicyClaimNameSA] == "inherited-policy"
}
return false
}
// IsValid - returns whether credential is valid or not.
func (cred Credentials) IsValid() bool {
// Verify credentials if its enabled or not set.