Add expiration to ListServiceAccounts function (#17249)

This commit is contained in:
Kaan Kabalak
2023-06-02 16:17:26 -07:00
committed by GitHub
parent b210ea79bc
commit 0649aca219
4 changed files with 24 additions and 16 deletions
+7 -3
View File
@@ -1123,14 +1123,18 @@ func (a adminAPIHandlers) ListServiceAccounts(w http.ResponseWriter, r *http.Req
return
}
var serviceAccountsNames []string
var serviceAccountList []madmin.ServiceAccountInfo
for _, svc := range serviceAccounts {
serviceAccountsNames = append(serviceAccountsNames, svc.AccessKey)
expiryTime := svc.Expiration
serviceAccountList = append(serviceAccountList, madmin.ServiceAccountInfo{
AccessKey: svc.AccessKey,
Expiration: &expiryTime,
})
}
listResp := madmin.ListServiceAccountsResp{
Accounts: serviceAccountsNames,
Accounts: serviceAccountList,
}
data, err := json.Marshal(listResp)