1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-14 16:31:45 +05:30

Implement client.List, change list API

[]string, []string -> map[string]string because the other APIs assume a
1:1 correspondence

Signed-off-by: Jake Sanders <jsand@google.com>
This commit is contained in:
Jake Sanders
2016-09-02 15:12:18 -07:00
parent 80833adff5
commit c45d9e9e28
11 changed files with 71 additions and 75 deletions
+7 -5
View File
@@ -38,16 +38,18 @@ func (h Wincred) Get(serverURL string) (string, string, error) {
return g.UserName, string(g.CredentialBlob), nil
}
func (h Wincred) List() ([]string, []string, error) {
// List returns the stored URLs and corresponding usernames.
func (h Wincred) List() (map[string]string, error) {
creds, err := winc.List()
paths := make([]string, len(creds))
accts := make([]string, len(creds))
if err != nil {
return nil, nil, err
return nil, err
}
resp := make(map[string]string)
for i := range creds {
paths[i] = creds[i].TargetName
accts[i] = creds[i].UserName
resp[creds[i].TargetName] = creds[i].UserName
}
return paths, accts, nil
return resp, nil
}