(ctx context.Context, repo *cache.RepoCache)
| 85 | } |
| 86 | |
| 87 | func (je *jiraExporter) cacheAllClient(ctx context.Context, repo *cache.RepoCache) error { |
| 88 | creds, err := auth.List(repo, |
| 89 | auth.WithTarget(target), |
| 90 | auth.WithKind(auth.KindLoginPassword), auth.WithKind(auth.KindLogin), |
| 91 | auth.WithMeta(auth.MetaKeyBaseURL, je.conf[confKeyBaseUrl]), |
| 92 | ) |
| 93 | if err != nil { |
| 94 | return err |
| 95 | } |
| 96 | |
| 97 | for _, cred := range creds { |
| 98 | login, ok := cred.GetMetadata(auth.MetaKeyLogin) |
| 99 | if !ok { |
| 100 | _, _ = fmt.Fprintf(os.Stderr, "credential %s is not tagged with a Jira login\n", cred.ID().Human()) |
| 101 | continue |
| 102 | } |
| 103 | |
| 104 | user, err := repo.Identities().ResolveIdentityImmutableMetadata(metaKeyJiraLogin, login) |
| 105 | if entity.IsErrNotFound(err) { |
| 106 | continue |
| 107 | } |
| 108 | if err != nil { |
| 109 | return nil |
| 110 | } |
| 111 | |
| 112 | if _, ok := je.identityClient[user.Id()]; !ok { |
| 113 | client, err := buildClient(ctx, je.conf[confKeyBaseUrl], je.conf[confKeyCredentialType], cred) |
| 114 | if err != nil { |
| 115 | return err |
| 116 | } |
| 117 | je.identityClient[user.Id()] = client |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | return nil |
| 122 | } |
| 123 | |
| 124 | // getClientForIdentity return an API client configured with the credentials |
| 125 | // of the given identity. If no client were found it will initialize it from |
no test coverage detected