MCPcopy Index your code
hub / github.com/git-bug/git-bug / cacheAllClient

Method cacheAllClient

bridge/jira/export.go:87–122  ·  view source on GitHub ↗
(ctx context.Context, repo *cache.RepoCache)

Source from the content-addressed store, hash-verified

85}
86
87func (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

Callers 1

InitMethod · 0.95

Calls 12

ListFunction · 0.92
WithTargetFunction · 0.92
WithKindFunction · 0.92
WithMetaFunction · 0.92
IsErrNotFoundFunction · 0.92
IdentitiesMethod · 0.80
buildClientFunction · 0.70
GetMetadataMethod · 0.65
IDMethod · 0.65
IdMethod · 0.65
HumanMethod · 0.45

Tested by

no test coverage detected